Skip to main content

Editing

You can manage edits through

  1. complex structure maps to ensure that any potential downstream effects of an edit (like changing CarePlan or Task status) are accounted for, or
  2. limiting what is editable to only those fields(data elements) that do not have downstream affects.

We suggest following approach (2) above to reduce the chance of errors and the resulting inconsistent data. This approach can be implemented using the two options suggested below;

Limiting what is editable

Toggle visibility for select questionnaire items

Below we describe how to limit what is editable while reusing the same FHIR resources that created the data. This assumes that you have

  • a Questionniare that data is originally entered in and will be edited in,
  • a StructureMap that extracts data from the QuestionnaireResponse into other resources,
  • a config the specifies one interface to launch the Questionnaire for creation and another to launch it for editing.
  1. Create a new hidden item in the Questionnaire to hold the is-edit-mode value
{
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/questionnaire-hidden",
"valueBoolean": true
}
],
"linkId": "is-edit-profile",
"type": "boolean"
}
  1. Pre-populate the new item on when loading the questionnaire, to use a static rule with a boolean value of true. Do this for any button or menu-item that you want to launch the edit form.

Sample rule:

{
"name": "isEditProfile",
"condition": "true",
"actions": [
"data.put('isEditProfile', true)"
]
}

Sample pre-population:

{
"paramType": "PREPOPULATE",
"linkId": "is-edit-profile",
"dataType": "BOOLEAN",
"key": "isEditProfile",
"value": "@{isEditProfile}"
}
  1. Use the pre-set value of the edit mode item, isEditProfile, to enable the items with downstream effects in the Questionnaire, such as date of birth and gender, using the enableWhen Questionnaire item attribute. This will cause those items only to show when isEditProfile is false, i.e. when creating data.
"enableWhen": [
{
"question": "is-edit-profile",
"operator": "exists",
"answerBoolean": false
}
],
"enableBehavior": "any"
  1. Launch the Questionnaire from an edit menu just as would is creating, but prepopulate the previously captured items. This approach allows to you to use the existing Questionnaire and StructureMap.

Block select questionnaire items from editing

Using readOnlyLinkIds config

Below we defines how we can limit the Edit to QuestionnaireItems in Edit Mode

For the Questionnaire with Edit Mode, Assign the list of QuestionnaireItems->link-ids to the property readOnlyLinkIds of QuestionnaireConfig : like

"readOnlyLinkIds": [
"0740ed31-554a-4069-81d9-08f9f1697a03",
"6c2d4f74-84d5-49cd-81dd-a53e101a6899",
"5f06debf-721a-457d-8540-65cac95be9a1",
"e5bb0db6-82a0-4200-b421-334da8a916a4"
]

This list is handled with fhircore app function named prepareQuestionsForReadingOrEditing to restrict the input behaviour on the provided link-ids fields when Questionnaire is rendered, this allows for visbility of the data capruted previously however user is unable to make edits.