Closed ndegwamartin closed 6 months ago
@ndegwamartin this SimpleWorkerContext
will not work even we load the SM imports in this because this is coming from CoreModule dependency and the ResourceMapper is using a different SimpleWorkerContextwhich is coming from SDK DataCapture configuration
https://github.com/opensrp/fhircore/blob/a3de32e3f556a5bba8a41061a5e0b6429a53ec22/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt#L106
cc: @dubdabasoduba @maimoonak
@ndegwamartin i've made some changes in finding worker now i'm able to load the imported structure map and also load the structure-definition as well. The extraction started working but got another exception during extraction.
org.hl7.fhir.exceptions.FHIRException: Cannot set property patient on null - value is not a primitive type (Reference) or an ElementModel type
at org.hl7.fhir.r4.elementmodel.Element.setProperty(Element.java:378)
at org.hl7.fhir.r4.utils.StructureMapUtilities.processTarget(StructureMapUtilities.java:1844)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1429)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1416)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1412)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeDependency(StructureMapUtilities.java:1475)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1437)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1433)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1416)
at org.hl7.fhir.r4.utils.StructureMapUtilities.transform(StructureMapUtilities.java:1390)
at com.google.android.fhir.datacapture.mapping.ResourceMapper.extractByStructureMap(ResourceMapper.kt:213)
at com.google.android.fhir.datacapture.mapping.ResourceMapper.access$extractByStructureMap(ResourceMapper.kt:83)
at com.google.android.fhir.datacapture.mapping.ResourceMapper$extractByStructureMap$1.invokeSuspend(Unknown Source:15)
i also got this exception previously with different workflow here https://github.com/onaio/fhir-resources/issues/2786
cc: @dubdabasoduba @maimoonak
43b7c17
Not sure if it related but take note of the CHANGE LOG here and ensure that anywhere you have resource identifiers you explicitly qualify them with the resource types within the Structure Maps.
Support for loading all dependent Structure Maps during SM extraction.