Stream: mapping-framework
Topic: Resource fields don't show up after transforming
Corey Wen (May 18 2021 at 14:38):
I am trying to transform a QuestionnaireResponse into a Patient resource and am using a very basic mapping file to convert the name inputs from the QuestionnaireResponse to the .name field for a Patient resource. The mapping file was converted to a StructureMap without any issues, but when using the StructureMap to transform the QuestionnaireResponse into a Patient resource the resulting resource does not have the .name field (it does have the .id and .active fields which were set using other rules in the map).
What should I look into to fix this issue?
For reference here are the rules used.
group MapPatientDemographicsPanelToPatient(source src: QuestionnaireResponse, target patient: Patient)
{
src -> patient.id = uuid();
src -> patient.active = true;
src.item as answerItem where "linkId = '/45392-8'" -> patient.name = create('HumanName') as patientName then
MapPatientFirstName(answerItem, patientName);
src.item as answerItem where "linkId = '/45394-4'" -> patient.name as patientName then
MapPatientLastName(answerItem, patientName);
}
group MapPatientFirstName(source answerItem, target patientName: HumanName) {
answerItem.answer as answer -> patientName.given as givenName then {
answer.valueString as vs -> patientName.given = vs;
};
}
group MapPatientLastName(source answerItem, target patientName: HumanName) {
answerItem.answer as answer -> patientName.family as familyName then {
answer.valueString as vs -> patientName.family = vs;
};
}
Maximilian Ossana (May 18 2021 at 15:03):
I've encountered that issue several times myself as well - if a rule is not defined properly there is no error message and it seems to be ignored completely.
What about simply trying "answerItem.answer as answer -> patientName.given = answer" ?
Or if that doesn't work, maybe "answerItem.value as vs -> patientName.given = cast(vs,'string')", if the mapping server you're using supports casting?
Last updated: Apr 12 2022 at 19:14 UTC