Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/FHIR/fhir-test-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamegrieve committed Mar 24, 2024
2 parents dec37fd + 4d92348 commit 81df9a9
Show file tree
Hide file tree
Showing 208 changed files with 20,709 additions and 10,838 deletions.
4 changes: 2 additions & 2 deletions comparison/sd-ext-dd-diff.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<tr>
<td colspan="2" class="structure">
<span class="self-link-parent">
<a name="Extension.extension:substance.value[x]"> </a><a name="Extension.extension:substance.valueCodeableConcept"> </a><a name="Extension.extension:substance.value[x]:valueCodeableConcept"> </a><span style="color: grey">7</span><b>. Extension.extension:substance.value[x]</b><a href="#Extension.extension:substance.value[x]" title="link to here" class="self-link"><svg viewBox="0 0 1792 1792" width="16" class="self-link" height="16"><path d="M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"/></svg></a> </span>
<a name="Extension.extension:substance.value[x]"> </a><a name="Extension.extension:substance.valueCodeableConcept"> </a><a name="Extension.extension:substance.value[x]:valueCodeableConcept"> </a><a name="Extension.extension:substance.valueCodeableConcept:valueCodeableConcept"> </a><span style="color: grey">7</span><b>. Extension.extension:substance.value[x]</b><a href="#Extension.extension:substance.value[x]" title="link to here" class="self-link"><svg viewBox="0 0 1792 1792" width="16" class="self-link" height="16"><path d="M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"/></svg></a> </span>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -265,7 +265,7 @@
<tr>
<td colspan="2" class="structure">
<span class="self-link-parent">
<a name="Extension.extension:exposureRisk1.value[x]"> </a><a name="Extension.extension:exposureRisk1.valueCodeableConcept"> </a><a name="Extension.extension:exposureRisk1.value[x]:valueCodeableConcept"> </a><span style="color: grey">14</span><b>. Extension.extension:exposureRisk1.value[x]</b><a href="#Extension.extension:exposureRisk1.value[x]" title="link to here" class="self-link"><svg viewBox="0 0 1792 1792" width="16" class="self-link" height="16"><path d="M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"/></svg></a> </span>
<a name="Extension.extension:exposureRisk1.value[x]"> </a><a name="Extension.extension:exposureRisk1.valueCodeableConcept"> </a><a name="Extension.extension:exposureRisk1.value[x]:valueCodeableConcept"> </a><a name="Extension.extension:exposureRisk1.valueCodeableConcept:valueCodeableConcept"> </a><span style="color: grey">14</span><b>. Extension.extension:exposureRisk1.value[x]</b><a href="#Extension.extension:exposureRisk1.value[x]" title="link to here" class="self-link"><svg viewBox="0 0 1792 1792" width="16" class="self-link" height="16"><path d="M1520 1216q0-40-28-68l-208-208q-28-28-68-28-42 0-72 32 3 3 19 18.5t21.5 21.5 15 19 13 25.5 3.5 27.5q0 40-28 68t-68 28q-15 0-27.5-3.5t-25.5-13-19-15-21.5-21.5-18.5-19q-33 31-33 73 0 40 28 68l206 207q27 27 68 27 40 0 68-26l147-146q28-28 28-67zm-703-705q0-40-28-68l-206-207q-28-28-68-28-39 0-68 27l-147 146q-28 28-28 67 0 40 28 68l208 208q27 27 68 27 42 0 72-31-3-3-19-18.5t-21.5-21.5-15-19-13-25.5-3.5-27.5q0-40 28-68t68-28q15 0 27.5 3.5t25.5 13 19 15 21.5 21.5 18.5 19q33-31 33-73zm895 705q0 120-85 203l-147 146q-83 83-203 83-121 0-204-85l-206-207q-83-83-83-203 0-123 88-209l-88-88q-86 88-208 88-120 0-204-84l-208-208q-84-84-84-204t85-203l147-146q83-83 203-83 121 0 204 85l206 207q83 83 83 203 0 123-88 209l88 88q86-88 208-88 120 0 204 84l208 208q84 84 84 204z"/></svg></a> </span>
</td>
</tr>
<tr>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.hl7.fhir.testcases</groupId>
<artifactId>fhir-test-cases</artifactId>
<version>1.4.27-SNAPSHOT</version>
<version>1.5.4-SNAPSHOT</version>
<packaging>jar</packaging>

