diff --git a/__mocks__/forms/omrs-forms/component_art.json b/__mocks__/forms/omrs-forms/component_art.json new file mode 100644 index 000000000..6e4f378f9 --- /dev/null +++ b/__mocks__/forms/omrs-forms/component_art.json @@ -0,0 +1,1705 @@ +{ + "name": "component_art", + "uuid": "xxxx", + "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/omrs-forms/component_form-component.json b/__mocks__/forms/omrs-forms/component_form-component.json deleted file mode 100644 index e69de29bb..000000000 diff --git a/__mocks__/forms/omrs-forms/component_hospitalization.json b/__mocks__/forms/omrs-forms/component_hospitalization.json new file mode 100644 index 000000000..54f1d1b22 --- /dev/null +++ b/__mocks__/forms/omrs-forms/component_hospitalization.json @@ -0,0 +1,133 @@ +{ + "name": "component_hospitalization", + "uuid": "xxxx", + "processor": "EncounterFormProcessor", + "pages": [ + { + "label": "Hospitalization", + "sections": [ + { + "label": "Hospitalization History", + "questions": [ + { + "type": "obsGroup", + "label": "Recent hospitalizations", + "questionOptions": { + "rendering": "group", + "concept": "a8a003a6-1350-11df-a1f1-0026b9348838" + }, + "questions": [ + { + "label": "Was the patient hospitalized since last visit?", + "id": "wasHospitalized", + "questionOptions": { + "concept": "a898c56e-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": [] + } + ] + }, + { + "type": "obsGroup", + "label": "If yes reason for hospitalization:", + "questionOptions": { + "concept": "a8a003a6-1350-11df-a1f1-0026b9348838", + "rendering": "repeating" + }, + "questions": [ + { + "label": "Reason for hospitalization:", + "questionOptions": { + "concept": "a8a07a48-1350-11df-a1f1-0026b9348838", + "rendering": "problem" + }, + "type": "obs", + "validators": [ + { + "type": "conditionalAnswered", + "message": "Providing diagnosis but didn't answer that patient was hospitalized in question 11a", + "referenceQuestionId": "wasHospitalized", + "referenceQuestionAnswers": [ + "a899b35c-1350-11df-a1f1-0026b9348838" + ] + } + ] + } + ] + } + ] + }, + { + "label": "Past Diagnosis", + "questions": [ + { + "label": "Have you ever been diagnosed with these conditions:?", + "id": "pastDiagnosis", + "questionOptions": { + "concept": "b2343ae7-e435-4bc7-9615-74322d5201e4", + "answers": [ + { + "concept": "7ccac7e4-f399-48b9-b2c7-944b98ec53b1", + "label": "Sickle Cell" + }, + { + "concept": "a893436e-1350-11df-a1f1-0026b9348838", + "label": "Diabetes" + }, + { + "concept": "a877ca58-1350-11df-a1f1-0026b9348838", + "label": "Asthma" + }, + { + "concept": "a890b810-1350-11df-a1f1-0026b9348838", + "label": "Mental illness" + }, + { + "concept": "acdceb9b-4b84-4e9c-bba4-eaf486b3b4b5", + "label": "Cancer" + }, + { + "concept": "a8933270-1350-11df-a1f1-0026b9348838", + "label": "Epilepsy" + }, + { + "concept": "a8936bb4-1350-11df-a1f1-0026b9348838", + "label": "RHD" + }, + { + "concept": "a8aaf3e2-1350-11df-a1f1-0026b9348838", + "label": "Other" + } + ], + "rendering": "select" + }, + "type": "obs", + "validators": [] + } + ] + }, + { + "label": "Other(specify):", + "type": "obs", + "questionOptions": { + "concept": "a8a06fc6-1350-11df-a1f1-0026b9348838", + "rendering": "text" + }, + "validators": [] + } + ] + } + ] +} 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..ef7049db7 --- /dev/null +++ b/__mocks__/forms/omrs-forms/component_preclinic-review.json @@ -0,0 +1,480 @@ +{ + "name": "component_preclinic-review", + "uuid": "xxxx", + "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/omrs-forms/form-component.json b/__mocks__/forms/omrs-forms/form-component.json index e69de29bb..2d87e76b7 100644 --- a/__mocks__/forms/omrs-forms/form-component.json +++ b/__mocks__/forms/omrs-forms/form-component.json @@ -0,0 +1,72 @@ +{ + "name": "Form Component", + "uuid": "xxxx", + "processor": "EncounterFormProcessor", + "referencedForms": [ + { + "formName": "component_preclinic-review", + "alias": "pcr" + }, + { + "formName": "component_hospitalization", + "alias": "hosp" + }, + { + "formName": "component_art", + "alias": "art" + } + ], + "pages": [ + { + "label": "Pre-Clinic Review", + "sections": [ + { + "reference": { + "form": "pcr", + "page": "Pre-clinic Review", + "section": "Pre-clinic Review" + } + } + ] + }, + { + "label": "Medical History", + "sections": [ + { + "reference": { + "form": "pcr", + "page": "Pre-clinic Review", + "section": "Social History" + } + }, + { + "reference": { + "form": "pcr", + "page": "Pre-clinic Review", + "section": "Prevention With Positives" + } + }, + { + "reference": { + "form": "hosp", + "page": "Hospitalization", + "section": "Hospitalization History" + } + } + ] + }, + { + "label": "ART History", + "sections": [ + { + "reference": { + "form": "art", + "page": "ART ", + "section": "ART History", + "excludeQuestions": ["current_art_regimen_ped"] + } + } + ] + } + ] +} diff --git a/src/api/types.ts b/src/api/types.ts index fc9f6e4fc..6b795bcff 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -270,3 +270,13 @@ export interface DataSourceParameters { name: string; config?: Record; } + +export interface ReferencedForm { + formName: string; + alias: string; +} + +export interface FormComponent { + alias: string; + component: OHRIFormSchema; +} diff --git a/src/hooks/useFormComponent.tsx b/src/hooks/useFormComponent.tsx new file mode 100644 index 000000000..1785ea2e3 --- /dev/null +++ b/src/hooks/useFormComponent.tsx @@ -0,0 +1,36 @@ +import { OHRIFormSchema, ReferencedForm } from '../api/types'; + +function loadFormJson(formJson) { + const formComponentRefs = getReferencedForms(formJson); + const formComponents = getSubComponents(formJson); +} + +// Get referenced forms +function getReferencedForms(formJson: OHRIFormSchema) { + if (formJson.referencedForms) { + return formJson.referencedForms.map((form) => { + return { + formName: form.formName, + alias: form.alias, + }; + }); + } +} + +// Get sub components +function getSubComponents(formComponent) { + if (formComponent.subComponents) { + return formComponent.subComponents.map((subComponent) => { + return { + name: subComponent.name, + type: subComponent.type, + }; + }); + } +} + +const refs = { + pcr: 'component_preclinic-review', + hosp: 'component_hospitalization', + art: 'component_art', +}; diff --git a/src/hooks/useFormJson.test.tsx b/src/hooks/useFormJson.test.tsx index 7eb675f2e..843ecdeac 100644 --- a/src/hooks/useFormJson.test.tsx +++ b/src/hooks/useFormJson.test.tsx @@ -8,6 +8,10 @@ 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 formComponent from '../../__mocks__/forms/omrs-forms/form-component.json'; +import artComponent from '../../__mocks__/forms/omrs-forms/component_art.json'; +import hospitalizationComponent from '../../__mocks__/forms/omrs-forms/component_hospitalization.json'; +import preclinicReviewComponent from '../../__mocks__/forms/omrs-forms/component_preclinic-review.json'; const MINI_FORM_NAME = 'Mini Form'; const MINI_FORM_UUID = '112d73b4-79e5-4be8-b9ae-d0840f00d4cf'; @@ -21,6 +25,11 @@ 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_ART = 'component_art'; +const COMPONENT_HOSPITALIZATION = 'component_hospitalization'; +const COMPONENT_PRECLINIC_REVIEW = 'component_preclinic-review'; + // Base setup const mockOpenmrsFetch = openmrsFetch as jest.Mock; mockOpenmrsFetch.mockImplementation(jest.fn()); @@ -58,6 +67,20 @@ when(mockOpenmrsFetch) .calledWith(buildPath(MINI_FORM_SCHEMA_VALUE_REF)) .mockResolvedValue({ data: miniFormBody }); +// form components +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_FORM_NAME)) + .mockResolvedValue({ data: { results: [formComponent] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_ART)) + .mockResolvedValue({ data: { results: [artComponent] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_HOSPITALIZATION)) + .mockResolvedValue({ data: { results: [hospitalizationComponent] } }); +when(mockOpenmrsFetch) + .calledWith(buildPath(COMPONENT_PRECLINIC_REVIEW)) + .mockResolvedValue({ data: { results: [preclinicReviewComponent] } }); + describe('useFormJson', () => { it('should fetch basic form by name', async () => { let hook = null; @@ -108,6 +131,20 @@ describe('useFormJson', () => { // verify subforms verifyEmbeddedForms(hook.result.current.formJson); }); + + it('should load sub components in combined raw form json', async () => { + let hook = null; + await act(async () => { + hook = renderHook(() => useFormJson(null, formComponent, 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 subforms + verifyFormComponents(hook.result.current.formJson); + }); }); function buildPath(path: string) { @@ -122,3 +159,12 @@ function verifyEmbeddedForms(formJson) { expect(nestedSubform.name).toBe(MINI_FORM_NAME); expect(nestedSubform.pages.length).toBe(1); } + +function verifyFormComponents(formJson) { + // assert that the nestedForm2's (level one subform) pages have been aligned with the parent because they share the same encounterType + expect(formJson.pages.length).toBe(3); + // the mini form (it's not flattened into the parent form because it has a different encounterType) + const nestedSubform = formJson.pages[2].subform.form; + expect(nestedSubform.name).toBe(MINI_FORM_NAME); + expect(nestedSubform.pages.length).toBe(1); +} diff --git a/src/hooks/useFormJson.tsx b/src/hooks/useFormJson.tsx index 1d55c0c42..e5655968c 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 { FormComponent, OHRIFormSchema, ReferencedForm } from '../api/types'; import { isTrue } from '../utils/boolean-utils'; import { applyFormIntent } from '../utils/forms-loader'; import { fetchOpenMRSForm, fetchClobData } from '../api/api'; @@ -52,9 +52,10 @@ export async function loadFormJson( // Form components const formComponentsRefs = getReferencedForms(formJson); - // TODO: are form components supposed to have intents as well or can they inherit from the parent form? - const formComponents = await loadFormComponents(formComponentsRefs); - updateFormJsonWithSubforms(formJson, await loadSubforms(formComponents, formSessionIntent)); + const resolvedFormComponents = await loadFormComponents(formComponentsRefs); + const formComponents = mapFormComponents(formComponentsRefs, resolvedFormComponents); + + updateFormJsonWithComponents(formJson, formComponents); return refineFormJson(formJson, formSessionIntent); } @@ -141,26 +142,39 @@ function setEncounterType(formJson: OHRIFormSchema): void { /** * Functions to support reusable Form Components */ -function getReferencedForms(formJson: OHRIFormSchema): Object { +function getReferencedForms(formJson: OHRIFormSchema): Array { const referencedForms: Array = formJson.referencedForms; - if (!referencedForms) { - return; + return []; } + return referencedForms; +} + +async function loadFormComponents(formComponentRefs: Array): Promise { + return Promise.all(formComponentRefs.map((formComponent) => loadFormJson(formComponent.formName, null, null))); +} + +function mapFormComponents(formComponentRefs: Array, formComponents: Array) { + const formComponentsMap: Map = new Map(); - const keyValReferencedForms: Object = {}; - referencedForms.forEach((reference: any) => { - keyValReferencedForms[reference.alias] = reference.formName; + formComponents.forEach((formComponent) => { + formComponentsMap.set(formComponent.name, formComponent); }); - return keyValReferencedForms; + return formComponentsMap; } -async function loadSubformss(subformRefs: string[], formSessionIntent?: string): Promise { - return Promise.all(subformRefs.map((subform) => loadFormJson(subform, null, formSessionIntent))); +function updateFormJsonWithComponents(formJson: OHRIFormSchema, formComponents: Map): void { + // form components + formComponents.forEach((subform) => { + const matchingPage = formJson.pages.find((page) => page.subform?.name === subform.name); + if (matchingPage) { + matchingPage.subform.form = subform; + } + }); } -function loadFormComponents(schema: Object): Array { +function loadFormComponents2(schema: Object): Array { const referencedObjects: Array = []; this.extractPlaceholderObjects(schema, referencedObjects); return referencedObjects;