Skip to content

Commit

Permalink
chore: documentation of new filter in db-object widget (#1254)
Browse files Browse the repository at this point in the history
Documentation for the new filter in db-object widget
PR in CHT-Core: medic/cht-core#8759
  • Loading branch information
latin-panda authored Jan 10, 2024
1 parent 3bb04a4 commit 46158b6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
8 changes: 8 additions & 0 deletions content/en/apps/guides/forms/form-inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ A value can be pre-selected for the search box via a `calculate` expression. By
| string | person_id | Person ID | select-contact type-person | |
| string | household_id | Household ID | select-contact type-clinic | ../inputs/contact/parent/_id |

### Loading descendants of the current contact

Use the appearance `descendant-of-current-contact` to load the current contact's descendants when opening an app form or contact form from the "People" tab.

| type | name | label | appearance |
|-------------|-------------------|---------------------|-----------------------------------------------------------|
| string | household_members | Household's members | select-contact type-person descendant-of-current-contact |

### Loading additional contact data

Additional data about the contact can be loaded by adding fields to the same group as the contact selector. The field name must match the name of a field on the contact doc. The data will be loaded when the contact is selected and will overwrite any existing data in the field.
Expand Down
36 changes: 18 additions & 18 deletions content/en/apps/reference/forms/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ In between the `inputs` and the closing group is the form flow - a collection of

Since writing raw XML can be tedious, we suggest creating the forms using the [XLSForm standard](http://xlsform.org/), and using the [cht-conf](https://github.com/medic/cht-conf) command line configurer tool to [convert them to XForm format](#build).

| type | name | label | relevant | appearance | calculate | ... |
|---|---|---|---|---|---|---|
| type | name | label | relevant | appearance | calculate | ... |
|-------------|---|---|---|---|---|---|
| begin group | inputs | Inputs | ./source = 'user' | field-list |
| hidden | source |
| hidden | source_id |
| hidden | task_id | Task_ID
| hidden | source |
| hidden | source_id |
| hidden | task_id | Task_ID
| begin group | contact |
| db:person | _id | Patient ID | | db-object |
| string | patient_id | Medic ID | | hidden |
| string | name | Patient Name | | hidden |
| end group
| end group
| calculate | _id | | | | ../inputs/contact/_id |
| calculate | patient_id | | | | ../inputs/contact/patient_id |
| calculate | name | | | | ../inputs/contact/name |
| ...
| string | _id | Patient ID | | select-contact type-person |
| string | patient_id | Medic ID | | hidden |
| string | name | Patient Name | | hidden |
| end group
| end group
| calculate | _id | | | | ../inputs/contact/_id |
| calculate | patient_id | | | | ../inputs/contact/patient_id |
| calculate | name | | | | ../inputs/contact/name |
| ...
| begin group | group_summary | Summary | | field-list summary |
| note | r_patient_info | \*\*${patient_name}\*\* ID: ${r_patient_id} |
| note | r_followup | Follow Up \<i class="fa fa-flag"\>\</i\> |
| note | r_followup_note | ${r_followup_instructions} |
| end group |
| note | r_patient_info | \*\*${patient_name}\*\* ID: ${r_patient_id} |
| note | r_followup | Follow Up \<i class="fa fa-flag"\>\</i\> |
| note | r_followup_note | ${r_followup_instructions} |
| end group |

**Note:** If the form uses a file picker to upload any type of file, and it is accessed by using CHT Android, then include the `READ_EXTERNAL_STORAGE` permission in order to access the files in the device. To enable this permission add the following line in the branded app's `AndroidManifest.xml`.
```
Expand Down
4 changes: 2 additions & 2 deletions content/en/apps/tutorials/app-forms.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ Create 2 additional sheets. Rename the sheets `survey`, `choices` and `settings`
Create the following columns in the survey sheet and then add the following rows that are populated automatically before the form is rendered to the user. These fields are usually hidden by default but can be accessed to display certain information about the person being assessed:

| type | name | label | required | relevant | appearance | constraint | constraint_message | calculation | choice_filter | hint | default |
| ----------- | --------------- | --------------------------- | -------- | ----------------- | ---------- | ---------- | ------------------- | ---------------------- | -------------- | ----------------------------- | ------- |
|-------------| --------------- | --------------------------- | -------- | ----------------- |------------| ---------- | ------------------- | ---------------------- | -------------- | ----------------------------- | ------- |
| begin group | inputs | Patient | | ./source = 'user' | field-list | | | | | | |
| hidden | source | Source | | | | | | | | | user |
| hidden | source_id | Source_ID | | | | | | | | | |
| hidden | task_id | Task_ID | | | | | | | | | |
| begin group | contact | Contact | | | | | | | | | |
| db:person | _id | Patient ID | | | db-object | | | | | Select a person from the list | |
| string | _id | Patient ID | | | select-contact type-person | | | | | Select a person from the list | |
| hidden | patient_id | Medic ID | | | | | | | | | |
| hidden | name | Patient Name | | | | | | | | | |
| begin group | parent | Parent | | | | | | | | | |
Expand Down

0 comments on commit 46158b6

Please sign in to comment.