<name>HL7 FHIR Test Cases</name>
Expand Down
64 changes: 64 additions & 0 deletions r4b/structure-mapping/ActivityDefinition.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
map "http://hl7.org/fhir/StructureMap/ActivityDefinition3to4" = "R3 to R4 Conversions for ActivityDefinition"

uses "http://hl7.org/fhir/3.0/StructureDefinition/ActivityDefinition" alias ActivityDefinitionR3 as source
uses "http://hl7.org/fhir/StructureDefinition/ActivityDefinition" alias ActivityDefinition as target

imports "http://hl7.org/fhir/StructureMap/*3to4"

group ActivityDefinition(source src : ActivityDefinitionR3, target tgt : ActivityDefinition) extends DomainResource <<type+>> {
src.url -> tgt.url;
src.identifier -> tgt.identifier;
src.version -> tgt.version;
src.name -> tgt.name;
src.title -> tgt.title;
src.subtitle -> tgt.subtitle;
src.status -> tgt.status;
src.experimental -> tgt.experimental;
src.subject -> tgt.subject;
src.date -> tgt.date;
src.publisher -> tgt.publisher;
src.contact -> tgt.contact;
src.description -> tgt.description;
src.useContext -> tgt.useContext;
src.jurisdiction -> tgt.jurisdiction;
src.purpose -> tgt.purpose;
src.usage -> tgt.usage;
src.copyright -> tgt.copyright;
src.approvalDate -> tgt.approvalDate;
src.lastReviewDate -> tgt.lastReviewDate;
src.effectivePeriod -> tgt.effectivePeriod;
src.topic -> tgt.topic;
src.contributor as vs where type = 'author' -> tgt.author as vt then Contributor(vs, vt);
src.contributor as vs where type = 'editor' -> tgt.editor as vt then Contributor(vs, vt);
src.contributor as vs where type = 'reviewer' -> tgt.reviewer as vt then Contributor(vs, vt);
src.contributor as vs where type = 'endorser' -> tgt.endorser as vt then Contributor(vs, vt);
src.relatedArtifact -> tgt.relatedArtifact;
src.library -> tgt.library;
src.kind as v -> tgt.kind = translate(v, 'http://hl7.org/fhir/StructureMap/ConceptMaps3to4#ResourceTypeMap', 'code');
src.code -> tgt.code;
src.doNotPerform -> tgt.doNotPerform;
src.timing -> tgt.timing;
src.location -> tgt.location;
src.participant as s -> tgt.participant as t then ActivityDefinitionParticipant(s, t);
src.product -> tgt.product;
src.quantity -> tgt.quantity;
src.dosage -> tgt.dosage;
src.bodySite -> tgt.bodySite;
src.specimenRequirement -> tgt.specimenRequirement;
src.transform -> tgt.transform;
src.dynamicValue as s -> tgt.dynamicValue as t then ActivityDefinitionDynamicValue(s, t);
}

group ActivityDefinitionParticipant(source src, target tgt) extends BackboneElement {
src.type -> tgt.type;
src.role -> tgt.role;
}

group ActivityDefinitionDynamicValue(source src, target tgt) extends BackboneElement {
src.path -> tgt.path;
src as vs where vs.type.exists().not() -> tgt.expression = create('Expression') as vt then {
vs.description -> vt.description;
vs.language -> vt.language;
vs.expression -> vt.expression;
} "expression";
}
20 changes: 20 additions & 0 deletions r4b/structure-mapping/cast.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
map "http://ahdis.ch/matchbox/fml/cast" = "cast"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Observation" alias Observation as target

group qrtocobs(source src : QuestionnaireResponse, target tgt : Observation) {
src.extension as ext where (url = 'urn:implicitstring') then {
ext.value as value -> tgt.extension as ext, ext.url="urn:implicitstring", ext.value = value "item";
} "implictstring";
src.extension as ext where (url = 'urn:explicitstring') then {
ext.value as value -> tgt.extension as ext, ext.url="urn:explicitstring", ext.value = cast(value,'string') "item";
} "implictstring";
src.extension as ext where (url = 'urn:positiveInt') then {
ext.value as value -> tgt.extension as ext, ext.url="urn:positiveInt", ext.value = value "item";
} "positiveInt";
src.extension as ext where (url = 'urn:positiveIntString') then {
ext.value as value -> tgt.extension as ext, ext.url="urn:positiveIntString", ext.value = cast(value,'positiveInt') "item";
} "positiveInt";
}

