-
Notifications
You must be signed in to change notification settings - Fork 4
feat: introduce persistent, active and repeated populate types #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
delcroip
wants to merge
1
commit into
develop
Choose a base branch
from
feature/inputs
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| # TRICC Input/Populate Types | ||
|
|
||
| This document explains the different kinds of input/populate nodes available in TRICC for drawio authors and content creators. These nodes allow fetching and managing data from previous encounters, patient records, or encounter context. | ||
|
|
||
| ## Overview | ||
|
|
||
| TRICC supports three main populate/input types with distinct behaviors: | ||
|
|
||
| ### 1\. **Persistent** (`persistent`) | ||
|
|
||
| - **Purpose**: Stable data with one current value (updates in place). | ||
| - **Use Case**: Patient-level data like facility context demographics that persist across encounters. | ||
| - **Attribute** `context`: | ||
| - **Default Context**: `patient` (`facility` for CHT HF strategy) | ||
| - **Other Contexts**: `practitioner`, `facility`, `location` | ||
| - **Behavior**: Supports inheritance, last version, default value, relevance. | ||
| - **Drawio Usage**: Set `odk_type="persistent"` or use the dedicated persistent shape. Add `context` attribute if needed. | ||
|
|
||
| ### 2\. **Active** (`active`) | ||
|
|
||
| - **Purpose**: Current/active data that can be skipped if already known (`skip_or_new` update mode). | ||
| - **Use Case**: Encounter-specific data like current symptoms or measurements that may carry over or be updated. | ||
| - **Attribute** `from`: | ||
| - **Default** : `encounter` | ||
| - **Other**: ISO duration like `P14D` (14 days), `P1M` (1 month). | ||
| - **Behavior**: Supports inheritance, last version, default, relevance. | ||
| - **Drawio Usage**: Set `odk_type="active"` or dedicated shape. Use `from` attribute for lookup scope. | ||
|
|
||
| ### 3\. **Repeated** (`repeated`) | ||
|
|
||
| - **Purpose**: Repeated/chartable data that **always creates a new entry** (`always_new`). | ||
| - **Use Case**: Serial measurements, visit history, or chartable events (e.g., blood pressure readings over time). | ||
| - **Attribute** `from`: | ||
| - **Default**: `encounter` | ||
| - **Other**: ISO duration like `P14D` (14 days), `P1M` (1 month). | ||
| - **Behavior**: **No** inheritance, last-version, default value, or relevance based on last version. **Mandatory** `last.` prefix in calculations. | ||
| - **Drawio Usage**: Set `odk_type="repeated"` or dedicated shape. Use `from` attribute. | ||
|
|
||
| **Backward Compatibility**: `odk_type="input"` or old `history` maps to `persistent`. | ||
|
|
||
| ## Core Behavior Matrix | ||
|
|
||
| | Type | Update Mode | Inheritance | Last Version | Default | Relevance | Calc Prefix | | ||
| | --- | --- | --- | --- | --- | --- | --- | | ||
| | persistent | update_existing | Yes | Yes | Yes | Yes | No | | ||
| | active | skip_or_new | Yes | Yes | Yes | Yes | No | | ||
| | repeated | always_new | **No** | **No** | **No** | **No** | `last.` (mandatory) | | ||
|
|
||
| **Note**: Repeated nodes are completely excluded from version inheritance and last-version logic to ensure new entries. | ||
|
|
||
| ## Attributes | ||
|
|
||
| - **context** (persistent): patient (default), practitioner, facility, location. Used for lookup/storage. | ||
| - **from** (active/repeated): encounter (default) or ISO duration string (e.g., `P1Y` for 1 year). Note: XML uses `from`, mapped to `from_` in model. | ||
|
|
||
| ## How to Use in Drawio | ||
|
|
||
| 1. Use the TRICC tools shapes or set the object type/semantic in properties. | ||
| 2. For persistent/active/repeated, set the `odk_type` property or use the corresponding object in TYPE_MAP. | ||
| 3. Add attributes like `context="location"` or `from="P14D"` in the shape properties. | ||
| 4. For calculations referencing them, the expression builder automatically applies the correct prefix ( `last.`). | ||
| 5. In CHT outputs: | ||
| - Persistent: appears in Contact Summary. | ||
| - Active/Repeated: in calculated contact summary and CHT tasks (see `imci-task.js` patterns for task generation). | ||
|
|
||
| ## Examples | ||
|
|
||
| - **Patient Name**: semantic=persistent, context=patient, name=name. | ||
| - **Active Encounter BP**: semantic=active, from=encounter, name=bp_reading. | ||
| - **Repeated Measurements**: semantic=repeated, from=P7D, name=weight (creates new entry each time). | ||
|
|
||
| See `docs/tricc-elements.md` for shape details and `tests/data/` for example drawio files with these nodes. | ||
|
|
||
| For XLSForm/CHT/HF outputs, the types map to appropriate fields, calculations, and task configurations. | ||
|
|
||
| **Author Tip**: Use the new types to reduce duplication in forms. Persistent for core patient data, active for current state, repeated for longitudinal tracking. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might add "history" as context and merge with active, history will expect "from"