diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11caf7326..c2f36810a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -174,37 +174,37 @@ jobs: branch: chore/bump-form-engine base: main - bump-form_builder: - runs-on: ubuntu-latest - - needs: pre_release - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - repository: openmrs/openmrs-esm-form-builder - ref: main - - - name: Install dependencies - run: yarn - - - name: Bump form engine - run: yarn ci:bump-form-engine-lib - - - name: Commit changes - run: | - git config user.email "github-actions@github.com" - git config user.name "GitHub Actions" - git add yarn.lock - git commit -m "(chore) bump-form-engine" - - - name: Create PR - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.ACTIONS_OHRI_PAT }} - commit-message: "(chore) Bump `@openmrs/openmrs-form-engine-lib`" - title: "(chore) Bump `@openmrs/openmrs-form-engine-lib`" - body: "This is an automated PR that bumps the [form engine library](https://github.com/openmrs/openmrs-form-engine-lib) to the newest available version tagged `next`." - branch: chore/bump-form-engine - base: main + # bump-form_builder: + # runs-on: ubuntu-latest + + # needs: pre_release + + # steps: + # - name: Checkout code + # uses: actions/checkout@v3 + # with: + # repository: openmrs/openmrs-esm-form-builder + # ref: main + + # - name: Install dependencies + # run: yarn + + # - name: Bump form engine + # run: yarn ci:bump-form-engine-lib + + # - name: Commit changes + # run: | + # git config user.email "github-actions@github.com" + # git config user.name "GitHub Actions" + # git add yarn.lock + # git commit -m "(chore) bump-form-engine" + + # - name: Create PR + # uses: peter-evans/create-pull-request@v3 + # with: + # token: ${{ secrets.ACTIONS_OHRI_PAT }} + # commit-message: "(chore) Bump `@openmrs/openmrs-form-engine-lib`" + # title: "(chore) Bump `@openmrs/openmrs-form-engine-lib`" + # body: "This is an automated PR that bumps the [form engine library](https://github.com/openmrs/openmrs-form-engine-lib) to the newest available version tagged `next`." + # branch: chore/bump-form-engine + # base: main diff --git a/__mocks__/forms/ohri-forms/component_art.json b/__mocks__/forms/ohri-forms/component_art.json new file mode 100644 index 000000000..d4bc502fa --- /dev/null +++ b/__mocks__/forms/ohri-forms/component_art.json @@ -0,0 +1,1705 @@ +{ + "name": "component_art", + "uuid": "2f063f32-7f8a-11ee-b962-0242ac120002", + "processor": "EncounterFormProcessor", + "pages": [ + { + "label": "ART ", + "sections": [ + { + "label": "ART First Visit", + "questions": [ + { + "label": "Patient previous ART use", + "type": "obs", + "id": "pastArtUse", + "questionOptions": { + "concept": "a8a318e8-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a899b35c-1350-11df-a1f1-0026b9348838", + "label": "Yes" + }, + { + "concept": "a899b42e-1350-11df-a1f1-0026b9348838", + "label": "No" + } + ], + "rendering": "select" + } + }, + { + "label": "Date patient first became medically eligible for ART:", + "id": "eligibility", + "type": "obs", + "questionOptions": { + "concept": "81608e3b-fece-4136-8def-b822b54de197", + "rendering": "date" + }, + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + }, + { + "type": "js_expression", + "failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')", + "message": "Date should be before the encounter date." + } + ] + }, + { + "label": "Reason for eligibility:", + "type": "obs", + "id": "reasonEligible", + "questionOptions": { + "concept": "87c0a7b8-9878-459e-b0f5-e0358f4811d4", + "answers": [ + { + "concept": "a8a0be2c-1350-11df-a1f1-0026b9348838", + "label": "Clinical" + }, + { + "concept": "1ea9d6ba-2084-4bc0-97a6-46fe677d40e5", + "label": "WHO Stage" + }, + { + "concept": "a8970a26-1350-11df-a1f1-0026b9348838", + "label": "CD4 %" + }, + { + "concept": "a89fbedc-1350-11df-a1f1-0026b9348838", + "label": "PMTCT" + }, + { + "concept": "a8909060-1350-11df-a1f1-0026b9348838", + "label": "Hepatitis" + }, + { + "concept": "a8af49d8-1350-11df-a1f1-0026b9348838", + "label": "Discordant couple" + }, + { + "concept": "a89b2606-1350-11df-a1f1-0026b9348838", + "label": "WHO Stage 1" + }, + { + "concept": "a89b26d8-1350-11df-a1f1-0026b9348838", + "label": "WHO Stage 2" + }, + { + "concept": "a89b27be-1350-11df-a1f1-0026b9348838", + "label": "WHO Stage 3" + }, + { + "concept": "a89b289a-1350-11df-a1f1-0026b9348838", + "label": "WHO Stage 4" + } + ], + "rendering": "multiCheckbox" + } + }, + { + "label": "Date started:", + "type": "obs", + "id": "pastArtDate", + "questionOptions": { + "concept": "a89d200a-1350-11df-a1f1-0026b9348838", + "rendering": "date" + }, + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + }, + { + "type": "js_expression", + "failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')", + "message": "ARV start date should be before the encounter date." + } + ] + }, + { + "label": "Date last used:", + "type": "obs", + "id": "pastArtDateLastUsed", + "questionOptions": { + "concept": "a67ffb12-761b-48cb-a670-ce0bc0a50d60", + "rendering": "date" + }, + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + }, + { + "type": "js_expression", + "failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')", + "message": "ARV start date should be before the encounter date." + } + ] + }, + { + "label": "Date stopped:", + "type": "obs", + "id": "pastArtDateStop", + "questionOptions": { + "concept": "a89ec270-1350-11df-a1f1-0026b9348838", + "rendering": "date" + }, + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + }, + { + "type": "js_expression", + "failsWhenExpression": "(new moment(encDate)).isBefore((new moment(myValue)), 'day') || (new moment(encDate)).isSame((new moment(myValue)), 'day')", + "message": "ARV start date should be before the encounter date." + } + ] + }, + { + "label": "Reason for use in past:", + "id": "reasonPastUse", + "type": "obs", + "questionOptions": { + "concept": "a8a31a00-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89adc46-1350-11df-a1f1-0026b9348838", + "label": "Treatment" + }, + { + "concept": "a8a19c20-1350-11df-a1f1-0026b9348838", + "label": "PEP" + }, + { + "concept": "a89fbedc-1350-11df-a1f1-0026b9348838", + "label": "PMTCT" + } + ], + "rendering": "select" + } + }, + { + "label": "Past treatment categories:", + "id": "pastCate", + "type": "obs", + "questionOptions": { + "concept": "c89f8473-474d-4165-b7bd-e9f54e908f45", + "answers": [ + { + "concept": "034047bd-3fa1-4b2a-b0f0-2787e9b9f7b3", + "label": "First Line Regimen" + }, + { + "concept": "8f8a715d-e49a-4b2c-aa3a-83fa9d7a4254", + "label": "Second Line Regimen" + }, + { + "concept": "a90ebdd2-351f-485a-b850-4938fcca2729", + "label": "Third Line Regimen" + } + ], + "rendering": "select" + } + }, + { + "label": "Past ART, peds:", + "id": "pastArvDrugsPed", + "type": "obs", + "questionOptions": { + "concept": "a8a318e8-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "b58a28d2-36de-11e0-93be-0026b9348838", + "label": "ABC 60mg/3TC 30mg" + }, + { + "concept": "25c753d8-870f-11e0-85d3-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg" + }, + { + "concept": "20185c04-9334-11df-8193-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg/NVP 50mg" + }, + { + "concept": "8ddf2f66-9333-11df-8193-000d6014b64c", + "label": "ZDV 300mg/3TC 150mg/NVP 200mg >25kgs" + }, + { + "concept": "fd4cd670-3115-11e0-8090-0026b9348838", + "label": "3TC 150mg/ZDV 300mg >25kgs" + }, + { + "concept": "b9da84e8-3127-11e0-8090-0026b9348838", + "label": "3TC 300mg/TDF 300mg >25kgs" + }, + { + "concept": "e0037172-87ce-11e0-85d3-000d6014b64c", + "label": "TDF 300mg/3TC 300mg/EFV 600mg >35kgs" + }, + { + "concept": "f8b6299e-6bbf-446a-b3f1-a88f5d6b9da2", + "label": "Lopinavir 80mg/Ritonavir 20mg" + }, + { + "concept": "fa8266f6-36df-11e0-93be-0026b9348838", + "label": "Lopinavir 200mg/Ritonavir 50mg >25kgs" + }, + { + "concept": "3cbfb0b9-721e-4d42-92a3-7d37269aab24", + "label": " Atazanavir 300mg/ritonavir 100mg" + }, + { + "concept": "2fc1f68c-9939-44d4-b5f4-e064ed4073ca", + "label": "Nevirapine 100mg" + }, + { + "concept": "0485075a-3111-11e0-8090-0026b9348838", + "label": "Nevirapine 200mg" + }, + { + "concept": "db3c194b-3e1b-4001-9a1c-a5df1728fc28", + "label": "Efavirenz 200mg" + }, + { + "concept": "ff9096b6-d86c-403a-9bda-eab02252dbf3", + "label": "Efavirenz 250mg" + }, + { + "concept": "55e0461f-b28f-42de-a3c6-328d7f17c44b", + "label": "Efavirenz 350mg" + }, + { + "concept": "81a41a82-fd72-4da4-8d47-edd5672549ce", + "label": "Efavirenz 400mg" + }, + { + "concept": "4677ad3e-3120-11e0-8090-0026b9348838", + "label": "Efavirenz 600mg" + }, + { + "concept": "d6262526-3113-11e0-8090-0026b9348838", + "label": "Lamivudine 150mg" + }, + { + "concept": "52441ef8-3126-11e0-8090-0026b9348838", + "label": " Abacavir 300mg" + }, + { + "concept": "21d417bc-3114-11e0-8090-0026b9348838", + "label": " Zidovudine 300mg " + }, + { + "concept": "1baf254e-1429-4fd9-8db1-edf6523cea13", + "label": " Ritonavir 100mg" + }, + { + "concept": "42ef7c4d-d6fb-49c0-a46e-019c42dea203", + "label": " Ritonavir 80mg" + }, + { + "concept": "da698164-870d-11e0-85d3-000d6014b64c", + "label": " Raltegravir 400mg" + }, + { + "concept": "a8afbf9e-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir " + } + ], + "rendering": "single-select" + } + }, + { + "label": "Past ART, adult:", + "id": "pastArvDrugsAdult", + "type": "obs", + "questionOptions": { + "concept": "a8a318e8-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "6a73f32d-1870-4527-af6e-74443251ded2", + "label": "NVP200/ZDV300/3TC150" + }, + { + "concept": "1c4a75d0-cc91-4752-b0a5-4b833326ff7a", + "label": "TDF300mg/3TC300mg/EFV600mg" + }, + { + "concept": "a89cc876-1350-11df-a1f1-0026b9348838", + "label": "3TC300mg/TDF300mg" + }, + { + "concept": "3d587177-984e-4eeb-93f2-3223b6c1dd7c", + "label": "3TC150mg/D4T30mg" + }, + { + "concept": "a896758e-1350-11df-a1f1-0026b9348838", + "label": "3TC150mg/ZDV300mg" + }, + { + "concept": "a897e608-1350-11df-a1f1-0026b9348838", + "label": "NVP200/D4T30/3TC150" + }, + { + "concept": "a8afcf84-1350-11df-a1f1-0026b9348838", + "label": "Emtri200mg/TDF300(Truvada)" + }, + { + "concept": "a897e7c0-1350-11df-a1f1-0026b9348838", + "label": "Aluvia(Kaletra)200mg/LPV50mg" + }, + { + "concept": "a8afc066-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir300/Ritonavir100" + }, + { + "concept": "dabf36cb-dd9a-4542-a8ef-874c1ee5be4a", + "label": "FTC200mg/RPV25mg/TDF245mg(Eviplera)" + }, + { + "concept": "a897f8a0-1350-11df-a1f1-0026b9348838", + "label": "Abacavir300mg" + }, + { + "concept": "a89677e6-1350-11df-a1f1-0026b9348838", + "label": "Efavirenz600mg" + }, + { + "concept": "a89673f4-1350-11df-a1f1-0026b9348838", + "label": "Lamivudine150mg" + }, + { + "concept": "a8967656-1350-11df-a1f1-0026b9348838", + "label": "Nevirapine200mg" + }, + { + "concept": "a8afbd64-1350-11df-a1f1-0026b9348838", + "label": "Raltegravir 400mg" + }, + { + "concept": "a897ea4a-1350-11df-a1f1-0026b9348838", + "label": "Zidovudine300mg" + }, + { + "concept": "68a0a5dd-1e91-43a2-8dce-c6e84a14de04", + "label": "Darunavir 600mg" + }, + { + "concept": "38fbba9c-4b26-412d-9659-8dd649514d66", + "label": "Etravirine 100mg" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "None" + }, + { + "concept": "a8a87a86-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "multi-select" + } + } + ] + }, + { + "label": "ART History", + "isExpanded": "true", + "questions": [ + { + "label": "Patient currently on ART:", + "required": "true", + "id": "onArt", + "historicalExpression": "arrayContainsAny(['a89b7c50-1350-11df-a1f1-0026b9348838','a89b7ae8-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838'], HD.getObject('prevEnc').getValue('a89b75d4-1350-11df-a1f1-0026b9348838')) ? 'a899b35c-1350-11df-a1f1-0026b9348838' : HD.getObject('prevEnc').getValue('a89ae254-1350-11df-a1f1-0026b9348838')", + "questionOptions": { + "concept": "a89ae254-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a899b35c-1350-11df-a1f1-0026b9348838", + "label": "Yes" + }, + { + "concept": "a899b42e-1350-11df-a1f1-0026b9348838", + "label": "No" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [] + }, + { + "label": "Reason for use:", + "id": "reasonUse", + "type": "obs", + "questionOptions": { + "concept": "a8a30d1c-1350-11df-a1f1-0026b9348838", + "rendering": "select", + "answers": [ + { + "concept": "a89adc46-1350-11df-a1f1-0026b9348838", + "label": "Treatment" + }, + { + "concept": "a8a19c20-1350-11df-a1f1-0026b9348838", + "label": "PEP" + }, + { + "concept": "a89fbedc-1350-11df-a1f1-0026b9348838", + "label": "PMTCT" + } + ] + }, + "validators": [], + "hide": { + "hideWhenExpression": "onArt!== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "If patient started ART since last visit, enter start date:", + "id": "startDate", + "questionOptions": { + "concept": "a89d200a-1350-11df-a1f1-0026b9348838", + "rendering": "date" + }, + "type": "obs", + "validators": [ + { + "type": "date" + } + ], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Line of ART patient is taking:", + "id": "current_arv_line", + "historicalExpression": "!_.isEmpty(HD.getObject('prevEnc').getValue('a89b6a62-1350-11df-a1f1-0026b9348838')) ? undefined : HD.getObject('prevEnc').getValue('04616f5d-b961-4f41-bbd7-bcc0dd235577')", + "questionOptions": { + "concept": "04616f5d-b961-4f41-bbd7-bcc0dd235577", + "answers": [ + { + "concept": "034047bd-3fa1-4b2a-b0f0-2787e9b9f7b3", + "label": "First line regimen" + }, + { + "concept": "8f8a715d-e49a-4b2c-aa3a-83fa9d7a4254", + "label": "Second line regimen" + }, + { + "concept": "a90ebdd2-351f-485a-b850-4938fcca2729", + "label": "Third line regimen" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "isEmpty(myValue) && !isEmpty(onArt) && onArt === 'a899b35c-1350-11df-a1f1-0026b9348838'", + "message": "Patient previously marked as on ART. Please provide the treatment category." + } + ], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Patient's current ART regimen, peds:", + "id": "current_art_regimen_ped", + "questionOptions": { + "concept": "a899cf5e-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "b58a28d2-36de-11e0-93be-0026b9348838", + "label": "ABC 60mg/3TC 30mg" + }, + { + "concept": "25c753d8-870f-11e0-85d3-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg" + }, + { + "concept": "20185c04-9334-11df-8193-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg/NVP 50mg" + }, + { + "concept": "8ddf2f66-9333-11df-8193-000d6014b64c", + "label": "ZDV 300mg/3TC 150mg/NVP 200mg >25kgs" + }, + { + "concept": "fd4cd670-3115-11e0-8090-0026b9348838", + "label": "3TC 150mg/ZDV 300mg >25kgs" + }, + { + "concept": "b9da84e8-3127-11e0-8090-0026b9348838", + "label": "3TC 300mg/TDF 300mg >25kgs" + }, + { + "concept": "e0037172-87ce-11e0-85d3-000d6014b64c", + "label": "TDF 300mg/3TC 300mg/EFV 600mg >35kgs" + }, + { + "concept": "f8b6299e-6bbf-446a-b3f1-a88f5d6b9da2", + "label": "Lopinavir 80mg/Ritonavir 20mg" + }, + { + "concept": "fa8266f6-36df-11e0-93be-0026b9348838", + "label": "Lopinavir 200mg/Ritonavir 50mg >25kgs" + }, + { + "concept": "3cbfb0b9-721e-4d42-92a3-7d37269aab24", + "label": " Atazanavir 300mg/ritonavir 100mg" + }, + { + "concept": "2fc1f68c-9939-44d4-b5f4-e064ed4073ca", + "label": "Nevirapine 100mg" + }, + { + "concept": "0485075a-3111-11e0-8090-0026b9348838", + "label": "Nevirapine 200mg" + }, + { + "concept": "db3c194b-3e1b-4001-9a1c-a5df1728fc28", + "label": "Efavirenz 200mg" + }, + { + "concept": "ff9096b6-d86c-403a-9bda-eab02252dbf3", + "label": "Efavirenz 250mg" + }, + { + "concept": "55e0461f-b28f-42de-a3c6-328d7f17c44b", + "label": "Efavirenz 350mg" + }, + { + "concept": "81a41a82-fd72-4da4-8d47-edd5672549ce", + "label": "Efavirenz 400mg" + }, + { + "concept": "4677ad3e-3120-11e0-8090-0026b9348838", + "label": "Efavirenz 600mg" + }, + { + "concept": "d6262526-3113-11e0-8090-0026b9348838", + "label": "Lamivudine 150mg" + }, + { + "concept": "52441ef8-3126-11e0-8090-0026b9348838", + "label": " Abacavir 300mg" + }, + { + "concept": "21d417bc-3114-11e0-8090-0026b9348838", + "label": " Zidovudine 300mg " + }, + { + "concept": "1baf254e-1429-4fd9-8db1-edf6523cea13", + "label": " Ritonavir 100mg" + }, + { + "concept": "42ef7c4d-d6fb-49c0-a46e-019c42dea203", + "label": " Ritonavir 80mg" + }, + { + "concept": "da698164-870d-11e0-85d3-000d6014b64c", + "label": " Raltegravir 400mg" + }, + { + "concept": "a8afbf9e-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir " + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Patient's current ART regimen, adults:", + "id": "current_art_regimen_adult", + "historicalExpression": "_.isEmpty(HD.getObject('prevEnc').getValue('a89b6a62-1350-11df-a1f1-0026b9348838')) ? HD.getObject('prevEnc').getValue('a8a08344-1350-11df-a1f1-0026b9348838.a899cf5e-1350-11df-a1f1-0026b9348838') : HD.getObject('prevEnc').getValue('a89b6a62-1350-11df-a1f1-0026b9348838')", + "questionOptions": { + "concept": "a899cf5e-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "6a73f32d-1870-4527-af6e-74443251ded2", + "label": "NVP200/ZDV300/3TC150" + }, + { + "concept": "1c4a75d0-cc91-4752-b0a5-4b833326ff7a", + "label": "TDF300mg/3TC300mg/EFV600mg" + }, + { + "concept": "a89cc876-1350-11df-a1f1-0026b9348838", + "label": "3TC300mg/TDF300mg" + }, + { + "concept": "3d587177-984e-4eeb-93f2-3223b6c1dd7c", + "label": "3TC150mg/D4T30mg" + }, + { + "concept": "a896758e-1350-11df-a1f1-0026b9348838", + "label": "3TC150mg/ZDV300mg" + }, + { + "concept": "a897e608-1350-11df-a1f1-0026b9348838", + "label": "NVP200/D4T30/3TC150" + }, + { + "concept": "a8afcf84-1350-11df-a1f1-0026b9348838", + "label": "Emtri200mg/TDF300(Truvada)" + }, + { + "concept": "a897e7c0-1350-11df-a1f1-0026b9348838", + "label": "Aluvia(Kaletra)200mg/LPV50mg" + }, + { + "concept": "a8afc066-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir300/Ritonavir100" + }, + { + "concept": "dabf36cb-dd9a-4542-a8ef-874c1ee5be4a", + "label": "FTC200mg/RPV25mg/TDF245mg(Eviplera)" + }, + { + "concept": "a897f8a0-1350-11df-a1f1-0026b9348838", + "label": "Abacavir300mg" + }, + { + "concept": "a89677e6-1350-11df-a1f1-0026b9348838", + "label": "Efavirenz600mg" + }, + { + "concept": "a89673f4-1350-11df-a1f1-0026b9348838", + "label": "Lamivudine150mg" + }, + { + "concept": "a8967656-1350-11df-a1f1-0026b9348838", + "label": "Nevirapine200mg" + }, + { + "concept": "a8afbd64-1350-11df-a1f1-0026b9348838", + "label": "Raltegravir 400mg" + }, + { + "concept": "a897ea4a-1350-11df-a1f1-0026b9348838", + "label": "Zidovudine300mg" + }, + { + "concept": "68a0a5dd-1e91-43a2-8dce-c6e84a14de04", + "label": "Darunavir 600mg" + }, + { + "concept": "38fbba9c-4b26-412d-9659-8dd649514d66", + "label": "Etravirine 100mg" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "None" + }, + { + "concept": "a8a87a86-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "type": "obsGroup", + "label": "ART adherence", + "questionOptions": { + "concept": "bc3834dd-ef07-4027-be30-729baa069291", + "rendering": "group" + }, + "questions": [ + { + "label": "Adherence on ART:", + "id": "artAdherence", + "questionOptions": { + "concept": "2c363a0e-7cf9-42cd-9778-1301b09c4484", + "answers": [ + { + "concept": "a8b0f882-1350-11df-a1f1-0026b9348838", + "label": "Good" + }, + { + "concept": "a73d20b3-d721-4763-a362-14a0c41a6b5e", + "label": "Fair" + }, + { + "concept": "fdaf8b47-ea14-4d28-80fa-e1da58a30e8b", + "label": "Poor" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(onArt) && onArt === 'a899b35c-1350-11df-a1f1-0026b9348838' && isEmpty(myValue)", + "message": "Patient on ARVs. Please provide adherence history." + } + ], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Adherence (ART) Reason for poor/fair:", + "id": "artReasonPoorFair", + "questionOptions": { + "concept": "a89ebbc2-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89ced88-1350-11df-a1f1-0026b9348838", + "label": "Alcohol" + }, + { + "concept": "a8935fde-1350-11df-a1f1-0026b9348838", + "label": "Depression" + }, + { + "concept": "a89eac04-1350-11df-a1f1-0026b9348838", + "label": "Felt well" + }, + { + "concept": "a89eacc2-1350-11df-a1f1-0026b9348838", + "label": "Forgot" + }, + { + "concept": "7211031b-0685-44bc-a5e9-5a018d0173ea", + "label": "Gave away" + }, + { + "concept": "a8af4cee-1350-11df-a1f1-0026b9348838", + "label": "Lost/Ran out of pills" + }, + { + "concept": "ecafa614-49c5-4eba-84c7-b85b0d9e2c46", + "label": "Pill Burden" + }, + { + "concept": "a89eb8c0-1350-11df-a1f1-0026b9348838", + "label": "Side Effects" + }, + { + "concept": "a89eba46-1350-11df-a1f1-0026b9348838", + "label": "Stigma" + }, + { + "concept": "c0c9eab3-46f6-453c-b29d-dc1c242317c5", + "label": "Stock out" + }, + { + "concept": "a89de2d8-1350-11df-a1f1-0026b9348838", + "label": "Too ill" + }, + { + "concept": "a897fdaa-1350-11df-a1f1-0026b9348838", + "label": "Travel Problems" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838' || !arrayContains(['a73d20b3-d721-4763-a362-14a0c41a6b5e','fdaf8b47-ea14-4d28-80fa-e1da58a30e8b'], artAdherence) " + } + }, + { + "label": "Adherence (ART): Other (specify):", + "type": "obs", + "questionOptions": { + "concept": "a8a06fc6-1350-11df-a1f1-0026b9348838", + "rendering": "text" + }, + "validators": [], + "hide": { + "hideWhenExpression": "onArt !== 'a899b35c-1350-11df-a1f1-0026b9348838' || !arrayContains(['a73d20b3-d721-4763-a362-14a0c41a6b5e','fdaf8b47-ea14-4d28-80fa-e1da58a30e8b'], artAdherence)" + } + } + ] + } + ] + }, + { + "label": "ART Plan", + "isExpanded": "true", + "questions": [ + { + "required": "true", + "id": "arvPlan", + "label": "ART plan:", + "questionOptions": { + "concept": "a89b75d4-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89b7908-1350-11df-a1f1-0026b9348838", + "label": "Continue regimen" + }, + { + "concept": "a898c938-1350-11df-a1f1-0026b9348838", + "label": "Change dose" + }, + { + "concept": "a89b7c50-1350-11df-a1f1-0026b9348838", + "label": "Change regimen" + }, + { + "concept": "a89b7ae8-1350-11df-a1f1-0026b9348838", + "label": "Change formulation" + }, + { + "concept": "a8a00158-1350-11df-a1f1-0026b9348838", + "label": "Drug substitution" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "Not on ARVS" + }, + { + "concept": "a8a00220-1350-11df-a1f1-0026b9348838", + "label": "Restart" + }, + { + "concept": "a89b77aa-1350-11df-a1f1-0026b9348838", + "label": "Start ARVs" + }, + { + "concept": "a89b7d36-1350-11df-a1f1-0026b9348838", + "label": "Stop all" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(onArt) && onArt === 'a899b35c-1350-11df-a1f1-0026b9348838' && !isEmpty(myValue) && arrayContains(['a89b77aa-1350-11df-a1f1-0026b9348838','a899e0ac-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838'], myValue)", + "message": "Patient marked as on ART in ART History section. Therefore plan can only be drug substitution, continue regimen, change dose, chage regimen, change" + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(onArt) && onArt === 'a899b42e-1350-11df-a1f1-0026b9348838' && !isEmpty(myValue) && !arrayContains(['a89b77aa-1350-11df-a1f1-0026b9348838','a899e0ac-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838'], myValue)", + "message": "Patient marked as not on ART in ART History section. Therefore plan can only be None,Start" + } + ] + }, + { + "label": "Reason to Start ART:", + "id": "arvStartReason", + "questionOptions": { + "concept": "a89b6ce2-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "c9778159-958b-4f59-9053-a6171074726f", + "label": "CD4 less than 500" + }, + { + "concept": "a8af49d8-1350-11df-a1f1-0026b9348838", + "label": "Discordant couple" + }, + { + "concept": "a89b27be-1350-11df-a1f1-0026b9348838", + "label": "WHO stage 3" + }, + { + "concept": "a89b289a-1350-11df-a1f1-0026b9348838", + "label": "WHO stage 4" + }, + { + "concept": "a89fbedc-1350-11df-a1f1-0026b9348838", + "label": "PMTCT" + }, + { + "concept": "a8909060-1350-11df-a1f1-0026b9348838", + "label": "Hepatitis" + }, + { + "concept": "7fa72118-ef2a-4694-993a-014440024bbc", + "label": "Test and treat" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvPlan) && isEmpty(myValue) && arrayContains(['a89b77aa-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "You indicated patient is (re)starting ART. Please provide reason." + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvPlan) && !isEmpty(myValue) && !arrayContains(['a89b77aa-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "You indicated patient is not (re)starting ART, therefore no reason for starting should be selected." + } + ], + "hide": { + "hideWhenExpression": "!arrayContains(['a89b77aa-1350-11df-a1f1-0026b9348838','a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)" + } + }, + { + "type": "obsGroup", + "label": "ART change reason", + "questionOptions": { + "concept": "a8a07688-1350-11df-a1f1-0026b9348838", + "rendering": "group" + }, + "questions": [ + { + "id": "arvChangeReason", + "label": "Reason for stopping/change/substitution/interruption:", + "questionOptions": { + "concept": "a89b7110-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89ce50e-1350-11df-a1f1-0026b9348838", + "label": "Adherence concerns" + }, + { + "concept": "a8981934-1350-11df-a1f1-0026b9348838", + "label": "Clinical treatment failure" + }, + { + "concept": "c0c9eab3-46f6-453c-b29d-dc1c242317c5", + "label": "Drug out of stock" + }, + { + "concept": "a890a96a-1350-11df-a1f1-0026b9348838", + "label": "Due to new TB" + }, + { + "concept": "057dae68-3d6f-4d79-926c-ed75a0ce7fd5", + "label": "Illness/hospitalization" + }, + { + "concept": "c6537e06-9fc2-47da-b679-e2a32824407f", + "label": "Immunologic failure" + }, + { + "concept": "a8a6f56c-1350-11df-a1f1-0026b9348838", + "label": "Lost to follow-up" + }, + { + "concept": "a8a07b10-1350-11df-a1f1-0026b9348838", + "label": "New drug available" + }, + { + "concept": "a8b03af0-1350-11df-a1f1-0026b9348838", + "label": "Patient lacks finances" + }, + { + "concept": "abe0cbb6-8d08-487a-b18e-7af873945fcc", + "label": "Planned Rx interruption" + }, + { + "concept": "a8909e8e-1350-11df-a1f1-0026b9348838", + "label": "Pregnancy" + }, + { + "concept": "e38b3e51-8a27-4bf6-b0c8-e0b285e4bb2f", + "label": "Risk of pregnancy" + }, + { + "concept": "a89d25fa-1350-11df-a1f1-0026b9348838", + "label": "Other patient décisions" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + }, + { + "concept": "a890d1ba-1350-11df-a1f1-0026b9348838", + "label": "Toxicity" + }, + { + "concept": "93fe19e8-fec4-4e4b-85f1-239e1fabd761", + "label": "Virologic failure" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvPlan) && isEmpty(myValue) && arrayContains(['a898c938-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838','a89b7ae8-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7d36-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "You indicated patient is changing/changing dose/substituting/stopping arvs, reason for changing should be selected." + } + ], + "hide": { + "hideWhenExpression": "!arrayContains(['a898c938-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838','a89b7ae8-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7d36-1350-11df-a1f1-0026b9348838'], arvPlan)" + } + }, + { + "id": "arvToxicityCause", + "label": "If toxicity, please provide cause:", + "questionOptions": { + "concept": "a8a032fe-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a877c7f6-1350-11df-a1f1-0026b9348838", + "label": "Anaemia" + }, + { + "concept": "a8909060-1350-11df-a1f1-0026b9348838", + "label": "Hepatitis" + }, + { + "concept": "a89d0c0a-1350-11df-a1f1-0026b9348838", + "label": "IRIS" + }, + { + "concept": "a8a01dfa-1350-11df-a1f1-0026b9348838", + "label": "Lactic Acidosis" + }, + { + "concept": "a89cee50-1350-11df-a1f1-0026b9348838", + "label": "Lipo-dystrophy" + }, + { + "concept": "a897fe86-1350-11df-a1f1-0026b9348838", + "label": "Neuropathy" + }, + { + "concept": "a8ad239c-1350-11df-a1f1-0026b9348838", + "label": "Persistent Vomiting" + }, + { + "concept": "a895776a-1350-11df-a1f1-0026b9348838", + "label": "Rash" + }, + { + "concept": "a8a16d0e-1350-11df-a1f1-0026b9348838", + "label": "Steven-Johnson syndrome" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvChangeReason)&&isEmpty(myValue) && (arvChangeReason==='a890d1ba-1350-11df-a1f1-0026b9348838')", + "message": "You indicated patient is changing /changing dose/substituting/stopping arvs due to toxicity, cause should be selected." + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvChangeReason) && !isEmpty(myValue) && (arvChangeReason!=='a890d1ba-1350-11df-a1f1-0026b9348838')", + "message": "You indicated patient is not changing/dose/substituting/stopping arvs due to toxicity, cause should be selected." + } + ], + "hide": { + "hideWhenExpression": "arvChangeReason!=='a890d1ba-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "If toxicity: Other (specify):", + "id": "q24cToxOther", + "type": "obs", + "questionOptions": { + "concept": "a8a06fc6-1350-11df-a1f1-0026b9348838", + "rendering": "text" + }, + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvToxicityCause) && isEmpty(myValue) && (arvToxicityCause==='a8aaf3e2-1350-11df-a1f1-0026b9348838')", + "message": "You indicated patient is changing /changing dose/substituting/stopping arvs due to other toxicity, indicate the other cause." + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvToxicityCause) && !isEmpty(myValue) && (arvToxicityCause!=='a8aaf3e2-1350-11df-a1f1-0026b9348838')", + "message": "You indicated patient is not changing /changing dose/substituting/stopping arvs due to other toxicity, other cause is not required." + } + ], + "hide": { + "hideWhenExpression": "arvToxicityCause!=='a8aaf3e2-1350-11df-a1f1-0026b9348838'" + } + } + ] + }, + { + "type": "obsGroup", + "label": "Eligible for ART", + "questionOptions": { + "concept": "a8a17a7e-1350-11df-a1f1-0026b9348838", + "rendering": "group" + }, + "questions": [ + { + "label": "Eligible for ART but not started:", + "id": "artEligibleNotStarted", + "questionOptions": { + "concept": "a89d26cc-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89ce50e-1350-11df-a1f1-0026b9348838", + "label": "Adherence Concerns" + }, + { + "concept": "a8a8b26c-1350-11df-a1f1-0026b9348838", + "label": "On TB Treatment" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + }, + { + "concept": "a89d25fa-1350-11df-a1f1-0026b9348838", + "label": "Patient Refused" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [], + "hide": { + "hideWhenExpression": "arvPlan !== 'a899e0ac-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Eligible for ART but not started: Other (specify):", + "questionOptions": { + "concept": "a8a06fc6-1350-11df-a1f1-0026b9348838", + "rendering": "text" + }, + "type": "obs", + "id": "q24dOther", + "validators": [], + "hide": { + "hideWhenExpression": "artEligibleNotStarted !== 'a8aaf3e2-1350-11df-a1f1-0026b9348838'" + } + } + ] + }, + { + "label": "Plan treatment categories:", + "type": "obs", + "id": "planCate", + "questionOptions": { + "concept": "74e3b23f-b94f-49d9-a237-6baaee73f163", + "answers": [ + { + "concept": "034047bd-3fa1-4b2a-b0f0-2787e9b9f7b3", + "label": "First Line Regimen" + }, + { + "concept": "8f8a715d-e49a-4b2c-aa3a-83fa9d7a4254", + "label": "Second Line Regimen" + }, + { + "concept": "a90ebdd2-351f-485a-b850-4938fcca2729", + "label": "Third Line Regimen" + } + ], + "rendering": "select" + }, + "hide": { + "hideWhenExpression": "!arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'],arvPlan)" + } + }, + { + "label": "ART regimen started, peds:", + "id": "artStartedPed", + "questionOptions": { + "concept": "a89b6a62-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "b58a28d2-36de-11e0-93be-0026b9348838", + "label": "ABC 60mg/3TC 30mg" + }, + { + "concept": "25c753d8-870f-11e0-85d3-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg" + }, + { + "concept": "20185c04-9334-11df-8193-000d6014b64c", + "label": "ZDV 60mg/3TC 30mg/NVP 50mg" + }, + { + "concept": "8ddf2f66-9333-11df-8193-000d6014b64c", + "label": "ZDV 300mg/3TC 150mg/NVP 200mg >25kgs" + }, + { + "concept": "fd4cd670-3115-11e0-8090-0026b9348838", + "label": "3TC 150mg/ZDV 300mg >25kgs" + }, + { + "concept": "b9da84e8-3127-11e0-8090-0026b9348838", + "label": "3TC 300mg/TDF 300mg >25kgs" + }, + { + "concept": "e0037172-87ce-11e0-85d3-000d6014b64c", + "label": "TDF 300mg/3TC 300mg/EFV 600mg >35kgs" + }, + { + "concept": "f8b6299e-6bbf-446a-b3f1-a88f5d6b9da2", + "label": "Lopinavir 80mg/Ritonavir 20mg" + }, + { + "concept": "fa8266f6-36df-11e0-93be-0026b9348838", + "label": "Lopinavir 200mg/Ritonavir 50mg >25kgs" + }, + { + "concept": "3cbfb0b9-721e-4d42-92a3-7d37269aab24", + "label": " Atazanavir 300mg/ritonavir 100mg" + }, + { + "concept": "2fc1f68c-9939-44d4-b5f4-e064ed4073ca", + "label": "Nevirapine 100mg" + }, + { + "concept": "0485075a-3111-11e0-8090-0026b9348838", + "label": "Nevirapine 200mg" + }, + { + "concept": "db3c194b-3e1b-4001-9a1c-a5df1728fc28", + "label": "Efavirenz 200mg" + }, + { + "concept": "ff9096b6-d86c-403a-9bda-eab02252dbf3", + "label": "Efavirenz 250mg" + }, + { + "concept": "55e0461f-b28f-42de-a3c6-328d7f17c44b", + "label": "Efavirenz 350mg" + }, + { + "concept": "81a41a82-fd72-4da4-8d47-edd5672549ce", + "label": "Efavirenz 400mg" + }, + { + "concept": "4677ad3e-3120-11e0-8090-0026b9348838", + "label": "Efavirenz 600mg" + }, + { + "concept": "d6262526-3113-11e0-8090-0026b9348838", + "label": "Lamivudine 150mg" + }, + { + "concept": "52441ef8-3126-11e0-8090-0026b9348838", + "label": " Abacavir 300mg" + }, + { + "concept": "21d417bc-3114-11e0-8090-0026b9348838", + "label": " Zidovudine 300mg " + }, + { + "concept": "1baf254e-1429-4fd9-8db1-edf6523cea13", + "label": " Ritonavir 100mg" + }, + { + "concept": "42ef7c4d-d6fb-49c0-a46e-019c42dea203", + "label": " Ritonavir 80mg" + }, + { + "concept": "da698164-870d-11e0-85d3-000d6014b64c", + "label": " Raltegravir 400mg" + }, + { + "concept": "a8afbf9e-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir " + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvPlan) && isEmpty(myValue) && arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "Based on the plan selected, you must choose a regimen." + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(myValue) && !arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "Based on the plan selected, you may not choose a regimen." + } + ], + "hide": { + "hideWhenExpression": "!arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'],arvPlan)" + } + }, + { + "label": "ART regimen started, adult:", + "id": "artStartedAdult", + "questionOptions": { + "concept": "a89b6a62-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "6a73f32d-1870-4527-af6e-74443251ded2", + "label": "NVP200/ZDV300/3TC150" + }, + { + "concept": "1c4a75d0-cc91-4752-b0a5-4b833326ff7a", + "label": "TDF300mg/3TC300mg/EFV600mg" + }, + { + "concept": "a89cc876-1350-11df-a1f1-0026b9348838", + "label": "3TC300mg/TDF300mg" + }, + { + "concept": "3d587177-984e-4eeb-93f2-3223b6c1dd7c", + "label": "3TC150mg/D4T30mg" + }, + { + "concept": "a896758e-1350-11df-a1f1-0026b9348838", + "label": "3TC150mg/ZDV300mg" + }, + { + "concept": "a897e608-1350-11df-a1f1-0026b9348838", + "label": "NVP200/D4T30/3TC150" + }, + { + "concept": "a8afcf84-1350-11df-a1f1-0026b9348838", + "label": "Emtri200mg/TDF300(Truvada)" + }, + { + "concept": "a897e7c0-1350-11df-a1f1-0026b9348838", + "label": "Aluvia(Kaletra)200mg/LPV50mg" + }, + { + "concept": "a8afc066-1350-11df-a1f1-0026b9348838", + "label": "Atazanavir300/Ritonavir100" + }, + { + "concept": "dabf36cb-dd9a-4542-a8ef-874c1ee5be4a", + "label": "FTC200mg/RPV25mg/TDF245mg(Eviplera)" + }, + { + "concept": "a897f8a0-1350-11df-a1f1-0026b9348838", + "label": "Abacavir300mg" + }, + { + "concept": "a89677e6-1350-11df-a1f1-0026b9348838", + "label": "Efavirenz600mg" + }, + { + "concept": "a89673f4-1350-11df-a1f1-0026b9348838", + "label": "Lamivudine150mg" + }, + { + "concept": "a8967656-1350-11df-a1f1-0026b9348838", + "label": "Nevirapine200mg" + }, + { + "concept": "a8afbd64-1350-11df-a1f1-0026b9348838", + "label": "Raltegravir 400mg" + }, + { + "concept": "a897ea4a-1350-11df-a1f1-0026b9348838", + "label": "Zidovudine300mg" + }, + { + "concept": "68a0a5dd-1e91-43a2-8dce-c6e84a14de04", + "label": "Darunavir 600mg" + }, + { + "concept": "38fbba9c-4b26-412d-9659-8dd649514d66", + "label": "Etravirine 100mg" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "None" + }, + { + "concept": "a8a87a86-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [ + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(arvPlan) && isEmpty(myValue) && arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "Based on the plan selected, you must choose a regimen." + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(myValue) && !arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'], arvPlan)", + "message": "Based on the plan selected, you may not choose a regimen." + } + ], + "hide": { + "hideWhenExpression": "!arrayContains(['a89b7ae8-1350-11df-a1f1-0026b9348838', 'a898c938-1350-11df-a1f1-0026b9348838','a89b77aa-1350-11df-a1f1-0026b9348838','a8a00158-1350-11df-a1f1-0026b9348838','a89b7c50-1350-11df-a1f1-0026b9348838', 'a8a00220-1350-11df-a1f1-0026b9348838'],arvPlan)" + } + } + ] + }, + { + "label": "ART Prophylactic History", + "questions": [ + { + "type": "obsGroup", + "label": "Newborn Prophylactic Antiretroviral History", + "questionOptions": { + "concept": "a89c9414-1350-11df-a1f1-0026b9348838", + "rendering": "group" + }, + "questions": [ + { + "label": "Newborn prophylactic ARV use:", + "id": "NewbornProhpArv", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a89c8b7c-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a899b35c-1350-11df-a1f1-0026b9348838", + "label": "Yes" + }, + { + "concept": "a899b42e-1350-11df-a1f1-0026b9348838", + "label": "No" + }, + { + "concept": "a899b50a-1350-11df-a1f1-0026b9348838", + "label": "Unknown" + } + ] + }, + "validators": [] + }, + { + "label": "Newborn ARV use:", + "id": "NewbornArvUse", + "questionOptions": { + "concept": "a89addfe-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89673f4-1350-11df-a1f1-0026b9348838", + "label": "Lamivudine" + }, + { + "concept": "a8967656-1350-11df-a1f1-0026b9348838", + "label": "Nevirapine" + }, + { + "concept": "a897ea4a-1350-11df-a1f1-0026b9348838", + "label": "Zidovudine" + }, + { + "concept": "a897e7c0-1350-11df-a1f1-0026b9348838", + "label": "Lopinavir and ritonavir" + }, + { + "concept": "a8967980-1350-11df-a1f1-0026b9348838", + "label": "Nelfinavir" + }, + { + "concept": "a8967156-1350-11df-a1f1-0026b9348838", + "label": "d4T-40(Stavudine)" + }, + { + "concept": "a8967156-1350-11df-a1f1-0026b9348838", + "label": "d4T-30(Stavudine)" + }, + { + "concept": "a8967156-1350-11df-a1f1-0026b9348838", + "label": "Stavudine" + }, + { + "concept": "a8a87a86-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "multiCheckbox" + }, + "type": "obs", + "validators": [], + "hide": { + "hideWhenExpression": "NewbornProhpArv !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "ARV dose quantification:", + "id": "ArvDose", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a89ad8cc-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89ad9a8-1350-11df-a1f1-0026b9348838", + "label": "One dose" + }, + { + "concept": "a89ada8e-1350-11df-a1f1-0026b9348838", + "label": "Two doses" + }, + { + "concept": "a89adb6a-1350-11df-a1f1-0026b9348838", + "label": "More than two doses" + } + ] + }, + "validators": [], + "hide": { + "hideWhenExpression": "NewbornProhpArv !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Number of days on treatment:", + "id": "ArvDays", + "type": "obs", + "questionOptions": { + "rendering": "numeric", + "concept": "a8a05e82-1350-11df-a1f1-0026b9348838", + "answers": [] + }, + "validators": [], + "hide": { + "hideWhenExpression": "NewbornProhpArv !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Number of weeks on treatment:", + "id": "ArvDays", + "type": "obs", + "questionOptions": { + "rendering": "numeric", + "concept": "a89add22-1350-11df-a1f1-0026b9348838", + "answers": [] + }, + "validators": [], + "hide": { + "hideWhenExpression": "NewbornProhpArv !== 'a899b35c-1350-11df-a1f1-0026b9348838'" + } + } + ] + }, + { + "type": "obsGroup", + "label": "Maternal Partum Antiretroviral History", + "questionOptions": { + "concept": "a89c8802-1350-11df-a1f1-0026b9348838", + "rendering": "group" + }, + "questions": [ + { + "label": "Antiretroviral Use During Pregnancy", + "id": "MothersArvUse", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a89a9e48-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89aadc0-1350-11df-a1f1-0026b9348838", + "label": "On ARVs" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "None" + }, + { + "concept": "a899b50a-1350-11df-a1f1-0026b9348838", + "label": "Unknown" + } + ] + } + }, + { + "label": "Partum dosing period:", + "id": "PartumDosingPeriod", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a89ad55c-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89ad638-1350-11df-a1f1-0026b9348838", + "label": "Antepartum" + }, + { + "concept": "a89ad714-1350-11df-a1f1-0026b9348838", + "label": "Intrapartum" + }, + { + "concept": "a89ad7f0-1350-11df-a1f1-0026b9348838", + "label": "Postpartum" + } + ] + }, + "validators": [], + "hide": { + "hideWhenExpression": "MothersArvUse !== 'a89aadc0-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Partum ARV use:", + "id": "PartumArvUse", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a89ad480-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a8967656-1350-11df-a1f1-0026b9348838", + "label": "Nevirapine" + }, + { + "concept": "a89673f4-1350-11df-a1f1-0026b9348838", + "label": "Lamivudine" + }, + { + "concept": "a897ea4a-1350-11df-a1f1-0026b9348838", + "label": "Zidovudine" + } + ] + }, + "validators": [], + "hide": { + "hideWhenExpression": "MothersArvUse !== 'a89aadc0-1350-11df-a1f1-0026b9348838'" + } + }, + { + "label": "Number of weeks on treatment:", + "id": "ArvDays", + "type": "obs", + "questionOptions": { + "rendering": "numeric", + "concept": "a89add22-1350-11df-a1f1-0026b9348838", + "answers": [] + }, + "validators": [], + "hide": { + "hideWhenExpression": "MothersArvUse !== 'a89aadc0-1350-11df-a1f1-0026b9348838'" + } + } + ] + } + ] + } + ] + } + ] +} diff --git a/__mocks__/forms/ohri-forms/component_preclinic-review.json b/__mocks__/forms/ohri-forms/component_preclinic-review.json new file mode 100644 index 000000000..9e96d1c27 --- /dev/null +++ b/__mocks__/forms/ohri-forms/component_preclinic-review.json @@ -0,0 +1,480 @@ +{ + "name": "component_preclinic-review", + "uuid": "2f063f32-7f8a-11ee-b962-0242ac120004", + "processor": "EncounterFormProcessor", + "pages": [ + { + "label": "Pre-clinic Review", + "sections": [ + { + "label": "Pre-clinic Review", + "isExpanded": "true", + "questions": [ + { + "type": "obsGroup", + "label": "Transfer in from other centre, detailed", + "questionOptions": { + "concept": "0f8b7f4e-1656-46b7-bc93-d1fe4f193f5d", + "rendering": "group" + }, + "questions": [ + { + "label": "Transfer in from other centre:", + "id": "transferIn", + "questionOptions": { + "rendering": "select", + "concept": "35ed8aad-d6fa-429e-961a-c877e1ad4953", + "answers": [ + { + "concept": "a89c2f42-1350-11df-a1f1-0026b9348838", + "label": "Ampath" + }, + { + "concept": "a89c301e-1350-11df-a1f1-0026b9348838", + "label": "Non-Ampath" + } + ] + }, + "type": "obs", + "validators": [] + }, + { + "type": "personAttribute", + "label": "If transfer in from other AMPATH clinic (specify):", + "id": "transfered_in_to_ampath", + "required": "false", + "default": "", + "questionOptions": { + "rendering": "ui-select-extended", + "attributeType": "7ef225db-94db-4e40-9dd8-fb121d9dc370" + }, + "hide": { + "hideWhenExpression": "transferIn !== 'a89c2f42-1350-11df-a1f1-0026b9348838'" + } + }, + { + "type": "obs", + "label": "If non-Ampath, specify:", + "id": "nonAmpathSpecify", + "questionOptions": { + "concept": "a8a06fc6-1350-11df-a1f1-0026b9348838", + "rendering": "text" + }, + "validators": [], + "hide": { + "hideWhenExpression": "transferIn !== 'a89c301e-1350-11df-a1f1-0026b9348838'" + } + } + ] + }, + { + "label": "Was this visit scheduled?", + "id": "scheduledVisit", + "questionOptions": { + "rendering": "select", + "concept": "a89ff9a6-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89b6440-1350-11df-a1f1-0026b9348838", + "label": "Scheduled visit" + }, + { + "concept": "a89ff816-1350-11df-a1f1-0026b9348838", + "label": "Unscheduled Visit Early" + }, + { + "concept": "a89ff8de-1350-11df-a1f1-0026b9348838", + "label": "Unscheduled Visit Late" + } + ] + }, + "type": "obs", + "validators": [] + }, + { + "label": "If Unscheduled, actual scheduled date", + "id": "actualDate", + "type": "obs", + "required": { + "type": "conditionalRequired", + "message": "Patient visit marked as unscheduled. Please provide the scheduled date.", + "referenceQuestionId": "scheduledVisit", + "referenceQuestionAnswers": [ + "a89ff816-1350-11df-a1f1-0026b9348838", + "a89ff8de-1350-11df-a1f1-0026b9348838" + ] + }, + "questionOptions": { + "rendering": "date", + "concept": "dc1942b2-5e50-4adc-949d-ad6c905f054e" + }, + "validators": [ + { + "type": "date", + "allowFutureDates": "true" + }, + { + "type": "js_expression", + "failsWhenExpression": "!isEmpty(scheduledVisit) && arrayContains(['a89ff816-1350-11df-a1f1-0026b9348838','a89ff8de-1350-11df-a1f1-0026b9348838'], scheduledVisit) && isEmpty(myValue)", + "message": "Patient visit marked as unscheduled. Please provide the scheduled date." + } + ], + "hide": { + "hideWhenExpression": "!arrayContains(['a89ff816-1350-11df-a1f1-0026b9348838','a89ff8de-1350-11df-a1f1-0026b9348838'], scheduledVisit)" + } + }, + { + "label": "Patient covered by NHIF:", + "questionOptions": { + "rendering": "select", + "concept": "a8b02524-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "8b715fed-97f6-4e38-8f6a-c167a42f8923", + "label": "Yes" + }, + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "No" + } + ] + }, + "type": "obs", + "validators": [] + } + ] + }, + { + "label": "Social History", + "questions": [ + { + "label": "Civil status:", + "id": "civil_status_question", + "type": "obs", + "questionOptions": { + "rendering": "select", + "concept": "a899a9f2-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a899af10-1350-11df-a1f1-0026b9348838", + "label": "Cohabitating" + }, + { + "concept": "a899ad58-1350-11df-a1f1-0026b9348838", + "label": "Divorced" + }, + { + "concept": "a8aa76b0-1350-11df-a1f1-0026b9348838", + "label": "Married monogamous" + }, + { + "concept": "a8b03712-1350-11df-a1f1-0026b9348838", + "label": "Married polygamous" + }, + { + "concept": "a899aba0-1350-11df-a1f1-0026b9348838", + "label": "Separated" + }, + { + "concept": "a899ac7c-1350-11df-a1f1-0026b9348838", + "label": "Single" + }, + { + "concept": "a899ae34-1350-11df-a1f1-0026b9348838", + "label": "Widowed" + } + ] + }, + "validators": [] + }, + { + "label": "Discordant couple:", + "questionOptions": { + "answers": [ + { + "concept": "a899b35c-1350-11df-a1f1-0026b9348838", + "label": "Yes" + }, + { + "concept": "a899b42e-1350-11df-a1f1-0026b9348838", + "label": "No" + }, + { + "concept": "a899b50a-1350-11df-a1f1-0026b9348838", + "label": "Unknown" + }, + { + "concept": "a89ad3a4-1350-11df-a1f1-0026b9348838", + "label": "N/A" + } + ], + "concept": "a8af49d8-1350-11df-a1f1-0026b9348838", + "rendering": "select" + }, + "type": "obs", + "validators": [] + } + ] + }, + { + "label": "Prevention With Positives", + "questions": [ + { + "label": "Prevention with positives: At risk population:", + "required": "true", + "questionOptions": { + "rendering": "select", + "concept": "93aa3f1d-1c39-4196-b5e6-8adc916cd5d6", + "answers": [ + { + "concept": "5da55301-e28e-4fdf-8b64-02622dedc8b0", + "label": "Client of sex worker" + }, + { + "concept": "a89ff438-1350-11df-a1f1-0026b9348838", + "label": "Commercial sex worker" + }, + { + "concept": "a8af49d8-1350-11df-a1f1-0026b9348838", + "label": "Discordant couple" + }, + { + "concept": "a890d57a-1350-11df-a1f1-0026b9348838", + "label": "IV drug use" + }, + { + "concept": "e19c35f0-12f0-46c2-94ea-97050f37b811", + "label": "MSM" + }, + { + "concept": "a89ad3a4-1350-11df-a1f1-0026b9348838", + "label": "N/A" + } + ] + }, + "type": "obs", + "validators": [] + }, + { + "label": "Prevention with positives: PWP services:", + "required": "true", + "questionOptions": { + "rendering": "select", + "concept": "9ce5dbf0-a141-4ad8-8c9d-cd2bf84fe72b", + "answers": [ + { + "concept": "f0a280e8-eb88-41a8-837a-f9949ed1b9cd", + "label": "Condom promotion/provision" + }, + { + "concept": "bf51f71e-937c-4da5-ae07-654acf59f5bb", + "label": "Couple counseling" + }, + { + "concept": "91f43249-73c7-427c-8300-2038fc0d6be8", + "label": "Needle exchange" + }, + { + "concept": "05656545-86be-4605-9527-34fb580534b1", + "label": "Targeted risk reduction" + }, + { + "concept": "a89ad3a4-1350-11df-a1f1-0026b9348838", + "label": "N/A" + } + ] + }, + "type": "obs", + "validators": [] + } + ] + }, + { + "label": "Enrollment History", + "questions": [ + { + "label": "Ampath Catchment Area:", + "questionOptions": { + "concept": "65c5071a-0cf8-49d4-99d1-5f7da6ef6503", + "answers": [ + { + "concept": "a899b50a-1350-11df-a1f1-0026b9348838", + "label": "Unknown" + }, + { + "concept": "5066b630-842b-4105-a66d-74f8aa50aacb", + "label": "In Ampath catchment area" + }, + { + "concept": "83df5f26-f97a-4cda-9c05-d0bdc6e4ebee", + "label": "Out of Ampath catchment area" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [] + }, + { + "label": "Source of prior HIV care and treatment:", + "questionOptions": { + "concept": "42ad95d4-ad13-49cb-a870-d3208e339e36", + "answers": [ + { + "concept": "a899e0ac-1350-11df-a1f1-0026b9348838", + "label": "None" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [] + }, + { + "label": "Point of HIV Testing:", + "questionOptions": { + "concept": "a8a17e48-1350-11df-a1f1-0026b9348838", + "answers": [ + { + "concept": "a89fbedc-1350-11df-a1f1-0026b9348838", + "label": "pMTCT" + }, + { + "concept": "a8a17b3c-1350-11df-a1f1-0026b9348838", + "label": "VCT" + }, + { + "concept": "f6dd6114-a212-4187-b76c-5b6fd8a9e7ba", + "label": "PHCT" + }, + { + "concept": "a8a359a2-1350-11df-a1f1-0026b9348838", + "label": "DTC/PITC" + }, + { + "concept": "a890a96a-1350-11df-a1f1-0026b9348838", + "label": "TB Clinic" + }, + { + "concept": "ff3243bf-05f6-426d-aa49-969034962e45", + "label": "Adult Inpatient" + }, + { + "concept": "3e5ad07b-2ced-4925-8264-cc4d8d1438d4", + "label": "Pediatric Inpatient" + }, + { + "concept": "a8a17d80-1350-11df-a1f1-0026b9348838", + "label": "MCH" + }, + { + "concept": "a8a09ac8-1350-11df-a1f1-0026b9348838", + "label": "OPD" + }, + { + "concept": "a8934292-1350-11df-a1f1-0026b9348838", + "label": "STI" + }, + { + "concept": "3ddd3de4-dbf1-4ae9-8caf-aca6383bfd5e", + "label": "OSCAR" + }, + { + "concept": "7d2c77f9-091b-41d7-8608-aff8985fd708", + "label": "Tumaini" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [] + }, + { + "label": "Date Confirmed HIV Positive:", + "id": "dateConfHiv+", + "questionOptions": { + "concept": "6d557eec-82f7-4840-a865-a02ac69d93a5", + "rendering": "date" + }, + "type": "obs", + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + } + ] + }, + { + "label": "Date enrolled in HIV Care:", + "questionOptions": { + "concept": "edda0fe9-73ba-4dbe-8739-dd8d0a8f1700", + "rendering": "date" + }, + "type": "obs", + "validators": [ + { + "type": "date", + "allowFutureDates": "false" + } + ] + }, + { + "label": "Where was the test done?", + "id": "testDone", + "questionOptions": { + "concept": "12fa8c7d-0e51-42d0-a381-4db7d34b1fcb", + "rendering": "text" + }, + "type": "obs", + "validators": [] + }, + { + "label": "WHO stage at Enrollment", + "id": "whoStageEnrol", + "type": "obs", + "questionOptions": { + "concept": "1ea9d6ba-2084-4bc0-97a6-46fe677d40e5", + "answers": [ + { + "label": "1", + "concept": "a89b33d0-1350-11df-a1f1-0026b9348838" + }, + { + "label": "2", + "concept": "a89b34ac-1350-11df-a1f1-0026b9348838" + }, + { + "label": "3", + "concept": "a89b3588-1350-11df-a1f1-0026b9348838" + }, + { + "label": "4", + "concept": "a89b3664-1350-11df-a1f1-0026b9348838" + } + ], + "rendering": "select" + } + }, + { + "label": "Transfer in District:", + "questionOptions": { + "concept": "10bca44a-930f-46ae-b686-63ddb36a713f", + "rendering": "text" + }, + "type": "obs", + "validators": [] + } + ] + } + ] + } + ] +} diff --git a/__mocks__/forms/ohri-forms/form-component.json b/__mocks__/forms/ohri-forms/form-component.json new file mode 100644 index 000000000..4c9ad1527 --- /dev/null +++ b/__mocks__/forms/ohri-forms/form-component.json @@ -0,0 +1,43 @@ +{ + "name": "Form Component", + "referencedForms": [ + { + "formName": "component_preclinic-review", + "alias": "pcr" + }, + { + "formName": "component_art", + "alias": "art" + } + ], + "pages": [ + { + "label": "Pre-Clinic Review", + "sections": [ + { + "reference": { + "form": "pcr", + "page": "Pre-clinic Review", + "section": "Pre-clinic Review" + } + } + ] + }, + { + "label": "ART History", + "sections": [ + { + "reference": { + "form": "art", + "page": "ART ", + "section": "ART History", + "excludeQuestions": ["current_art_regimen_ped"] + } + } + ] + } + ], + "processor": "EncounterFormProcessor", + "uuid": "af7c1fe6-d669-414e-b066-e9733f0de7b8", + "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe" +} diff --git a/__mocks__/forms/ohri-forms/nested-form1.json b/__mocks__/forms/ohri-forms/nested-form1.json index f5a7078dd..760fabb97 100644 --- a/__mocks__/forms/ohri-forms/nested-form1.json +++ b/__mocks__/forms/ohri-forms/nested-form1.json @@ -30,14 +30,14 @@ } ] }, - { - "isSubform": "true", - "subform": { - "name": "Nested Form Two" - } - } + { + "isSubform": "true", + "subform": { + "name": "Nested Form Two" + } + } ], - "processor": "EncounterFormProcessor", - "uuid": "af7c1fe6-d669-414e-b066-e9733f0de7a8", - "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe" + "processor": "EncounterFormProcessor", + "uuid": "af7c1fe6-d669-414e-b066-e9733f0de7a8", + "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe" } diff --git a/__mocks__/forms/ohri-forms/nested-form2.json b/__mocks__/forms/ohri-forms/nested-form2.json index 638164806..438b8bba8 100644 --- a/__mocks__/forms/ohri-forms/nested-form2.json +++ b/__mocks__/forms/ohri-forms/nested-form2.json @@ -30,14 +30,14 @@ } ] }, - { - "isSubform": "true", - "subform": { - "name": "Mini Form" - } - } + { + "isSubform": "true", + "subform": { + "name": "Mini Form" + } + } ], - "processor": "EncounterFormProcessor", - "uuid": "8304e5ff-6324-4863-ac51-8fcbc6812b13", - "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe" + "processor": "EncounterFormProcessor", + "uuid": "8304e5ff-6324-4863-ac51-8fcbc6812b13", + "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe" } diff --git a/__mocks__/forms/omrs-forms/component_art.json b/__mocks__/forms/omrs-forms/component_art.json new file mode 100644 index 000000000..9cf5347f8 --- /dev/null +++ b/__mocks__/forms/omrs-forms/component_art.json @@ -0,0 +1,38 @@ +{ + "uuid": "2f063f32-7f8a-11ee-b962-0242ac120002", + "display": "component_art", + "name": "component_art", + "description": null, + "encounterType": "", + "version": "1.0", + "build": null, + "published": false, + "formFields": [], + "retired": false, + "auditInfo": { + "creator": { + "uuid": "82f18b44-6814-11e8-923f-e9a88dcb533f", + "display": "admin", + "links": [ + { + "rel": "self", + "uri": "http://ohri-demo.globalhealthapp.net/openmrs/ws/rest/v1/user/82f18b44-6814-11e8-923f-e9a88dcb533f", + "resourceAlias": "user" + } + ] + }, + "dateCreated": "2023-04-10T07:15:01.000+0000", + "changedBy": null, + "dateChanged": null + }, + "resources": [ + { + "uuid": "c6c14f84-2aee-45f9-928e-57ac4a2ac556", + "name": "JSON schema", + "valueReference": "74d06044-850f-11ee-b9d1-0242ac120003", + "display": "JSON schema", + "resourceVersion": "1.9" + } + ], + "resourceVersion": "1.9" +} diff --git a/__mocks__/forms/omrs-forms/component_preclinic-review.json b/__mocks__/forms/omrs-forms/component_preclinic-review.json new file mode 100644 index 000000000..4baf29ce4 --- /dev/null +++ b/__mocks__/forms/omrs-forms/component_preclinic-review.json @@ -0,0 +1,38 @@ +{ + "uuid": "2f063f32-7f8a-11ee-b962-0242ac120004", + "display": "component_preclinic-review", + "name": "component_preclinic-review", + "description": null, + "encounterType": "", + "version": "1.0", + "build": null, + "published": false, + "formFields": [], + "retired": false, + "auditInfo": { + "creator": { + "uuid": "82f18b44-6814-11e8-923f-e9a88dcb533f", + "display": "admin", + "links": [ + { + "rel": "self", + "uri": "http://ohri-demo.globalhealthapp.net/openmrs/ws/rest/v1/user/82f18b44-6814-11e8-923f-e9a88dcb533f", + "resourceAlias": "user" + } + ] + }, + "dateCreated": "2023-04-10T07:15:01.000+0000", + "changedBy": null, + "dateChanged": null + }, + "resources": [ + { + "uuid": "c6c14f84-2aee-45f9-928e-57ac4a2ac555", + "name": "JSON schema", + "valueReference": "74d06044-850f-11ee-b9d1-0242ac120004", + "display": "JSON schema", + "resourceVersion": "1.9" + } + ], + "resourceVersion": "1.9" +} diff --git a/__mocks__/forms/omrs-forms/form-component.json b/__mocks__/forms/omrs-forms/form-component.json new file mode 100644 index 000000000..0797be7e3 --- /dev/null +++ b/__mocks__/forms/omrs-forms/form-component.json @@ -0,0 +1,38 @@ +{ + "uuid": "af7c1fe6-d669-414e-b066-e9733f0de7b8", + "display": "Form Component", + "name": "Form Component", + "description": null, + "encounterType": "79c1f50f-f77d-42e2-ad2a-d29304dde2fe", + "version": "1.0", + "build": null, + "published": false, + "formFields": [], + "retired": false, + "auditInfo": { + "creator": { + "uuid": "82f18b44-6814-11e8-923f-e9a88dcb533f", + "display": "admin", + "links": [ + { + "rel": "self", + "uri": "http://ohri-demo.globalhealthapp.net/openmrs/ws/rest/v1/user/82f18b44-6814-11e8-923f-e9a88dcb533f", + "resourceAlias": "user" + } + ] + }, + "dateCreated": "2023-04-10T07:15:01.000+0000", + "changedBy": null, + "dateChanged": null + }, + "resources": [ + { + "uuid": "c6c14f84-2aee-45f9-928e-57ac4a2ac557", + "name": "JSON schema", + "valueReference": "74d06044-850f-11ee-b9d1-0242ac120002", + "display": "JSON schema", + "resourceVersion": "1.9" + } + ], + "resourceVersion": "1.9" +} diff --git a/package.json b/package.json index 33e2410cc..e47e0c9f2 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "typescript": "tsc", "test": "jest --config ./jest.config.js --passWithNoTests", "build": "webpack --mode production", + "coverage": "yarn test --coverage", "analyze": "webpack --mode=production --env.analyze=true" }, "browserslist": [ @@ -49,8 +50,8 @@ }, "peerDependencies": { "@carbon/react": "1.x", - "@openmrs/esm-framework": "4.x", - "react": "^18.2.0", + "@openmrs/esm-framework": "5.x", + "react": "18.x", "react-i18next": "11.x", "rxjs": "6.x" }, diff --git a/src/api/types.ts b/src/api/types.ts index e463f5879..f45dc23b6 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -139,6 +139,7 @@ export interface OHRIFormSection { questions: Array; inlineRendering?: 'single-line' | 'multiline' | 'automatic'; readonly?: string | boolean; + reference?: FormReference; } export interface OHRIFormQuestionOptions { @@ -297,3 +298,15 @@ export interface Attachment { bytesMimeType: string; bytesContentFamily: string; } + +export interface FormReference { + form: string; + page: string; + section: string; + excludeQuestions?: Array; +} + +export interface ReferencedForm { + formName: string; + alias: string; +} diff --git a/src/hooks/useFormJson.test.tsx b/src/hooks/useFormJson.test.tsx index 7eb675f2e..ab85fe1e5 100644 --- a/src/hooks/useFormJson.test.tsx +++ b/src/hooks/useFormJson.test.tsx @@ -8,6 +8,12 @@ import nestedForm1Skeleton from '../../__mocks__/forms/omrs-forms/nested-form1.j import nestedForm2Skeleton from '../../__mocks__/forms/omrs-forms/nested-form2.json'; import nestedForm1Body from '../../__mocks__/forms/ohri-forms/nested-form1.json'; import nestedForm2Body from '../../__mocks__/forms/ohri-forms/nested-form2.json'; +import formComponentSkeleton from '../../__mocks__/forms/omrs-forms/form-component.json'; +import formComponentBody from '../../__mocks__/forms/ohri-forms/form-component.json'; +import artComponentSkeleton from '../../__mocks__/forms/omrs-forms/component_art.json'; +import artComponentBody from '../../__mocks__/forms/ohri-forms/component_art.json'; +import preclinicReviewComponentSkeleton from '../../__mocks__/forms/omrs-forms/component_preclinic-review.json'; +import preclinicReviewComponentBody from '../../__mocks__/forms/ohri-forms/component_preclinic-review.json'; const MINI_FORM_NAME = 'Mini Form'; const MINI_FORM_UUID = '112d73b4-79e5-4be8-b9ae-d0840f00d4cf'; @@ -21,6 +27,16 @@ const SUB_FORM_NAME = 'Nested Form Two'; const SUB_FORM_UUID = '8304e5ff-6324-4863-ac51-8fcbc6812b13'; const SUB_FORM_SCHEMA_VALUE_REF = 'ca52a95c-8bb4-4a9f-a0cf-f0df437592da'; +const COMPONENT_FORM_NAME = 'Form Component'; +const COMPONENT_FORM_UUID = 'af7c1fe6-d669-414e-b066-e9733f0de7b8'; +const COMPONENT_FORM_SCHEMA_VALUE_REF = '74d06044-850f-11ee-b9d1-0242ac120002'; +const COMPONENT_ART = 'component_art'; +const COMPONENT_ART_UUID = '2f063f32-7f8a-11ee-b962-0242ac120002'; +const COMPONENT_ART_SCHEMA_VALUE_REF = '74d06044-850f-11ee-b9d1-0242ac120003'; +const COMPONENT_PRECLINIC_REVIEW = 'component_preclinic-review'; +const COMPONENT_PRECLINIC_REVIEW_UUID = '2f063f32-7f8a-11ee-b962-0242ac120004'; +const COMPONENT_PRECLINIC_REVIEW_SCHEMA_VALUE_REF = '74d06044-850f-11ee-b9d1-0242ac120004'; + // Base setup const mockOpenmrsFetch = openmrsFetch as jest.Mock; mockOpenmrsFetch.mockImplementation(jest.fn()); @@ -58,6 +74,37 @@ when(mockOpenmrsFetch) .calledWith(buildPath(MINI_FORM_SCHEMA_VALUE_REF)) .mockResolvedValue({ data: miniFormBody }); +// form components +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_FORM_NAME)) + .mockResolvedValue({ data: { results: [formComponentSkeleton] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_FORM_UUID)) + .mockResolvedValue({ data: formComponentSkeleton }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_FORM_SCHEMA_VALUE_REF)) + .mockResolvedValue({ data: formComponentBody }); + +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_ART)) + .mockResolvedValue({ data: { results: [artComponentSkeleton] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_ART_UUID)) + .mockResolvedValue({ data: artComponentSkeleton }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_ART_SCHEMA_VALUE_REF)) + .mockResolvedValue({ data: artComponentBody }); + +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_PRECLINIC_REVIEW)) + .mockResolvedValue({ data: { results: [preclinicReviewComponentSkeleton] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_PRECLINIC_REVIEW_UUID)) + .mockResolvedValue({ data: preclinicReviewComponentSkeleton }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_PRECLINIC_REVIEW_SCHEMA_VALUE_REF)) + .mockResolvedValue({ data: preclinicReviewComponentBody }); + describe('useFormJson', () => { it('should fetch basic form by name', async () => { let hook = null; @@ -108,6 +155,19 @@ describe('useFormJson', () => { // verify subforms verifyEmbeddedForms(hook.result.current.formJson); }); + + it('should load form components in combined raw form json', async () => { + let hook = null; + await act(async () => { + hook = renderHook(() => useFormJson(null, formComponentBody, null, null)); + }); + expect(hook.result.current.isLoading).toBe(false); + expect(hook.result.current.error).toBe(undefined); + expect(hook.result.current.formJson.name).toBe(COMPONENT_FORM_NAME); + + // verify form components have been loaded + verifyFormComponents(hook.result.current.formJson); + }); }); function buildPath(path: string) { @@ -122,3 +182,8 @@ function verifyEmbeddedForms(formJson) { expect(nestedSubform.name).toBe(MINI_FORM_NAME); expect(nestedSubform.pages.length).toBe(1); } + +function verifyFormComponents(formJson) { + // assert that alias has been replaced with the actual component + expect(formJson.pages.length).toBe(2); +} diff --git a/src/hooks/useFormJson.tsx b/src/hooks/useFormJson.tsx index b810208ac..b34daaebd 100644 --- a/src/hooks/useFormJson.tsx +++ b/src/hooks/useFormJson.tsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { OHRIFormSchema } from '../api/types'; +import { OHRIFormSchema, OHRIFormSection, ReferencedForm } from '../api/types'; import { isTrue } from '../utils/boolean-utils'; import { applyFormIntent } from '../utils/forms-loader'; import { fetchOpenMRSForm, fetchClobData } from '../api/api'; @@ -9,10 +9,10 @@ export function useFormJson(formUuid: string, rawFormJson: any, encounterUuid: s const [error, setError] = useState(validateFormsArgs(formUuid, rawFormJson)); useEffect(() => { loadFormJson(formUuid, rawFormJson, formSessionIntent) - .then(formJson => { + .then((formJson) => { setFormJson({ ...formJson, encounter: encounterUuid }); }) - .catch(error => { + .catch((error) => { console.error(error); setError(new Error('Error loading form JSON: ' + error.message)); }); @@ -45,26 +45,33 @@ export async function loadFormJson( ? { ...clobDataResponse, uuid: openmrsFormResponse.uuid } : rawFormJson; + // Sub forms const subformRefs = extractSubformRefs(formJson); const subforms = await loadSubforms(subformRefs, formSessionIntent); updateFormJsonWithSubforms(formJson, subforms); + // Form components + const formComponentsRefs = getReferencedForms(formJson); + const resolvedFormComponents = await loadFormComponents(formComponentsRefs); + const formComponents = mapFormComponents(resolvedFormComponents); + updateFormJsonWithComponents(formJson, formComponents); + return refineFormJson(formJson, formSessionIntent); } function extractSubformRefs(formJson: OHRIFormSchema): string[] { return formJson.pages - .filter(page => page.isSubform && !page.subform.form && page.subform?.name) - .map(page => page.subform?.name); + .filter((page) => page.isSubform && !page.subform.form && page.subform?.name) + .map((page) => page.subform?.name); } async function loadSubforms(subformRefs: string[], formSessionIntent?: string): Promise { - return Promise.all(subformRefs.map(subform => loadFormJson(subform, null, formSessionIntent))); + return Promise.all(subformRefs.map((subform) => loadFormJson(subform, null, formSessionIntent))); } function updateFormJsonWithSubforms(formJson: OHRIFormSchema, subforms: OHRIFormSchema[]): void { - subforms.forEach(subform => { - const matchingPage = formJson.pages.find(page => page.subform?.name === subform.name); + subforms.forEach((subform) => { + const matchingPage = formJson.pages.find((page) => page.subform?.name === subform.name); if (matchingPage) { matchingPage.subform.form = subform; } @@ -114,7 +121,7 @@ function removeInlineSubforms(formJson: OHRIFormSchema, formSessionIntent: strin !isTrue(page.isHidden) && page.subform?.form?.encounterType === formJson.encounterType ) { - const nonSubformPages = page.subform.form.pages.filter(page => !isTrue(page.isSubform)); + const nonSubformPages = page.subform.form.pages.filter((page) => !isTrue(page.isSubform)); formJson.pages.splice(i, 1, ...refineFormJson(page.subform.form, formSessionIntent).pages); } } @@ -130,3 +137,76 @@ function setEncounterType(formJson: OHRIFormSchema): void { delete formJson.encounter; } } + +/** + * Functions to support reusable Form Components + */ +function getReferencedForms(formJson: OHRIFormSchema): Array { + const referencedForms: Array = formJson?.referencedForms; + if (!referencedForms) { + return []; + } + return referencedForms; +} + +async function loadFormComponents(formComponentRefs: Array): Promise { + return Promise.all(formComponentRefs.map((formComponent) => loadFormJson(formComponent.formName, null, null))); +} + +function mapFormComponents(formComponents: Array): Map { + const formComponentsMap: Map = new Map(); + + formComponents.forEach((formComponent) => { + formComponentsMap.set(formComponent.name, formComponent); + }); + + return formComponentsMap; +} + +function updateFormJsonWithComponents(formJson: OHRIFormSchema, formComponents: Map): void { + formComponents.forEach((component, alias) => { + //loop through pages and search sections for reference key + formJson.pages.forEach((page) => { + if (page.sections) { + page.sections.forEach((section) => { + if (section.reference && section.reference.form === alias) { + // resolve referenced component section + let resolvedFormSection = getReferencedFormSection(section, component); + // add resulting referenced component section to section + Object.assign(section, resolvedFormSection); + } + }); + } + }); + }); +} + +function getReferencedFormSection(formSection: OHRIFormSection, formComponent: OHRIFormSchema): OHRIFormSection { + let referencedFormSection: OHRIFormSection; + + // search for component page and section reference from component + let matchingComponentPage = formComponent.pages.filter((page) => page.label === formSection.reference.page); + if (matchingComponentPage.length > 0) { + let matchingComponentSection = matchingComponentPage[0].sections.filter( + (componentSection) => componentSection.label === formSection.reference.section, + ); + if (matchingComponentSection.length > 0) { + referencedFormSection = matchingComponentSection[0]; + } + } + + return filterExcludedQuestions(referencedFormSection); +} + +function filterExcludedQuestions(formSection: OHRIFormSection): OHRIFormSection { + if (formSection.reference.excludeQuestions) { + const excludeQuestions = formSection.reference.excludeQuestions; + formSection.questions = formSection.questions.filter((question) => { + return !excludeQuestions.includes(question.id); + }); + } + // delete reference from section + delete formSection.reference; + + return formSection; +} diff --git a/src/ohri-form.component.test.tsx b/src/ohri-form.component.test.tsx index dfff00276..8512b9a49 100644 --- a/src/ohri-form.component.test.tsx +++ b/src/ohri-form.component.test.tsx @@ -101,7 +101,7 @@ describe("OHRI Forms:", () => { cleanup(); jest.useRealTimers(); }); - + it("Should render by the form json without dying", async () => { await act(async () => renderForm(null, hts_poc_1_1)); await assertFormHasAllFields(screen, [ @@ -190,7 +190,7 @@ describe("OHRI Forms:", () => { // Add assertions for a successful submission expect(saveEncounterMock).toBeCalledTimes(1); - expect(saveEncounterMock).toHaveBeenCalledWith(expect.any(AbortController), expect.any(Object), undefined); + expect(saveEncounterMock).toHaveBeenCalledWith(expect.any(AbortController), expect.any(Object), undefined); expect(saveEncounterMock).toHaveReturned(); }); @@ -223,7 +223,7 @@ describe("OHRI Forms:", () => { const [abortController, encounter, encounterUuid] = saveEncounterMock.mock.calls[0]; expect(encounter.obs.length).toEqual(3); expect(encounter.obs.find(obs => obs.formFieldPath === "ohri-forms-hivEnrolmentDate")).toBeUndefined(); - + }); }); @@ -353,7 +353,6 @@ describe("OHRI Forms:", () => { it("Should evaluate months on ART", async () => { // setup - console.log(locale); await act(async () => renderForm(null, months_on_art_form)); jest.useFakeTimers(); jest.setSystemTime(new Date(2022, 9, 1)); diff --git a/src/utils/expression-runner.ts b/src/utils/expression-runner.ts index 55531cefb..9dc622f7b 100644 --- a/src/utils/expression-runner.ts +++ b/src/utils/expression-runner.ts @@ -24,7 +24,7 @@ export function evaluateExpression( if (!expression?.trim()) { return null; } - const allFieldsKeys = fields.map(f => f.id); + const allFieldsKeys = fields.map((f) => f.id); const parts = parseExpression(expression.trim()); // register dependencies findAndRegisterReferencedFields(node, parts, fields); @@ -67,7 +67,7 @@ export async function evaluateAsyncExpression( if (!expression?.trim()) { return null; } - const allFieldsKeys = fields.map(f => f.id); + const allFieldsKeys = fields.map((f) => f.id); let parts = parseExpression(expression.trim()); // register dependencies findAndRegisterReferencedFields(node, parts, fields); diff --git a/src/utils/forms-loader.ts b/src/utils/forms-loader.ts index 0fa377cf9..d0570bd2d 100644 --- a/src/utils/forms-loader.ts +++ b/src/utils/forms-loader.ts @@ -47,7 +47,7 @@ export function getForm( export function loadSubforms(parentForm) { parentForm.pages = parentForm.pages || []; - parentForm.pages.forEach(page => { + parentForm.pages.forEach((page) => { if (page.isSubform && page.subform?.name && page.subform.package) { try { const subform = getForm(page.subform.package, page.subform.name); @@ -67,9 +67,9 @@ export function getLatestFormVersion(forms: FormJsonFile[]) { if (forms.length == 1) { return forms[0]; } - const candidates = forms.map(f => f.semanticVersion); + const candidates = forms.map((f) => f.semanticVersion); const latest = candidates.sort(formsVersionComparator)[candidates.length - 1]; - return forms.find(f => f.semanticVersion == latest); + return forms.find((f) => f.semanticVersion == latest); } export function getFormByVersion(forms: FormJsonFile[], requiredVersion: string, isStrict?: boolean) { @@ -93,7 +93,7 @@ export function lookupForms(packageName, formNamespace, formsRegistry) { if (!pkg[formNamespace]) { throw new Error(`Form namespace '${formNamespace}' was not found in forms registry`); } - return Object.keys(pkg[formNamespace]).map(formVersion => { + return Object.keys(pkg[formNamespace]).map((formVersion) => { return { version: formVersion, semanticVersion: semver.coerce(formVersion).version, @@ -115,7 +115,7 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array candidate.intent === (intent?.intent || intent), + (candidate) => candidate.intent === (intent?.intent || intent), )?.defaultPage; // filter form-level markdown behaviour @@ -127,10 +127,12 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array { + jsonBuffer.pages.forEach((page) => { if (page.isSubform && page.subform?.form) { const behaviourOverrides = []; - const targetBehaviour = page.subform.behaviours?.find(behaviour => behaviour.intent == intent?.intent || intent); + const targetBehaviour = page.subform.behaviours?.find( + (behaviour) => behaviour.intent == intent?.intent || intent, + ); if (targetBehaviour?.readonly !== undefined || targetBehaviour?.readonly != null) { behaviourOverrides.push({ name: 'readonly', type: 'field', value: targetBehaviour?.readonly }); } @@ -142,12 +144,12 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array behaviour.intent === (intent?.intent || intent)); + const pageBehaviour = page.behaviours?.find((behaviour) => behaviour.intent === (intent?.intent || intent)); if (pageBehaviour) { page.hide = pageBehaviour?.hide; page.readonly = pageBehaviour?.readonly; } else { - const fallBackBehaviour = page.behaviours?.find(behaviour => behaviour.intent === '*'); + const fallBackBehaviour = page.behaviours?.find((behaviour) => behaviour.intent === '*'); page.hide = fallBackBehaviour?.hide; page.readonly = fallBackBehaviour?.readonly; } @@ -159,13 +161,13 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array { + page.sections.forEach((section) => { // TODO: Apply parentOverrides to sections if applicable - const secBehaviour = section.behaviours?.find(behaviour => behaviour.intent === intent?.intent || intent); + const secBehaviour = section.behaviours?.find((behaviour) => behaviour.intent === intent?.intent || intent); if (secBehaviour) { section.hide = secBehaviour?.hide; } else { - const fallBackBehaviour = section.behaviours?.find(behaviour => behaviour.intent === '*'); + const fallBackBehaviour = section.behaviours?.find((behaviour) => behaviour.intent === '*'); section.hide = fallBackBehaviour?.hide ?? section.hide; } @@ -181,19 +183,19 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array override.type == 'all' || override.type == 'field') - ?.forEach(override => { + ?.filter((override) => override.type == 'all' || override.type == 'field') + ?.forEach((override) => { question[override.name] = override.value; }); } if (question.questions && question.questions.length) { - question.questions.forEach(childQuestion => { + question.questions.forEach((childQuestion) => { updateQuestionRequiredBehaviour(childQuestion, intent?.intent || intent); parentOverrides - ?.filter(override => override.type == 'all' || override.type == 'field') - ?.forEach(override => { + ?.filter((override) => override.type == 'all' || override.type == 'field') + ?.forEach((override) => { childQuestion[override.name] = override.value; }); }); @@ -207,9 +209,9 @@ export function applyFormIntent(intent, originalJson, parentOverrides?: Array behaviour.intent === intent); + const requiredIntentBehaviour = question.behaviours?.find((behaviour) => behaviour.intent === intent); - const defaultIntentBehaviour = question.behaviours?.find(bevahiour => bevahiour.intent === '*'); + const defaultIntentBehaviour = question.behaviours?.find((bevahiour) => bevahiour.intent === '*'); // If both required and default intents exist, combine them and update to question if (requiredIntentBehaviour || defaultIntentBehaviour) { // Remove the intent name props from each object @@ -235,8 +237,8 @@ function updateQuestionRequiredBehaviour(question, intent: string) { } function updateMarkdownRequiredBehaviour(markdown, intent) { - const requiredIntentBehaviour = markdown.behaviours?.find(behaviour => behaviour.intent === intent); - const defaultIntentBehaviour = markdown.behaviours?.find(behaviour => behaviour.intent === '*'); + const requiredIntentBehaviour = markdown.behaviours?.find((behaviour) => behaviour.intent === intent); + const defaultIntentBehaviour = markdown.behaviours?.find((behaviour) => behaviour.intent === '*'); if (requiredIntentBehaviour && defaultIntentBehaviour) { delete requiredIntentBehaviour.intent; @@ -255,7 +257,7 @@ function updateMarkdownRequiredBehaviour(markdown, intent) { export function updateExcludeIntentBehaviour(excludedIntents: Array, originalJson) { originalJson.availableIntents = originalJson.availableIntents.filter( - intent => !excludedIntents.includes(intent?.intent || intent), + (intent) => !excludedIntents.includes(intent?.intent || intent), ); return originalJson; } diff --git a/yarn.lock b/yarn.lock index 83f740b8c..54a0a10fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3135,8 +3135,8 @@ __metadata: yup: ^0.29.1 peerDependencies: "@carbon/react": 1.x - "@openmrs/esm-framework": 4.x - react: ^18.2.0 + "@openmrs/esm-framework": 5.x + react: 18.x react-i18next: 11.x rxjs: 6.x languageName: unknown @@ -6941,9 +6941,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.0, caniuse-lite@npm:^1.0.30001449, caniuse-lite@npm:^1.0.30001464": - version: 1.0.30001466 - resolution: "caniuse-lite@npm:1.0.30001466" - checksum: d81d0801f72162ebb7edb222cb48702f351e1a2d6acc9f340913f5b07e28c2105d1d2de9f0633c9b89e1aa1cd14f5d9154e270bf7b61296a7209745b32bdb01c + version: 1.0.30001561 + resolution: "caniuse-lite@npm:1.0.30001561" + checksum: 949829fe037e23346595614e01d362130245920503a12677f2506ce68e1240360113d6383febed41e8aa38cd0f5fd9c69c21b0af65a71c0246d560db489f1373 languageName: node linkType: hard