13 changes: 13 additions & 0 deletions r4b/structure-mapping/manifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<fml-tests>
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2patassignment" source="qr.json" map="qr2pat-assignment.map" output="qr2pat-assignment-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2patgender" source="qr.json" map="qr2pat-gender.map" output="qr2pat-gender-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2pathumannametwice" source="qr.json" map="qr2pat-humannametwice.map" output="qr2pat-humannametwice-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2pathumannameshared" source="qr.json" map="qr2pat-humannameshared.map" output="qr2pat-humannameshared-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/reference" source="qr.json" map="qr2reference.map" output="qr2reference-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2pat-gender-conformstoqr" source="qr.json" map="qr2pat-gender-conformstoqr.map" output="qr2pat-gender-res.json" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2cda" source="qr.json" map="qr2cda.map" output="qr2cda-res.xml" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2cdaxsi" source="qr.json" map="qr2cdaxsi.map" output="qr2cdaxsi-res.xml" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2cd-eval-json" source="qr.json" map="qr2cda-eval.json" output="qr2cda-eval-res.xml" />
<test name="http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r5.tests/qr2cd-eval-fml" source="qr.json" map="qr2cda-eval.map" output="qr2cda-eval-res.xml" />

</fml-tests>
40 changes: 40 additions & 0 deletions r4b/structure-mapping/qr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"id" : "12345",
"resourceType": "QuestionnaireResponse",
"status": "in-progress",
"item": [
{
"linkId": "patient",
"text": "Patient",
"item": [
{
"linkId": "patient.lastname",
"text": "Name",
"answer": [
{
"valueString": "Brönnimann-Bertholet"
}
]
},
{
"linkId": "patient.firstname",
"text": "Vorname",
"answer": [
{
"valueString": "Elisabeth"
}
]
},
{
"linkId": "patient.sex",
"text": "Geschlecht",
"answer": [
{
"valueString": "female"
}
]
}
]
}
]
}
5 changes: 5 additions & 0 deletions r4b/structure-mapping/qr2cda-eval-res.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<ClinicalDocument xmlns="urn:hl7-org:v3-test">
<title>Hello CDA</title>
</ClinicalDocument>
50 changes: 50 additions & 0 deletions r4b/structure-mapping/qr2cda-eval.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"resourceType" : "StructureMap",
"url" : "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2cda",
"name" : "qr2cda",
"structure" : [{
"url" : "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse",
"mode" : "source",
"alias" : "QuestionnaireResponse"
},
{
"url" : "http://hl7.org/fhir/cdatest/StructureDefinition/ClinicalDocument",
"mode" : "target",
"alias" : "ClinicalDocument"
}],
"group" : [{
"name" : "QuestionnaireResponse",
"input" : [{
"name" : "src",
"type" : "QuestionnaireResponse",
"mode" : "source"
},
{
"name" : "tgt",
"type" : "ClinicalDocument",
"mode" : "target"
}],
"rule" : [{
"name" : "eval",
"source" : [{
"context" : "src"
}],
"target" : [{
"context" : "tgt",
"element" : "title",
"variable" : "title"
},
{
"context" : "title",
"element" : "data",
"transform" : "evaluate",
"parameter" : [{
"valueId" : "src"
},
{
"valueString" : "iif(src.is(QuestionnaireResponse), 'Hello CDA', 'badbadbad')"
}]
}]
}]
}]
}
8 changes: 8 additions & 0 deletions r4b/structure-mapping/qr2cda-eval.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2cda" = "qr2cda"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/cdatest/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : ClinicalDocument) {
src -> tgt.title as title, title.data= evaluate(src, iif(src.is(QuestionnaireResponse),"Hello CDA","badbadbad")) "eval";
}
5 changes: 5 additions & 0 deletions r4b/structure-mapping/qr2cda-res.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>

