Open dubdabasoduba opened 12 months ago
@owais-vd please update how far we are on this ticket
@owais-vd please update how far we are on this ticket updating the resources in ticket and uploading it on server
@dubdabasoduba for testing the measles implementation and installing the IG at once. I've made the following changes temporarily in the WorkflowCarePlanGenerator
class.
val packagePath = "who_eir/packages/package"
val resourceFiles = context.assets.list(packagePath);
resourceFiles?.forEach { fileName ->
val fileStream = context.assets.open("$packagePath/$fileName")
val file = File("${context.cacheDir}/$fileName").apply {
writeBytes(fileStream.readBytes())
}
knowledgeManager.install(file)
Timber.d("installing file ${file.absolutePath}")
}
now I'm able to generate the CarePlan
, OperationOutcome
and MedicationRequest
resource here are the generated resources you could check.
{
"resourceType": "CarePlan",
"id": "87723a68-142e-4808-8cd5-8bc97c327f63",
"meta": {
"lastUpdated": "2024-01-24T19:31:01.449+05:00",
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"instantiatesCanonical": [
"PlanDefinition/IMMZD2DTMeasles"
],
"title": "IMMZ.D2.DT.Measles",
"description": "If the child or patient has not been given MCV1 (at 9 months) and MCV2 (between 15-18 months) vaccination",
"activity": [
{
"reference": {
"reference": "MedicationRequest/30"
}
},
{
"reference": {
"reference": "OperationOutcome/apply-outcome-IMMZD2DTMeasles"
}
}
]
}
{
"resourceType": "MedicationRequest",
"id": "30",
"meta": {
"lastUpdated": "2024-01-24T19:31:01.327+05:00",
"profile": [
"http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-immunizationrequest"
],
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"status": "draft",
"intent": "proposal",
"doNotPerform": false,
"medicationCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/sid/icd-11",
"code": "XM28X5",
"display": "Measles vaccines"
}
]
},
"subject": {
"reference": "Patient/Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"
},
"instantiatesCanonical": [
"http://smart.who.int/ig/smart-immunizations/ActivityDefinition/IMMZD2DTMeaslesMR"
]
}
{
"resourceType": "OperationOutcome",
"id": "apply-outcome-IMMZD2DTMeasles",
"meta": {
"lastUpdated": "2024-01-24T19:31:01.404+05:00",
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "Error encountered extracting b5887df8-a702-4d97-b207-c00991477e4a: Unable to retrieve Questionnaire code map for Observation based extraction"
}
]
}
@owais-vd I think this is fine. I can see some items we can bring up with the team.
{"subject":{"reference":"Patient/Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"}}
. Do you mind checking if the same thing happens when you run $apply for this IG on the SDK?@dubdabasoduba
The Patient reference on the MedicationRequest is wrong {"subject":{"reference":"Patient/Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"}}. Do you mind checking if the same thing happens when you run $apply for this IG on the SDK?
This was a bug in WorkflowCarePlanGenerator
now it has been fixed.
The OperationOutcome might be happening because of an issue with the QuestionnaireResponse. Do we have all questions on the Questionnaires showing up correctly on the form UI in the app?
Yes, all the questions are rendering properly except these two:
hivStatus
vaccineType
both items have a choice
type with answerValueSet
but this is not rendering. Therefore, I've put the answerOption
in questionnaire after adding this the answers are showing in the questionnaire but after submission, i got the same error.
Here is a generated questionnaire-response and it has a missing hivStatus
answer.
{
"resourceType": "QuestionnaireResponse",
"id": "b5887df8-a702-4d97-b207-c00991477e4a",
"meta": {
"lastUpdated": "2024-01-24T19:30:51.424+05:00",
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"contained": [
{
"resourceType": "List",
"id": "3fddb23d-b19b-467b-86f7-2e9c08d4b7c9",
"status": "current",
"mode": "working",
"title": "GeneratedResourcesList",
"date": "2024-01-24T19:30:51+05:00"
}
],
"questionnaire": "Questionnaire/0fbd4938-6134-4c56-8d49-6c91dd306fbd",
"status": "completed",
"subject": {
"reference": "Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"
},
"authored": "2024-01-24T19:30:50+05:00",
"author": {
"reference": "Practitioner/59f47fdd-5d30-4d55-82f6-cc562cb5c749"
},
"item": [
{
"linkId": "dose0",
"text": "Indicates if the client has received a birth dose and/or a zero dose",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "booster",
"text": "Indicates if the client has received a booster dose and/or a supplementary dose",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "completedPrimarySeries",
"text": "Indicates if the client has completed the primary vaccination series of a product/antigen. If the client has not yet completed their primary series, it means they may be expected to receive more doses to complete their vaccination regimen for the respective product/antigen.",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "dateSeriesCompleted",
"text": "The date when the client completed the primary vaccination series - per product/antigen",
"answer": [
{
"valueDate": "2024-01-24"
}
]
},
{
"linkId": "hivStatus",
"text": "The current human immunodeficiency virus HIV status of the client"
},
{
"linkId": "pretermBirth",
"text": "The infant was preterm; the mother gave birth to the infant when gestational age was less than 37 weeks",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "immunocompromised",
"text": "The client is known to be immunocompromised. This means the client has a weakened immune system and having a reduced ability to fight infections and other diseases",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "onART",
"text": "The client is currently receiving antiretroviral therapy - ART",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "severelyImmunosuppressed",
"text": "The client is known to be severely immunocompromised or immunosuppressed",
"answer": [
{
"valueBoolean": false
}
]
},
{
"linkId": "artStartDate",
"text": "The date on which the client started or restarted antiretroviral therapy ART",
"answer": [
{
"valueDate": "2024-01-24"
}
]
}
]
}
@dubdabasoduba As i discussed in a call that we have a difference in generated MedicationRequest
resource from $lite
and $apply
. Attached both versions of MedicationRequest
for comparison.
This version is generated from the $lite
method.
{
"resourceType": "MedicationRequest",
"id": "618aa169-2b7e-4aff-a510-bf32ca08e929",
"meta": {
"lastUpdated": "2024-01-24T16:34:03.001+05:00",
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"identifier": [
{
"use": "official",
"value": "e6dd491c-dc9a-4738-9076-6c6de7bf82bb"
}
],
"status": "draft",
"intent": "proposal",
"doNotPerform": false,
"medicationCodeableConcept": {
"coding": [
{
"system": "http://snomed.info/sct",
"code": "440075005",
"display": "Live measles + rubella vaccine injection dose form (product)"
}
],
"text": "Measles vaccines"
},
"subject": {
"reference": "Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"
},
"supportingInformation": [
{
"reference": "Questionnaire/d9a6dbf5-3529-4a3c-9b38-92ffb4e7bd89"
}
],
"authoredOn": "2024-01-24T16:34:02+05:00",
"recorder": {
"reference": "Practitioner/59f47fdd-5d30-4d55-82f6-cc562cb5c749"
},
"reasonCode": [
{
"coding": [
{
"system": "http://snomed.info/sct",
"code": "1000001",
"display": "Review Proposal"
}
],
"text": "Review Proposal"
}
],
"basedOn": [
{
"reference": "CarePlan/416fc6bd-8730-434a-aa78-a9d5bce52669"
}
],
"dispenseRequest": {
"validityPeriod": {
"start": "2024-07-17T00:00:00.00Z",
"end": "2025-04-23T00:00:00.00Z"
}
}
}
This version is generated from the $apply
method.
{
"resourceType": "MedicationRequest",
"id": "30",
"meta": {
"lastUpdated": "2024-01-25T20:35:49.482+05:00",
"profile": [
"http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-immunizationrequest"
],
"tag": [
{
"system": "https://smartregister.org/care-team-tag-id",
"code": "12be445c-4022-45d5-861f-df40a5bc439d",
"display": "Practitioner CareTeam"
},
{
"system": "https://smartregister.org/location-tag-id",
"code": "6892091d-e7c2-4b40-8501-6dcaa30a7398",
"display": "Practitioner Location"
},
{
"system": "https://smartregister.org/organisation-tag-id",
"code": "1763",
"display": "Practitioner Organization"
},
{
"system": "https://smartregister.org/practitioner-tag-id",
"code": "59f47fdd-5d30-4d55-82f6-cc562cb5c749",
"display": "Practitioner"
},
{
"system": "https://smartregister.org/app-version",
"code": "Not defined",
"display": "Application Version"
}
]
},
"status": "draft",
"intent": "proposal",
"doNotPerform": false,
"medicationCodeableConcept": {
"coding": [
{
"system": "http://hl7.org/fhir/sid/icd-11",
"code": "XM28X5",
"display": "Measles vaccines"
}
]
},
"subject": {
"reference": "Patient/9a6188b4-cd60-41af-8880-c3f8464eef4b"
},
"instantiatesCanonical": [
"http://smart.who.int/ig/smart-immunizations/ActivityDefinition/IMMZD2DTMeaslesMR"
]
}
@dubdabasoduba MedicationRequest
and OutcomeOperation
resources IDs are not generating from CQL resources, on the contrary, MedicationRequest
resource id is set from knowledge db (ActivityDifinition) row id and here is the screenshot for this.
and OperationOutcome
resource id set hard-coded in PlanDefinitionProcessor
@dubdabasoduba managed to load all the Metadata Resources into the worker context but this didn't solve the issue.
After further troubleshooting I've determined the reason why the care plan generation is failing is because we don't have an element
field in our IMMZD1MeaslesQRToResources
structure map .
What we have
{
"name": "QRtoLM",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "model",
"contextType": "variable"
}
...
What we should be having
{
"name": "QRtoLM",
"source": [
{
"context": "qr"
}
],
"target": [
{
"context": "model",
"contextType": "variable",
"element": "<some element value>",
}
...
From the FHIR Spec, the field doesn't seem to be mandatory , see - https://hl7.org/fhir/R4/structuremap.html
Thus for this to work either of these options :
Update Confirmed that the issue is not with the specific version of the R4 HAPI FHIR libraries we are using (6.0.22) because the latest release (6.3.18) and even master branch code both have the mandatory check, see - https://github.com/hapifhir/org.hl7.fhir.core/blob/6.3.18/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/utils/StructureMapUtilities.java#L1895-L1900
However, the interesting thing is on R5 the check was removed, meaning if we use the R5 HAPI FHIR Structures the exception we experience up to that point would not be occurring, see R5 code here - https://github.com/hapifhir/org.hl7.fhir.core/blob/master/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/structuremap/StructureMapUtilities.java#L1724-L1727
This then poses the question, could we be trying to execute R5 content which is not currently supported by the FHIR SDK and by extension our platform?
Operation Outcomes found during the testing
{"resourceType":"QuestionnaireResponse","id":"5c859632-ea2a-4acb-9f9e-f46cf7dc9036","meta":{"lastUpdated":"2024-08-06T12:18:10.794+05:00","tag":[{"system":"https://smartregister.org/care-team-tag-id","code":"12be445c-4022-45d5-861f-df40a5bc439d","display":"Practitioner CareTeam"},{"system":"https://smartregister.org/location-tag-id","code":"6892091d-e7c2-4b40-8501-6dcaa30a7398","display":"Practitioner Location"},{"system":"https://smartregister.org/organisation-tag-id","code":"1763","display":"Practitioner Organization"},{"system":"https://smartregister.org/practitioner-tag-id","code":"59f47fdd-5d30-4d55-82f6-cc562cb5c749","display":"Practitioner"},{"system":"https://smartregister.org/app-version","code":"2.0.0-who_eir","display":"Application Version"}]},"contained":[{"resourceType":"List","id":"c7b208c4-24c3-4b5c-b852-d5cfe15cc09f","status":"current","mode":"working","title":"GeneratedResourcesList","date":"2024-08-06T12:18:10+05:00"}],"questionnaire":"Questionnaire/IMMZD1ClientHistoryMeasles","status":"completed","subject":{"reference":"Patient/cb6a85e7-e1f1-4ec6-a246-75b72794b98e"},"authored":"2024-08-06T12:18:10+05:00","author":{"reference":"Practitioner/59f47fdd-5d30-4d55-82f6-cc562cb5c749"},"item":[{"linkId":"type","text":"The type of dose in a series that the client received"},{"linkId":"booster","text":"Indicates if the client has completed the booster series of a product/antigen","answer":[{"valueBoolean":false}]},{"linkId":"completedPrimarySeries","text":"Indicates if the client has completed the primary vaccination series of a product/antigen. If the client has not yet completed their primary series, it means they may be expected to receive more doses to complete their vaccination regimen for the respective product/antigen."},{"linkId":"dateSeriesCompleted","text":"The date when the client completed the primary vaccination series - per product/antigen"},{"linkId":"hivStatus","text":"The current human immunodeficiency virus HIV status of the client"},{"linkId":"pretermBirth","text":"The infant was preterm; the mother gave birth to the infant when gestational age was less than 37 weeks"},{"linkId":"immunocompromised","text":"The client is known to be immunocompromised. This means the client has a weakened immune system and having a reduced ability to fight infections and other diseases","answer":[{"valueBoolean":false}]},{"linkId":"onART","text":"The client is currently receiving antiretroviral therapy - ART"},{"linkId":"severelyImmunosuppressed","text":"The client is known to be severely immunocompromised or immunosuppressed","answer":[{"valueBoolean":false}]},{"linkId":"artStartDate","text":"The date on which the client started or restarted antiretroviral therapy ART"}]}
{
"resourceType": "OperationOutcome",
"id": "apply-outcome-IMMZDTUmbrella",
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "Error encountered extracting 5c859632-ea2a-4acb-9f9e-f46cf7dc9036: Unable to retrieve Questionnaire code map for Observation based extraction"
}
]
}
{
"resourceType": "OperationOutcome",
"id": "apply-outcome-43",
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "DynamicValue resolution for path status encountered exception: library expression loaded, but had errors: Identifier %resource is already in use in this library."
},
{
"severity": "error",
"code": "exception",
"diagnostics": "DynamicValue resolution for path intent encountered exception: library expression loaded, but had errors: Identifier %resource is already in use in this library."
}
]
}
{
"resourceType": "OperationOutcome",
"id": "apply-outcome-45",
"issue": [
{
"severity": "error",
"code": "exception",
"diagnostics": "Condition expression Guidance encountered exception: Index 0 out of bounds for length 0"
}
]
}
{
"resourceType": "CarePlan",
"id": "f7d2a850-9c6e-4088-94a8-620b1ed84109",
"instantiatesCanonical": ["PlanDefinition/IMMZDTUmbrella"],
"title": "IMMZ.DT.Umbrella",
"description": "If the child or patient has not been given MCV1 (at 9 months) and MCV2 (between 15-18 months) vaccination",
"activity": [
{
"reference": {"reference": "OperationOutcome/apply-outcome-43"}
},
{
"reference": {"reference": "OperationOutcome/apply-outcome-45"}
},
{
"reference": {
"reference": "OperationOutcome/apply-outcome-IMMZDTUmbrella"
}
},
{
"reference": {"reference": "OperationOutcome/apply-outcome-43"}
},
{
"reference": {"reference": "OperationOutcome/apply-outcome-45"}
}
]
}
Describe the feature request.
$apply
and generate the correct resources.Acceptance criteria
$lite
on the current WHO EIR appResources