Skip to content

Commit

Permalink
Update unique id docs (#3481)
Browse files Browse the repository at this point in the history
* move forms up a level and split out unique ids

* add verhoeff instructions

* lowercase
  • Loading branch information
pld committed Sep 5, 2024
1 parent 3a93d7d commit 92b9fb6
Show file tree
Hide file tree
Showing 4 changed files with 278 additions and 157 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
title: Questionnaires
title: Forms
---

# Questionnaire configuration
# Form configuration

This configuration is used to configure a Questionnaire. A Questionnaire is a data entry form used that is compliant to the FHIR specifications for a [Questionnaire](https://www.hl7.org/FHIR/questionnaire.html)
Forms in FHIR and OpenSRP2 are defined through the [Questionnaire resource](https://www.hl7.org/FHIR/questionnaire.html).
This configuration is used to configure a Questionnaire.

:::tip
Use this configuration in other configs like profile and register.
Expand Down Expand Up @@ -328,159 +329,6 @@ triggerConditions | This defines an array of condition for to be met for the eve
eventResourceId | uniqueId of resource id to be closed | yes | |
eventResources | A list of resources to close(Type of ResourceConfig) | yes | | |

## Unique ID assignment

Unique IDs are unique identifier values assigned to a resource (e.g. Patient) and are associated with a single entity.

Unique ID assignment configs determine how pre-generated unique IDs are retrieved from a Group FHIR resource and subsequently populated in a Questionnaire field.

Here is a sample configuration for the unique identifier assignment:

```json
{
"uniqueIdAssignment": {
"linkId": "phn",
"idFhirPathExpression": "Group.characteristic.where(exclude=false and code.text='phn').first().value.text",
"readOnly": false,
"resource": "Group",
"sortConfigs": [
{
"paramName": "_lastUpdated",
"dataType": "DATE",
"order": "DESCENDING"
}
],
"resourceFilterExpression": {
"conditionalFhirPathExpressions": [
"Group.active = true and Group.type = 'device' and Group.name = 'Unique IDs'"
],
"matchAll": true
}
}
}
```

The configuration contains the following properties:

**linkId** - The linkId for the targeted Questionnaire item
**idFhirPathExpression** - The FHIR path expression used to extract ID from a resource
**readOnly** - Enable or disable editing of the field. Defaults to `true`
**resource** - FHIR resource used to store generated unique IDs
**sortConfigs** - For ordering resources. It is important to ensure the resources are ordered by last updated
**resourceFilterExpression** - Extra configurations to apply filter via code on the declared Resource

*NOTE:* If the `readOnly` configuration is set to false, the ID field in the Questionnaire becomes editable. If the prepopulated ID
is modified and a different ID is submitted with the Questionnaire, the prepopulated ID will not be marked as used.
This means that it will still be prepopulated the next time the Questionnaire is launched.

## Characteristic-based Group resource for unique IDs

IDs are stored as `text` in a `valueCodeableConcept` in the `characteristic` field.
The batch of IDs is assigned to a Practitioner using the `managingEntity`.

When an ID is used, the characteristic entry with that ID is updated to be excluded by setting `"exclude": true`. Once all IDs in the Group are used, the group is set to inactive.

## Sample Group resource with unique IDs

```json
{
"resourceType": "Group",
"id": "37312ad4-538e-4535-82d2-ea14f40deeb9",
"meta": {
"versionId": "9",
"lastUpdated": "2023-12-22T06:43:35.986+00:00",
"source": "#04a1c85fb6adf0cc",
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "3e005baf-854b-40a7-bdd5-9b73f63aa9a3",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "41eae946-bdc4-4179-b404-6503ff12f59c",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "3816",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "49b72a3d-44cd-4a74-9459-4dc9f6b543fa",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"identifier": [
{
"system": "http://smartregister.org",
"value": "37312ad4-538e-4535-82d2-ea14f40deeb9"
}
],
"active": true,
"type": "device",
"actual": true,
"name": "Unique IDs",
"managingEntity": {
"reference": "Practitioner/49b72a3d-44cd-4a74-9459-4dc9f6b543fa"
},
"characteristic": [
{
"code": {
"text": "phn"
},
"valueCodeableConcept": {
"text": "1000010001"
},
"exclude": false
},
{
"code": {
"text": "phn"
},
"valueCodeableConcept": {
"text": "1000020002"
},
"exclude": false
},
{
"code": {
"text": "phn"
},
"valueCodeableConcept": {
"text": "1000030003"
},
"exclude": false
},
{
"code": {
"text": "phn"
},
"valueCodeableConcept": {
"text": "1000040004"
},
"exclude": false
},
{
"code": {
"text": "phn"
},
"valueCodeableConcept": {
"text": "1000050005"
},
"exclude": false
}
]
}
```

## Hiding characters in a questionnaire

Sensitive information typed on a questionnaire can be hidden through adding a linkId extension. A sample linkId with password-widget extension looks like
Expand Down Expand Up @@ -592,4 +440,4 @@ The QR code widget supports adding an arbitrary number of QR codes, implemented
]
}
```
The extension's implementation can be found [here](https://github.com/opensrp/fhircore/blob/main/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/sdc/qrCode/EditTextQrCodeViewHolderFactory.kt)
The extension's implementation can be found [here](https://github.com/opensrp/fhircore/blob/main/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/sdc/qrCode/EditTextQrCodeViewHolderFactory.kt)
Loading

0 comments on commit 92b9fb6

Please sign in to comment.