Closed RadovanTomik closed 1 year ago
here a example that works on Matchbox but not on android-fhir (it uses this very lib)
StructureMap between the questionnaireResponse and other resource
QR have a subject section
{
"resourceType": "QuestionnaireResponse",
"questionnaire": "https://fhir.dk.swisstph-mis.ch/matchbox/fhir/Questionnaire/emcarea.registration.p",
"subject": {
"id": "04d9a034-0017-461b-b56c-9471a4f8c259",
"type": "Patient",
"identifier": {
"value": "04d9a034-0017-461b-b56c-9471a4f8c259"
}
},
"encounter": {
"id": "84f1f1c2-f05e-4c9f-a5b1-cd5f8d63f584",
"type": "Encounter",
"identifier": {
"value": "84f1f1c2-f05e-4c9f-a5b1-cd5f8d63f584"
}
},
[...]
then on the StructureMap we have something like :
src -> bundle.entry as entry then {
src.encounter as encounter then {
encounter.id as idval -> entry.request as request, request.method = 'PUT', request.url = append('/Encounter/',idval) 'azich';
} 'iqxck';
src -> entry.resource = create("Encounter") as tgt then {
src -> tgt then emcareencounter(src, tgt) 'ltpli';
src.encounter as encounter then {
encounter.identifier as idval-> tgt.id = idval 'flckx';
} 'oegwb';
src.subject as sub -> tgt.subject = sub 'dnxfm';
} 'ohyoj';
} 'put-emcareencounter';
then we are getting this error:
/System.out: rule : oegwb; vars = source variables [src: (QuestionnaireResponse)], target variables [bundle: (Bundle), entry: (Bundle.entry), tgt: (Encounter)], shared variables []
I/System.out: rule : flckx; vars = source variables [src: (QuestionnaireResponse), encounter: (Reference)], target variables [bundle: (Bundle), entry: (Bundle.entry), tgt: (Encounter)], shared variables []
D/EGL_emulation: app_time_stats: avg=21.89ms min=1.89ms max=82.25ms count=36
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.argusoft.who.emcare, PID: 21061
org.hl7.fhir.exceptions.FHIRException: Unable to convert a org.hl7.fhir.r4.model.Identifier to a Id
at org.hl7.fhir.r4.model.Base.castToId(Base.java:449)
at org.hl7.fhir.r4.model.Resource.setProperty(Resource.java:298)
at org.hl7.fhir.r4.model.DomainResource.setProperty(DomainResource.java:315)
at org.hl7.fhir.r4.model.Encounter.setProperty(Encounter.java:3955)
at org.hl7.fhir.r4.utils.StructureMapUtilities.processTarget(StructureMapUtilities.java:1831)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1416)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1420)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1420)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeRule(StructureMapUtilities.java:1420)
at org.hl7.fhir.r4.utils.StructureMapUtilities.executeGroup(StructureMapUtilities.java:1403)
at org.hl7.fhir.r4.utils.StructureMapUtilities.transform(StructureMapUtilities.java:1377)
at com.google.android.fhir.datacapture.mapping.ResourceMapper.extractByStructureMap(ResourceMapper.kt:181)
@brynrhodes, @oliveregger could you please help us to get the right person for this issue, this issue is really blocking for us. thanks in advance
@delcroip looking at the stack trace it looks like you are using r4 for StructureMapUtilities, but the development is done only in r5 StructureMapUtilities, so I guess this explains the difference. Can you check the transform with the java fhir validator? This uses the r5 StructureMapUtilities.
You find the source for transform with r5 here: https://github.com/hapifhir/org.hl7.fhir.core/blob/master/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/ValidationEngine.java#L501
Thank you @oliveregger ,
this issue appear on the android FHIR SDK, I don't think we can change it ourself, would you advise google to use R5 iso R4 ?
poke @Tarun-Bhardwaj @jingtang10
@delcroip for the transform I would advise to use the R5 code, yes.
@oliveregger could you help me on the detail level ?
Which maven package I need to use ? which version ?
I saw that version 6.2 of the hapifhir support R5 https://hapifhir.io/hapi-fhir/docs/getting_started/versions.html
but on maven I could only find the 6.1.3 https://mvnrepository.com/artifact/ca.uhn.hapi.fhir/hapi-fhir-server
in the android SDK, I changed all R4 to R5 Also I could not find r5 version of antlr4-runtime, org.opencds.cqf.cql.evaluator.plandefinition.r4, org.opencds.cqf.cql.evaluator.activitydefinition.r4
then I am getting an error because the system expect R4 but get R5 resource ...
e: /home/delcpa/Development/android-fhir/workflow-testing/src/main/java/com/google/android/fhir/workflow/testing/PlanDefinition.kt: (194, 9): Type mismatch: inferred type is org.hl7.fhir.r4.model.CarePlan! but org.hl7.fhir.r5.model.CarePlan was expected
I am really not familiar with java so I may be wrong but it seems the hapi fhir context constructor does not support R5 yet
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions.
Are you planning on implementing these 2 transforms of the FHIR mapping language in the foreseeable future?