<ClinicalDocument xmlns="urn:hl7-org:v3-test">
<title>Hello CDA</title>
</ClinicalDocument>
8 changes: 8 additions & 0 deletions r4b/structure-mapping/qr2cda.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2cda" = "qr2cda"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/cdatest/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : ClinicalDocument) {
src -> tgt.title as title, title.data = 'Hello CDA' "hellocda";
}
5 changes: 5 additions & 0 deletions r4b/structure-mapping/qr2cdaxsi-res.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ClinicalDocument xmlns="urn:hl7-org:v3-test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<code code="1">
<translation xsi:type="CD" code="1" />
</code>
</ClinicalDocument>
9 changes: 9 additions & 0 deletions r4b/structure-mapping/qr2cdaxsi.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2cdaxsi" = "qr2cdaxsi"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/cdatest/StructureDefinition/ClinicalDocument" alias ClinicalDocument as target
uses "http://hl7.org/fhir/cdatest/StructureDefinition/CD" alias CD as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : ClinicalDocument) {
src -> tgt.code as code, code.code = "1", code.translation = create('CD') as translation, translation.code="1" "codes";
}
4 changes: 4 additions & 0 deletions r4b/structure-mapping/qr2pat-assignment-res.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"resourceType" : "Patient",
"gender" : "female"
}
8 changes: 8 additions & 0 deletions r4b/structure-mapping/qr2pat-assignment.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patassignment" = "qr2patassignment"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src -> tgt.gender = 'female' "Simple Assignment";
}
10 changes: 10 additions & 0 deletions r4b/structure-mapping/qr2pat-gender-conformstoqr.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pat-gender-conformstoqr" = "qr2pat-gender-conformstoqr"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target

// we want to check if source conformsTo works
group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src where conformsTo('http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse')-> tgt as patient, patient.gender = 'female' "conformsToCheck";
}

4 changes: 4 additions & 0 deletions r4b/structure-mapping/qr2pat-gender-res.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"resourceType" : "Patient",
"gender" : "female"
}
12 changes: 12 additions & 0 deletions r4b/structure-mapping/qr2pat-gender.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2patgender" = "qr2patgender"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target

group QuestionnaireResponse(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item -> tgt as patient then item(item, patient);
}

group item(source src, target tgt: Patient) {
src.item as item where linkId.value in ('patient.sex') -> tgt.gender = (item.answer.valueString);
}
8 changes: 8 additions & 0 deletions r4b/structure-mapping/qr2pat-humannameshared-res.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet",
"given" : ["Elisabeth"]
}],
"gender" : "female"
}
26 changes: 26 additions & 0 deletions r4b/structure-mapping/qr2pat-humannameshared.map
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
map "http://github.com/hapifhir/org.hl7.fhir.core/org.hl7.fhir.r4.tests/qr2pathumannameshared" = "qr2pathumannametwice"

uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" alias QuestionnaireResponse as source
uses "http://hl7.org/fhir/StructureDefinition/Patient" alias Patient as target

group entry(source src : QuestionnaireResponse, target tgt : Patient) {
src.item as item then item(item, tgt);
}

group item(source src, target tgt) {
src.item as item then item(item, tgt);
src.item as item where linkId.value = 'patient.lastname' -> tgt.name as name share patientName then humanNameFamily(item, name);
src.item as item where linkId.value = 'patient.firstname' -> tgt.name as name share patientName then humanNameGiven(item, name);
src.item as item where linkId.value = 'patient.sex' -> tgt.gender = (item.answer.valueString);
}

group humanNameFamily(source src, target tgt: HumanName) {
src.answer as answer -> tgt.family = (answer.valueString);
}
group humanNameGiven(source src, target tgt: HumanName) {
src.answer as answer -> tgt.given = (answer.valueString);
}

group administrativeGender(source src, target tgt: code) {
src.answer as answer -> tgt = (answer.valueString);
}
10 changes: 10 additions & 0 deletions r4b/structure-mapping/qr2pat-humannametwice-res.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"resourceType" : "Patient",
"name" : [{
"family" : "Brönnimann-Bertholet"
},
{
"given" : ["Elisabeth"]
}],
"gender" : "female"
}
Loading

0 comments on commit 81df9a9

Please sign in to comment.