Stream: mapping-framework
Topic: Unable to find StructureDefinition for target type
Corey Wen (May 21 2021 at 19:47):
Hi, I am trying to transform a QuestionnaireResponse (QR) into a US Core Patient Resource (https://www.hl7.org/fhir/us/core/StructureDefinition-us-core-patient.html).
Before this, I had a StructureMap that would transform the QR into a Patient resource (https://www.hl7.org/fhir/patient.html).
From some examples of mapping files + "https://www.hl7.org/fhir/mapping-language.html", I think the solution is to change the structure definition resources in my mapping file.
Originally I had "uses "http://hl7.org/fhir/StructureDefinition/Patient" as target"
Which I changed to "uses "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" alias usCorePatient as target"
However after converting to a StructureMap and using that StructureMap with the FHIR validator to transform the QR, I get the error
Unable to find StructureDefinition for target type ('http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient')
org.hl7.fhir.exceptions.FHIRException: Unable to find StructureDefinition for target type ('http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient')
I found one post which may be relevant (https://chat.fhir.org/#narrow/stream/179170-smart/topic/US-Core.20profiles.20for.20validation), and that post mentions "You can't necessarily expect most servers to have awareness of the US Core profiles - even if they support SMART on FHIR", but I'm not sure what servers are involved with the transformation I am trying to do.
EDIT: After reading some output of the FHIR validator, namely "Terminology server http://tx.fhir.org", would this be the server the validator is using for StructureDefintions and that this server "does not have awarness of the US Core profiles" as such the comment from before?
Lloyd McKenzie (May 21 2021 at 20:18):
From a transformation perspective, you're fine using the base 'Patient' StructureDefinition. us-core-patient adds constraints, but doesn't change the structure - and then you don't have to worry about making the StructureMap execution engine aware of the profile. (It's probably possible, but there's no real value in doing it.)
Corey Wen (May 21 2021 at 20:31):
I'm trying to set the birthsex field (since it's a field for us-core-patient) while using the base 'Patient' StructureDefinition with the mapping rule
src -> patient.birthsex = 'male';
This results in the following error
Exception in thread "main" java.lang.Error: Cannot set property birthsex on null
and I am not sure if it is due to me using the base 'Patient' StructureDefinition or if my rule is incorrectly written.
I know 'src -> patient.gender = 'male'' works and both the .gender for Patient and .birthsex for us-core-patient are of type code so that's why I used that syntax.
However, I wanted to confirm what you mean is that since the structure is not changed between Patient and us-core-patient (as in us-core-patient really only adds three fields: us-core-race, ethnicity, birthsex), as long as I can add those three fields while using the base 'Patient' StructureDefinition it should still be accepted as a us-core-patient.
Lloyd McKenzie (May 22 2021 at 00:25):
There is no 'birthsex' element in us-core. There's an slice on extension that mandates support for a particular extension. So your path will need to be patient.extension('whatever-the-url-is').value = 'male'
Last updated: Apr 12 2022 at 19:14 UTC