This page is part of the Structured Data Capture FHIR IG (v4.0.0-ballot: STU 4 Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. The current version which supersedes this version is 3.0.0. For a full list of available versions, see the Directory of published versions
Page standards status: Trial-use | Maturity Level: 4 |
<StructureMap xmlns="http://hl7.org/fhir">
<id value="ExtractComplexSmap"/>
<text>
<status value="additional"/>
<div xmlns="http://www.w3.org/1999/xhtml">
<pre>/// url = "http://hl7.org/fhir/uv/sdc/StructureMap/ExtractComplexSmap"
/// name = "ExtractComplexSmap"
/// status = "active"
/// title = "Complex extraction structure map example"
/// description = "An example of a StructureMap used to support extraction from a QuestionnaireResponse"
/// experimental = "true"
map "http://hl7.org/fhir/uv/sdc/StructureMap/ExtractComplexSmap" = "ExtractComplexSmap"
uses "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse" as source
uses "http://hl7.org/fhir/StructureDefinition/Bundle" as target
uses "http://hl7.org/fhir/StructureDefinition/Patient" as target
uses "http://hl7.org/fhir/StructureDefinition/RelatedPerson" as target
uses "http://hl7.org/fhir/StructureDefinition/Observation" as target
uses "http://hl7.org/fhir/StructureDefinition/Coding" as target
group ExtractBundle(source src : QuestionnaireResponse, target tgt : Bundle) {
// Patient
src.item as patientItem where (linkId = 'patient') -> tgt.entry as patientEntry, uuid() as patientFullUrl then {
src -> patientEntry.resource = create('Patient') as pat //, pat.id = (%patientFullUrl)
then PopulatePatient(src, patientItem, pat), PopulateBundleEntry(src, patientEntry, patientFullUrl) "popPatient";
// Related Person(s)
src.item as rpItem where (linkId = 'contacts') -> tgt.entry as entry, uuid() as fullUrl then {
src -> entry.resource = create('RelatedPerson') as rp //, rp.id = (%fullUrl)
then PopulateRelatedPerson(src, rpItem, rp, patientFullUrl), PopulateBundleEntry(src, entry, fullUrl) "popRelatedPerson";
} "CreateRelatedPersonEntry";
src.item as obsItems where (linkId = 'obs') -> tgt then {
// Height Observation
obsItems.item as heightItem where (linkId = 'height') -> tgt.entry as entry, uuid() as fullUrl then {
src -> entry.resource = create('Observation') as obs,
cc('http://loinc.org', '8302-2', 'Body height') as coding,
obs.value = create('Quantity') as q, q.value = (%heightItem.answer.value.first()), q.unit = 'm'
then PopulateObservation(src, heightItem, obs, coding, patientFullUrl),
PopulateBundleEntry(src, entry, fullUrl) "popObs";
} "CreateHeightObsEntry";
// Weight Observation
obsItems.item as weightItem where (linkId = 'weight') -> tgt.entry as entry, uuid() as fullUrl then {
src -> entry.resource = create('Observation') as obs,
cc('http://loinc.org', '29463-7', 'Weight') as coding,
obs.value = create('Quantity') as q, q.value = (%weightItem.answer.value.first()), q.unit = 'kg'
then PopulateObservation(src, weightItem, obs, coding, patientFullUrl),
PopulateBundleEntry(src, entry, fullUrl) "popObs";
} "CreateWeightObsEntry";
// Prepare the bundle entry
obsItems.item as complicationItem where (linkId = 'complication') -> tgt.entry as entry, uuid() as fullUrl then {
src -> entry.resource = create('Observation') as obs,
cc('http://example.org/sdh/demo/CodeSystem/cc-screening-codes', 'sigmoidoscopy-complication') as coding,
obs.value = (%complicationItem.answer.value.first())
then PopulateObservation(src, complicationItem, obs, coding, patientFullUrl),
PopulateBundleEntry(src, entry, fullUrl) "popObs";
} "CreateComplicationObsEntry";
};
} "CreatePatientEntry";
}
group PopulateBundleEntry(source src : QuestionnaireResponse, target entry, target fullUrl) {
src -> entry.fullUrl = ('urn:uuid:' & %fullUrl) "SetFullUrl";
src -> entry.request as req then {
src -> req.method = 'POST' "setMethod";
} "SetRequest";
}
group PopulatePatient(source src: QuestionnaireResponse, source patientItem, target pat : Patient) {
patientItem.item as gender where (linkId = 'gender') -> pat.gender = (%gender.answer.value.first().code) "SetGender";
patientItem.item as dob where (linkId = 'dob') -> pat.birthDate = (%dob.answer.value) "SetBirthDate";
// name
patientItem.item as name where (linkId = 'name') -> pat.name as tgtName then {
name -> tgtName.text = (%name.item.where(linkId='given' or linkId='family').answer.value.join(' ')) "SetNameText";
name.item as family where (linkId = 'family') -> tgtName.family = (%family.answer.value) "SetFamily";
name.item as given where (linkId = 'given') then {
given.answer as answer -> tgtName.given = (%answer.value) "AnswerValue";
} "SetGiven";
} "SetName";
// identifier
patientItem.item as itemIdentifier where (linkId = 'ihi') -> pat.identifier as tgtIdentifier then {
itemIdentifier -> tgtIdentifier.type as t, t.text = 'National Identifier (IHI)' "SetIdentifierType";
itemIdentifier -> tgtIdentifier.system = 'http://example.org/nhio' "SetIdentifierSystem";
itemIdentifier -> tgtIdentifier.value = (%itemIdentifier.answer.value) "SetIdentifierValue";
} "SetIdentifier";
// telecom
patientItem.item as itemMobile where (linkId = 'mobile-phone') -> pat.telecom as t, t.system='phone', t.value = (%itemMobile.answer.value), t.use = 'mobile' "SetTelecom";
}
group PopulateRelatedPerson(source src: QuestionnaireResponse, source rpItem, target rp : RelatedPerson, target patientFullUrl) {
rpItem -> rp.patient as p, p.reference = (%patientFullUrl) "SetPatientRef";
rpItem.item as name where (linkId = 'contact-name') -> rp.name as n, n.text = (%name.answer.value) "SetName";
rpItem.item as rel where (linkId = 'relationship') -> rp.relationship as r, r.coding = (%rel.answer.value) "SetRelationship";
rpItem.item as phone where (linkId = 'phone') -> rp.telecom as t, t.system = 'phone', t.value = (%phone.answer.value), t.use = 'mobile' "SetPhone";
}
group PopulateObservation(source src : QuestionnaireResponse, source complicationItem, target tgt : Observation, target coding : Coding, target patientFullUrl) {
src -> tgt.code = (%coding) "SetObservationCode";
src -> tgt.status = 'final' "SetStatus";
// src.subject as s -> tgt.subject = s; // not using the the subject, as this is intended to be created from the data instead (as is outgoing referral)
src.subject as s -> tgt.subject as p, p.reference = (%patientFullUrl) "SetSubjectRef";
src.authored as s -> tgt.issued = s "SetAuthored";
src.authored as s -> tgt.effective = s "SetEffective";
src.author as s -> tgt.performer = s;
src.id -> tgt.derivedFrom as df, df.reference = ('QuestionnaireResponse/' & %src.id) "SetDerivedFrom";
}</pre>
</div>
</text>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
<valueCode value="fhir"/>
</extension>
<url value="http://hl7.org/fhir/uv/sdc/StructureMap/ExtractComplexSmap"/>
<identifier>
<system value="urn:ietf:rfc:3986"/>
<value value="urn:oid:2.16.840.1.113883.4.642.40.17.43.3"/>
</identifier>
<version value="4.0.0-ballot"/>
<name value="ExtractComplexSmap"/>
<status value="draft"/>
<date value="2024-12-17T01:55:34+00:00"/>
<publisher value="HL7 International / FHIR Infrastructure"/>
<contact>
<name value="HL7 International / FHIR Infrastructure"/>
<telecom>
<system value="url"/>
<value value="http://www.hl7.org/Special/committees/fiwg"/>
</telecom>
</contact>
<contact>
<telecom>
<system value="url"/>
<value value="http://www.hl7.org/Special/committees/fiwg"/>
</telecom>
</contact>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
<display value="World"/>
</coding>
</jurisdiction>
<structure>
<url
value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
<mode value="source"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
<mode value="target"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<mode value="target"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/RelatedPerson"/>
<mode value="target"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
<mode value="target"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/StructureDefinition/Coding"/>
<mode value="target"/>
</structure>
<group>
<name value="ExtractBundle"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="QuestionnaireResponse"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Bundle"/>
<mode value="target"/>
</input>
<rule>
<name value="CreatePatientEntry"/>
<source>
<context value="src"/>
<element value="item"/>
<variable value="patientItem"/>
<condition value="(linkId = 'patient')"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="patientEntry"/>
</target>
<target>
<contextType value="variable"/>
<variable value="patientFullUrl"/>
<transform value="uuid"/>
</target>
<rule>
<name value="popPatient"/>
<source>
<context value="src"/>
</source>
<target>
<context value="patientEntry"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="pat"/>
<transform value="create"/>
<parameter>
<valueString value="Patient"/>
</parameter>
</target>
<dependent>
<name value="PopulatePatient"/>
<variable value="src"/>
<variable value="patientItem"/>
<variable value="pat"/>
</dependent>
<dependent>
<name value="PopulateBundleEntry"/>
<variable value="src"/>
<variable value="patientEntry"/>
<variable value="patientFullUrl"/>
</dependent>
</rule>
<rule>
<name value="CreateRelatedPersonEntry"/>
<source>
<context value="src"/>
<element value="item"/>
<variable value="rpItem"/>
<condition value="(linkId = 'contacts')"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<contextType value="variable"/>
<variable value="fullUrl"/>
<transform value="uuid"/>
</target>
<rule>
<name value="popRelatedPerson"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="rp"/>
<transform value="create"/>
<parameter>
<valueString value="RelatedPerson"/>
</parameter>
</target>
<dependent>
<name value="PopulateRelatedPerson"/>
<variable value="src"/>
<variable value="rpItem"/>
<variable value="rp"/>
<variable value="patientFullUrl"/>
</dependent>
<dependent>
<name value="PopulateBundleEntry"/>
<variable value="src"/>
<variable value="entry"/>
<variable value="fullUrl"/>
</dependent>
</rule>
</rule>
<rule>
<name value="item"/>
<source>
<context value="src"/>
<element value="item"/>
<variable value="obsItems"/>
<condition value="(linkId = 'obs')"/>
</source>
<target>
<contextType value="variable"/>
<transform value="copy"/>
<parameter>
<valueId value="tgt"/>
</parameter>
</target>
<rule>
<name value="CreateHeightObsEntry"/>
<source>
<context value="obsItems"/>
<element value="item"/>
<variable value="heightItem"/>
<condition value="(linkId = 'height')"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<contextType value="variable"/>
<variable value="fullUrl"/>
<transform value="uuid"/>
</target>
<rule>
<name value="popObs"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<target>
<contextType value="variable"/>
<variable value="coding"/>
<transform value="cc"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
<parameter>
<valueString value="8302-2"/>
</parameter>
<parameter>
<valueString value="Body height"/>
</parameter>
</target>
<target>
<context value="obs"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="q"/>
<transform value="create"/>
<parameter>
<valueString value="Quantity"/>
</parameter>
</target>
<target>
<context value="q"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%heightItem.answer.value.first()"/>
</parameter>
</target>
<target>
<context value="q"/>
<contextType value="variable"/>
<element value="unit"/>
<transform value="copy"/>
<parameter>
<valueString value="m"/>
</parameter>
</target>
<dependent>
<name value="PopulateObservation"/>
<variable value="src"/>
<variable value="heightItem"/>
<variable value="obs"/>
<variable value="coding"/>
<variable value="patientFullUrl"/>
</dependent>
<dependent>
<name value="PopulateBundleEntry"/>
<variable value="src"/>
<variable value="entry"/>
<variable value="fullUrl"/>
</dependent>
</rule>
</rule>
<rule>
<name value="CreateWeightObsEntry"/>
<source>
<context value="obsItems"/>
<element value="item"/>
<variable value="weightItem"/>
<condition value="(linkId = 'weight')"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<contextType value="variable"/>
<variable value="fullUrl"/>
<transform value="uuid"/>
</target>
<rule>
<name value="popObs"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<target>
<contextType value="variable"/>
<variable value="coding"/>
<transform value="cc"/>
<parameter>
<valueString value="http://loinc.org"/>
</parameter>
<parameter>
<valueString value="29463-7"/>
</parameter>
<parameter>
<valueString value="Weight"/>
</parameter>
</target>
<target>
<context value="obs"/>
<contextType value="variable"/>
<element value="value"/>
<variable value="q"/>
<transform value="create"/>
<parameter>
<valueString value="Quantity"/>
</parameter>
</target>
<target>
<context value="q"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%weightItem.answer.value.first()"/>
</parameter>
</target>
<target>
<context value="q"/>
<contextType value="variable"/>
<element value="unit"/>
<transform value="copy"/>
<parameter>
<valueString value="kg"/>
</parameter>
</target>
<dependent>
<name value="PopulateObservation"/>
<variable value="src"/>
<variable value="weightItem"/>
<variable value="obs"/>
<variable value="coding"/>
<variable value="patientFullUrl"/>
</dependent>
<dependent>
<name value="PopulateBundleEntry"/>
<variable value="src"/>
<variable value="entry"/>
<variable value="fullUrl"/>
</dependent>
</rule>
</rule>
<rule>
<name value="CreateComplicationObsEntry"/>
<source>
<context value="obsItems"/>
<element value="item"/>
<variable value="complicationItem"/>
<condition value="(linkId = 'complication')"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="entry"/>
<variable value="entry"/>
</target>
<target>
<contextType value="variable"/>
<variable value="fullUrl"/>
<transform value="uuid"/>
</target>
<rule>
<name value="popObs"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="resource"/>
<variable value="obs"/>
<transform value="create"/>
<parameter>
<valueString value="Observation"/>
</parameter>
</target>
<target>
<contextType value="variable"/>
<variable value="coding"/>
<transform value="cc"/>
<parameter>
<valueString
value="http://example.org/sdh/demo/CodeSystem/cc-screening-codes"/>
</parameter>
<parameter>
<valueString value="sigmoidoscopy-complication"/>
</parameter>
</target>
<target>
<context value="obs"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%complicationItem.answer.value.first()"/>
</parameter>
</target>
<dependent>
<name value="PopulateObservation"/>
<variable value="src"/>
<variable value="complicationItem"/>
<variable value="obs"/>
<variable value="coding"/>
<variable value="patientFullUrl"/>
</dependent>
<dependent>
<name value="PopulateBundleEntry"/>
<variable value="src"/>
<variable value="entry"/>
<variable value="fullUrl"/>
</dependent>
</rule>
</rule>
</rule>
</rule>
</group>
<group>
<name value="PopulateBundleEntry"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="QuestionnaireResponse"/>
<mode value="source"/>
</input>
<input>
<name value="entry"/>
<mode value="target"/>
</input>
<input>
<name value="fullUrl"/>
<mode value="target"/>
</input>
<rule>
<name value="SetFullUrl"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="fullUrl"/>
<transform value="evaluate"/>
<parameter>
<valueString value="'urn:uuid:' & %fullUrl"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetRequest"/>
<source>
<context value="src"/>
</source>
<target>
<context value="entry"/>
<contextType value="variable"/>
<element value="request"/>
<variable value="req"/>
</target>
<rule>
<name value="setMethod"/>
<source>
<context value="src"/>
</source>
<target>
<context value="req"/>
<contextType value="variable"/>
<element value="method"/>
<transform value="copy"/>
<parameter>
<valueString value="POST"/>
</parameter>
</target>
</rule>
</rule>
</group>
<group>
<name value="PopulatePatient"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="QuestionnaireResponse"/>
<mode value="source"/>
</input>
<input>
<name value="patientItem"/>
<mode value="source"/>
</input>
<input>
<name value="pat"/>
<type value="Patient"/>
<mode value="target"/>
</input>
<rule>
<name value="SetGender"/>
<source>
<context value="patientItem"/>
<element value="item"/>
<variable value="gender"/>
<condition value="(linkId = 'gender')"/>
</source>
<target>
<context value="pat"/>
<contextType value="variable"/>
<element value="gender"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%gender.answer.value.first().code"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetBirthDate"/>
<source>
<context value="patientItem"/>
<element value="item"/>
<variable value="dob"/>
<condition value="(linkId = 'dob')"/>
</source>
<target>
<context value="pat"/>
<contextType value="variable"/>
<element value="birthDate"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%dob.answer.value"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetName"/>
<source>
<context value="patientItem"/>
<element value="item"/>
<variable value="name"/>
<condition value="(linkId = 'name')"/>
</source>
<target>
<context value="pat"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="tgtName"/>
</target>
<rule>
<name value="SetNameText"/>
<source>
<context value="name"/>
</source>
<target>
<context value="tgtName"/>
<contextType value="variable"/>
<element value="text"/>
<transform value="evaluate"/>
<parameter>
<valueString
value="%name.item.where((linkId = 'given') or (linkId = 'family')).answer.value.join(' ')"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetFamily"/>
<source>
<context value="name"/>
<element value="item"/>
<variable value="family"/>
<condition value="(linkId = 'family')"/>
</source>
<target>
<context value="tgtName"/>
<contextType value="variable"/>
<element value="family"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%family.answer.value"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetGiven"/>
<source>
<context value="name"/>
<element value="item"/>
<variable value="given"/>
<condition value="(linkId = 'given')"/>
</source>
<rule>
<name value="AnswerValue"/>
<source>
<context value="given"/>
<element value="answer"/>
<variable value="answer"/>
</source>
<target>
<context value="tgtName"/>
<contextType value="variable"/>
<element value="given"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%answer.value"/>
</parameter>
</target>
</rule>
</rule>
</rule>
<rule>
<name value="SetIdentifier"/>
<source>
<context value="patientItem"/>
<element value="item"/>
<variable value="itemIdentifier"/>
<condition value="(linkId = 'ihi')"/>
</source>
<target>
<context value="pat"/>
<contextType value="variable"/>
<element value="identifier"/>
<variable value="tgtIdentifier"/>
</target>
<rule>
<name value="SetIdentifierType"/>
<source>
<context value="itemIdentifier"/>
</source>
<target>
<context value="tgtIdentifier"/>
<contextType value="variable"/>
<element value="type"/>
<variable value="t"/>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="text"/>
<transform value="copy"/>
<parameter>
<valueString value="National Identifier (IHI)"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetIdentifierSystem"/>
<source>
<context value="itemIdentifier"/>
</source>
<target>
<context value="tgtIdentifier"/>
<contextType value="variable"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="http://example.org/nhio"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetIdentifierValue"/>
<source>
<context value="itemIdentifier"/>
</source>
<target>
<context value="tgtIdentifier"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%itemIdentifier.answer.value"/>
</parameter>
</target>
</rule>
</rule>
<rule>
<name value="SetTelecom"/>
<source>
<context value="patientItem"/>
<element value="item"/>
<variable value="itemMobile"/>
<condition value="(linkId = 'mobile-phone')"/>
</source>
<target>
<context value="pat"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="t"/>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="phone"/>
</parameter>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%itemMobile.answer.value"/>
</parameter>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="use"/>
<transform value="copy"/>
<parameter>
<valueString value="mobile"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="PopulateRelatedPerson"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="QuestionnaireResponse"/>
<mode value="source"/>
</input>
<input>
<name value="rpItem"/>
<mode value="source"/>
</input>
<input>
<name value="rp"/>
<type value="RelatedPerson"/>
<mode value="target"/>
</input>
<input>
<name value="patientFullUrl"/>
<mode value="target"/>
</input>
<rule>
<name value="SetPatientRef"/>
<source>
<context value="rpItem"/>
</source>
<target>
<context value="rp"/>
<contextType value="variable"/>
<element value="patient"/>
<variable value="p"/>
</target>
<target>
<context value="p"/>
<contextType value="variable"/>
<element value="reference"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%patientFullUrl"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetName"/>
<source>
<context value="rpItem"/>
<element value="item"/>
<variable value="name"/>
<condition value="(linkId = 'contact-name')"/>
</source>
<target>
<context value="rp"/>
<contextType value="variable"/>
<element value="name"/>
<variable value="n"/>
</target>
<target>
<context value="n"/>
<contextType value="variable"/>
<element value="text"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%name.answer.value"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetRelationship"/>
<source>
<context value="rpItem"/>
<element value="item"/>
<variable value="rel"/>
<condition value="(linkId = 'relationship')"/>
</source>
<target>
<context value="rp"/>
<contextType value="variable"/>
<element value="relationship"/>
<variable value="r"/>
</target>
<target>
<context value="r"/>
<contextType value="variable"/>
<element value="coding"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%rel.answer.value"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetPhone"/>
<source>
<context value="rpItem"/>
<element value="item"/>
<variable value="phone"/>
<condition value="(linkId = 'phone')"/>
</source>
<target>
<context value="rp"/>
<contextType value="variable"/>
<element value="telecom"/>
<variable value="t"/>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="system"/>
<transform value="copy"/>
<parameter>
<valueString value="phone"/>
</parameter>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="value"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%phone.answer.value"/>
</parameter>
</target>
<target>
<context value="t"/>
<contextType value="variable"/>
<element value="use"/>
<transform value="copy"/>
<parameter>
<valueString value="mobile"/>
</parameter>
</target>
</rule>
</group>
<group>
<name value="PopulateObservation"/>
<typeMode value="none"/>
<input>
<name value="src"/>
<type value="QuestionnaireResponse"/>
<mode value="source"/>
</input>
<input>
<name value="complicationItem"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="Observation"/>
<mode value="target"/>
</input>
<input>
<name value="coding"/>
<type value="Coding"/>
<mode value="target"/>
</input>
<input>
<name value="patientFullUrl"/>
<mode value="target"/>
</input>
<rule>
<name value="SetObservationCode"/>
<source>
<context value="src"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="code"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%coding"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetStatus"/>
<source>
<context value="src"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="final"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetSubjectRef"/>
<source>
<context value="src"/>
<element value="subject"/>
<variable value="s"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="subject"/>
<variable value="p"/>
</target>
<target>
<context value="p"/>
<contextType value="variable"/>
<element value="reference"/>
<transform value="evaluate"/>
<parameter>
<valueString value="%patientFullUrl"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetAuthored"/>
<source>
<context value="src"/>
<element value="authored"/>
<variable value="s"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="issued"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetEffective"/>
<source>
<context value="src"/>
<element value="authored"/>
<variable value="s"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="effective"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
<rule>
<name value="author"/>
<source>
<context value="src"/>
<element value="author"/>
<variable value="s"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="performer"/>
<transform value="copy"/>
<parameter>
<valueId value="s"/>
</parameter>
</target>
</rule>
<rule>
<name value="SetDerivedFrom"/>
<source>
<context value="src"/>
<element value="id"/>
</source>
<target>
<context value="tgt"/>
<contextType value="variable"/>
<element value="derivedFrom"/>
<variable value="df"/>
</target>
<target>
<context value="df"/>
<contextType value="variable"/>
<element value="reference"/>
<transform value="evaluate"/>
<parameter>
<valueString value="'QuestionnaireResponse/' & %src.id"/>
</parameter>
</target>
</rule>
</group>
</StructureMap>