Guia de implementação do Sumário Internacional do Paciente: Release 1 - BR Realm | STU1
1.0.0 - STU1
This page is part of the IPS Brasil (v1.0.0: Release) based on FHIR (HL7® FHIR® Standard) R4. This is the current published version. For a full list of available versions, see the Directory of published versions
URL Canônica: https://ips.saude.gov.br/fhir/StructureMap/StructureMapBRIPS | Versão: 1.0.0 | |||
Draft as of 2024-12-23 | Nome computável: StructureMapBRIPS |
Mapeamento de Bundle da RNDS para o IPS
Generated Narrative: StructureMap StructureMapBRIPS
map "https://ips.saude.gov.br/fhir/StructureMap/StructureMapBRIPS" = "StructureMapBRIPS" // Mapeamento de Bundle da RNDS para o IPS uses "http://hl7.org/fhir/StructureDefinition/Bundle" alias TLeft as source uses "http://hl7.org/fhir/uv/ips/StructureDefinition/Bundle-uv-ips" alias TRight as target group RNDSIPSBundle(source src : TLeft, target tgt : TRight) { src.id as RNDSID -> tgt as IPS then { RNDSID -> tgt.identifier as IPSIdentifier then { RNDSID -> IPS.type = 'document', IPS.timestamp = (now()), IPSIdentifier.system = 'urn:ietf:rfc:3986', uuid() as uuid, IPSIdentifier.value = append('urn:uuid:', uuid) "SetDocumentTypeAndTimestampAndIdentifier"; } "SetMetaData"; } "SetBundleMetaData"; src.entry default "empty" as RNDSEntry -> tgt.entry as IPSEntry, tgt.entry as IPSEntryCondition, tgt.entry as IPSEntryAllergyIntolerance, tgt.entry as IPSEntryMedicationStatement, uuid() as IPSPatientReference, uuid() as IPSPractitionerReference, uuid() as IPSConditionNoKnownProblemsReference, uuid() as IPSMedicationStatementNoKnownMedicationsReference, uuid() as IPSAllergyIntoleranceNoKnownAllergiesReference, uuid() as IPSVitalSignsNoKnownVitalSignsReference then { RNDSEntry where (RNDSEntry = 'empty') -> IPSEntry then { RNDSEntry -> uuid() as uuid, IPSEntry.fullUrl = append('urn:uuid:', uuid) "SetFullUrl"; RNDSEntry -> create('Composition') as IPSComposition then { RNDSEntry -> IPSComposition.status = 'final', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '60591-5', c.display = 'Patient Summary Document', cc.coding = c, IPSComposition.type = cc, IPSComposition.date = (now()), IPSComposition.id = uuid(), (today()) as today, IPSComposition.title = append('Patient Summary as of:', today), IPSComposition.confidentiality = 'N', IPSComposition.text as IPSCompositionText, IPSCompositionText.status = 'generated', IPSCompositionText.div = append('<div xmlns=\"http://www.w3.org/1999/xhtml\">Title: International Patient Summary from Brazil, code: http://loinc.org#60591-5, status: generated, confidentiality: N</div>') "SetCompositionFirstOrderFields"; RNDSEntry -> IPSComposition.subject as IPSCompositionSubject, IPSComposition.author as IPSCompositionAuthor, IPSComposition.custodian as IPSCompositionCustodian, IPSComposition.section as IPSCompositionSectionActiveProblems, IPSComposition.section as IPSCompositionMedication, IPSComposition.section as IPSCompositionAllergiesAndIntolerances, IPSComposition.section as IPSCompositionVitalSigns then { RNDSEntry -> IPSCompositionSubject.reference = append('urn:uuid:', IPSPatientReference), IPSCompositionAuthor.reference = append('urn:uuid:', IPSPractitionerReference), IPSCompositionCustodian.reference = append('urn:uuid:', IPSPractitionerReference) "SetReferences"; RNDSEntry -> IPSCompositionSectionActiveProblems.title = 'Active Problems', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '11450-4', c.display = 'Problem list Reported', cc.coding = c, IPSCompositionSectionActiveProblems.code = cc, IPSCompositionSectionActiveProblems.entry as IPSCompositionSectionActiveProblemsEntry, IPSCompositionSectionActiveProblemsEntry.reference = append('urn:uuid:', IPSConditionNoKnownProblemsReference) "SetActiveProblems"; RNDSEntry -> IPSCompositionMedication.title = 'Medications', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '10160-0', c.display = 'History of Medication use Narrative', cc.coding = c, IPSCompositionMedication.code = cc, IPSCompositionMedication.entry as IPSCompositionSectionMedicationEntry, IPSCompositionSectionMedicationEntry.reference = append('urn:uuid:', IPSMedicationStatementNoKnownMedicationsReference) "SetTitleMedications"; RNDSEntry -> IPSCompositionAllergiesAndIntolerances.title = 'Allergies and Intolerances', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '48765-2', c.display = 'Allergies and adverse reactions Document', cc.coding = c, IPSCompositionAllergiesAndIntolerances.code = cc, IPSCompositionAllergiesAndIntolerances.entry as IPSCompositionSectionAllergiesAndIntolerancesEntry, IPSCompositionSectionAllergiesAndIntolerancesEntry.reference = append('urn:uuid:', IPSAllergyIntoleranceNoKnownAllergiesReference) "SetAllergiesAndIntolerances"; RNDSEntry -> IPSCompositionVitalSigns.title = 'Vital Signs', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '8716-3', c.display = 'Vital signs', cc.coding = c, IPSCompositionVitalSigns.code = cc, IPSCompositionVitalSigns.entry as IPSCompositionVitalSignsEntry, IPSCompositionVitalSignsEntry.reference = append('urn:uuid:', IPSVitalSignsNoKnownVitalSignsReference) "SetVitalSigns"; } "SetSubjectAuthorCustodianSection"; RNDSEntry -> IPSEntry.resource = IPSComposition "SetResourceComposition"; } "SetComposition"; } "SetEmptyComposition"; RNDSEntry where (RNDSEntry = 'empty') -> IPSEntryCondition then { RNDSEntry -> uuid() as uuid, IPSEntryCondition.fullUrl = append('urn:uuid:', uuid) "SetFullUrl"; RNDSEntry -> create('Condition') as IPSCondition then { RNDSEntry -> create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical', c.code = 'active', cc.coding = c, IPSCondition.clinicalStatus = cc "SetClinicalStatus"; RNDSEntry -> create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-problem-info', c.display = 'No information about problems', cc.coding = c, IPSCondition.code = cc "SetCode"; RNDSEntry -> create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://terminology.hl7.org/CodeSystem/condition-ver-status', c.code = 'confirmed', c.display = 'Confirmed', cc.coding = c, IPSCondition.verificationStatus = cc "SetCode"; RNDSEntry -> IPSCondition.subject as IPSConditionSubject, IPSConditionSubject.reference = append('urn:uuid:', IPSPatientReference) "SetSubject"; RNDSEntry -> IPSEntryCondition.resource as IPSEntryConditionResource, IPSEntryConditionResource.text as IPSEntryConditionResourceText, IPSEntryConditionResourceText.status = 'generated', IPSCondition.code as IPSConditionCode, IPSConditionCode.coding as IPSConditionCodeCoding, IPSConditionCodeCoding.code as IPSConditionCodeCodingCode, IPSCondition.clinicalStatus as IPSConditionClinicalStatus, IPSConditionClinicalStatus.coding as IPSConditionClinicalStatusCoding, IPSConditionClinicalStatusCoding.code as IPSConditionClinicalStatusCodingCode, IPSCondition.verificationStatus as IPSConditionVerificationStatus, IPSConditionVerificationStatus.coding as IPSConditionVerificationStatusCoding, IPSConditionVerificationStatusCoding.code as IPSConditionVerificationStatusCodingCode, IPSEntryConditionResourceText.div = append('<div xmlns=\"http://www.w3.org/1999/xhtml\">Condition', IPSConditionCodeCodingCode, ',clinicalStatus:', IPSConditionClinicalStatusCodingCode, ',verificationStatus:', IPSConditionVerificationStatusCodingCode, '</div>') "SetConditionNarrativeElement"; RNDSEntry -> IPSEntryCondition.resource = IPSCondition "SetCondition"; } "SetCondition"; } "SetEmptyCondition"; RNDSEntry where (RNDSEntry = 'empty') -> IPSEntryAllergyIntolerance then { RNDSEntry -> uuid() as uuid, IPSEntryAllergyIntolerance.fullUrl = append('urn:uuid:', uuid) "SetFullUrl"; RNDSEntry -> create('AllergyIntolerance') as IPSAllergyIntolerance then { RNDSEntry -> create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical', c.code = 'active', cc.coding = c, IPSAllergyIntolerance.clinicalStatus = cc "SetClinicalStatus"; RNDSEntry -> create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-allergy-info', c.display = 'No information about allergies', create('CodeableConcept') as cc, cc.coding = c, IPSAllergyIntolerance.code = cc "SetCode"; RNDSEntry -> IPSAllergyIntolerance.patient as IPSAllergyIntolerancePatient, IPSAllergyIntolerancePatient.reference = append('urn:uuid:', IPSPatientReference) "SetPatient"; RNDSEntry -> IPSEntryAllergyIntolerance.resource = IPSAllergyIntolerance "SetAllergyIntolerance"; RNDSEntry -> IPSAllergyIntolerance.text as IPSAllergyIntoleranceText, IPSAllergyIntoleranceText.status = 'generated', IPSAllergyIntoleranceText.div = '<div xmlns=\"http://www.w3.org/1999/xhtml\">No allergy information</div>' "SetAllergyText"; } "SetAllergyIntolerance"; } "SetEmptyAllergyIntolerance"; RNDSEntry where (RNDSEntry = 'empty') -> IPSEntryMedicationStatement then { RNDSEntry -> create('MedicationStatement') as IPSMedicationStatement then { RNDSEntry -> IPSMedicationStatement.status = 'unknown' "SetStatus"; RNDSEntry -> create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-medication-info', c.display = 'No information about medications', create('CodeableConcept') as cc, cc.coding = c, IPSMedicationStatement.medication = cc "SetCode"; RNDSEntry -> IPSMedicationStatement.effectivePeriod as IPSMedicationStatementEffectivePeriod then NotApplicable(RNDSEntry, IPSMedicationStatementEffectivePeriod) "SetEffectivePeriod"; RNDSEntry -> IPSMedicationStatement.subject as IPSMedicationStatementSubject, IPSMedicationStatementSubject.reference = append('urn:uuid:', IPSPatientReference) "SetSubject"; RNDSEntry -> uuid() as uuid, IPSEntryMedicationStatement.fullUrl = append('urn:uuid:', uuid), IPSEntryMedicationStatement.resource = IPSMedicationStatement "SetMedicationStatement"; } "SetMedicationStatement"; } "SetEmptyMedicationStatement"; } "SetEmptyIPSEntries"; src.entry as RNDSEntry -> tgt.entry as IPSEntry, tgt.entry as IPSEntryCondition, tgt.entry as IPSEntryVitalSigns, tgt.entry as IPSEntryResults, tgt.entry as IPSEntrySpecimen, tgt.entry as IPSEntryImmunization, tgt.entry as IPSEntryProcedures, tgt.entry as IPSEntryMedicationRequests, tgt.entry as IPSEntryMedications, tgt.entry as IPSEntryAllergyIntolerance, tgt.entry as IPSEntryMedicationStatement, tgt.entry as IPSEntryPatient, tgt.entry as IPSEntryPractitioner, tgt.entry as IPSEntryCustodian, uuid() as IPSPatientReference, uuid() as IPSPractitionerReference then { RNDSEntry.resource as RNDSEntryResource -> create('Composition') as IPSEntryResourceComposition then { RNDSEntry -> IPSEntryResourceComposition.status = 'final', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '60591-5', c.display = 'Patient Summary Document', cc.coding = c, IPSEntryResourceComposition.type = cc, IPSEntryResourceComposition.date = (now()), IPSEntryResourceComposition.id = uuid(), (today()) as today, IPSEntryResourceComposition.title = append('Patient Summary as of', today), IPSEntryResourceComposition.confidentiality = 'N', IPSEntryResourceComposition.text as IPSEntryResourceCompositionText, IPSEntryResourceCompositionText.status = 'generated', IPSEntryResourceCompositionText.div = append('<div xmlns=\"http://www.w3.org/1999/xhtml\">Title: International Patient Summary from Brazil, code: http://loinc.org#60591-5, status: generated, confidentiality: N</div>') "SetCompositionFirstOrderFields"; RNDSEntryResource -> IPSEntryResourceComposition.subject as IPSEntryResourceCompositionSubject, IPSEntryResourceComposition.author as IPSEntryResourceCompositionPractitioner, IPSEntryResourceComposition.custodian as IPSEntryResourceCompositionCustodian, IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionActiveProblems, IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionMedications, IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionAllergiesAndIntolerances, IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionResults, IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionVitalSigns then { // Bloco que seta as referencias a subject, practitioner e custodian no composition RNDSEntryResource -> IPSEntryResourceCompositionSubject.reference = append('urn:uuid:', IPSPatientReference), IPSEntryResourceCompositionPractitioner.reference = append('urn:uuid:', IPSPractitionerReference), IPSEntryResourceCompositionCustodian.reference = append('urn:uuid:', IPSPractitionerReference) "SetResourceCompositionReferences"; // Bloco que cria a secao de problemas no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionActiveProblems.title = 'Active Problems', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '11450-4', c.display = 'Problem list Reported', cc.coding = c, IPSEntryResourceCompositionSectionActiveProblems.code = cc "SetActiveProblems"; // Bloco que cria condition vazio quando nao ha conditions no bundle RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRCondicaoSaude').empty()) -> create('Condition') as IPSEntryEmptyCondition, uuid() as IPSEntryEmptyConditionId, IPSEntryEmptyCondition.id = IPSEntryEmptyConditionId, create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://terminology.hl7.org/CodeSystem/condition-clinical', c.code = 'active', cc.coding = c, IPSEntryEmptyCondition.clinicalStatus = cc, create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-problem-info', c.display = 'No information about problems', create('CodeableConcept') as cc, cc.coding = c, IPSEntryEmptyCondition.code = cc, IPSEntryEmptyCondition.subject as IPSEntryEmptyConditionSubject, IPSEntryEmptyConditionSubject.reference = append('urn:uuid:', IPSPatientReference), IPSEntryCondition.fullUrl = append('urn:uuid:', IPSEntryEmptyConditionId), IPSEntryCondition.resource = IPSEntryEmptyCondition, IPSEntryResourceCompositionSectionActiveProblems.entry as IPSEntryResourceCompositionSectionActiveProblemsEntry, IPSEntryResourceCompositionSectionActiveProblemsEntry.reference = append('urn:uuid:', IPSEntryEmptyConditionId) "CreateNoKnownConditions"; // Bloco que cria a secao de alergias no composition RNDSEntry -> IPSEntryResourceCompositionSectionAllergiesAndIntolerances.title = 'Allergies and Intolerances', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '48765-2', c.display = 'Allergies and adverse reactions Document', cc.coding = c, IPSEntryResourceCompositionSectionAllergiesAndIntolerances.code = cc "SetAllergiesAndIntolerances"; // Bloco que cria o Allergy Intolerance vazio quando nao ha allergy intolerance no bundle RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRAlergiaReacaoAdversa').empty()) -> create('AllergyIntolerance') as IPSEntryEmptyAllergyIntolerance, uuid() as IPSEntryEmptyAllergyIntoleranceId, IPSEntryEmptyAllergyIntolerance.id = IPSEntryEmptyAllergyIntoleranceId, create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical', c.code = 'active', cc.coding = c, IPSEntryEmptyAllergyIntolerance.clinicalStatus = cc, create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-allergy-info', c.display = 'No information about allergies', create('CodeableConcept') as cc, cc.coding = c, IPSEntryEmptyAllergyIntolerance.code = cc, IPSEntryEmptyAllergyIntolerance.patient as IPSEntryEmptyAllergyIntolerancePatient, IPSEntryEmptyAllergyIntolerancePatient.reference = append('urn:uuid:', IPSPatientReference), IPSEntryEmptyAllergyIntolerance.text as IPSEntryEmptyAllergyIntoleranceText, IPSEntryEmptyAllergyIntoleranceText.status = 'generated', IPSEntryEmptyAllergyIntoleranceText.div = '<div xmlns=\"http://www.w3.org/1999/xhtml\">No known allergies</div>', IPSEntryAllergyIntolerance.fullUrl = append('urn:uuid:', IPSEntryEmptyAllergyIntoleranceId), IPSEntryAllergyIntolerance.resource = IPSEntryEmptyAllergyIntolerance, IPSEntryResourceCompositionSectionAllergiesAndIntolerances.entry as IPSEntryResourceCompositionSectionAllergiesAndIntolerancesEntry, IPSEntryResourceCompositionSectionAllergiesAndIntolerancesEntry.reference = append('urn:uuid:', IPSEntryEmptyAllergyIntoleranceId) "CreateNoKnownConditions"; // Bloco que cria Medication Statement vazio quando nao ha medication statement no bundle RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRMedicamento').empty()) -> create('MedicationStatement') as IPSEntryEmptyMedicationStatement, uuid() as IPSEntryEmptyMedicationStatementId, IPSEntryEmptyMedicationStatement.id = IPSEntryEmptyMedicationStatementId, create('Coding') as c, c.system = 'http://hl7.org/fhir/uv/ips/CodeSystem/absent-unknown-uv-ips', c.code = 'no-medication-info', c.display = 'No information about medications', create('CodeableConcept') as cc, cc.coding = c, IPSEntryEmptyMedicationStatement.medication = cc, IPSEntryEmptyMedicationStatement.status = 'unknown', IPSEntryEmptyMedicationStatement.subject as IPSEntryEmptyMedicationStatementSubject, IPSEntryEmptyMedicationStatementSubject.reference = append('urn:uuid:', IPSPatientReference), IPSEntryMedicationStatement.fullUrl = append('urn:uuid:', IPSEntryEmptyMedicationStatementId), IPSEntryMedicationStatement.resource = IPSEntryEmptyMedicationStatement, IPSEntryResourceCompositionSectionMedications.entry as IPSEntryResourceCompositionSectionMedicationEntry, IPSEntryResourceCompositionSectionMedicationEntry.reference = append('urn:uuid:', IPSEntryEmptyMedicationStatementId) "CreateNoKnownMedications"; // Bloco que cria conditions BRCondicaoSaude RNDSEntry -> tgt.entry then { RNDSEntry.resource as RNDSEntryResource -> tgt.entry then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRCondicaoSaude').empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionActiveProblems.entry as IPSEntryResourceCompositionSectionActiveProblemsEntry, IPSEntryResourceCompositionSectionActiveProblemsEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que cria alergias BRAlergiaReacaoAdversa RNDSEntry -> tgt.entry then { RNDSEntry.resource as RNDSEntryResource -> tgt.entry then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRAlergiaReacaoAdversa').empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionAllergiesAndIntolerances.entry as IPSEntryResourceCompositionSectionAllergiesAndIntolerancesEntry, IPSEntryResourceCompositionSectionAllergiesAndIntolerancesEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que cria Secao de REL RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where((profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRDiagnosticoCOVID19-TesteRapido') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRDiagnosticoLaboratorioClinico') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRObservacaoDescritiva')).empty().not()) -> IPSEntryResourceComposition then { RNDSEntry -> IPSEntryResourceCompositionSectionResults then { // cria section de results no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionResults then { RNDSEntryResource -> IPSEntryResourceCompositionSectionResults.title = 'Results', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '30954-2', c.display = 'Relevant diagnostic tests/laboratory data Narrative', cc.coding = c, IPSEntryResourceCompositionSectionResults.code = cc "SetResultsNarrative"; } "SetCompositionSectionResults"; } "CreateSectionResults"; } "CreateSectionResultsIfExist"; // Bloco que mapeia REL RNDSEntry -> tgt.entry then { RNDSEntry.resource as RNDSEntryResource -> tgt.entry then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where((profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRDiagnosticoCOVID19-TesteRapido') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRDiagnosticoLaboratorioClinico') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRObservacaoDescritiva')).empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionResults.entry as IPSEntryResourceCompositionSectionResultsEntry, IPSEntryResourceCompositionSectionResultsEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que mapeia BRAmostraBiologica-1.0 RNDSEntry -> tgt.entry then { RNDSEntry.resource as RNDSEntryResource -> tgt.entry then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRAmostraBiologica').empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que cria Secao de Vital Signs RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRMedidaObservada').empty().not()) -> IPSEntryResourceComposition then { RNDSEntry -> IPSEntryResourceCompositionSectionVitalSigns then { // cria section de results no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionVitalSigns then { RNDSEntryResource -> IPSEntryResourceCompositionSectionVitalSigns.title = 'Vital Signs', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '8716-3', c.display = 'Vital signs', cc.coding = c, IPSEntryResourceCompositionSectionVitalSigns.code = cc "SetResultsNarrative"; } "SetCompositionSectionResults"; } "CreateSectionResults"; } "CreateSectionResultsIfExist"; // Bloco que cria Vital Signs RNDSEntry -> tgt.entry then { RNDSEntry.resource as RNDSEntryResource -> tgt.entry then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRMedidaObservada').empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionVitalSigns.entry as IPSEntryResourceCompositionSectionVitalSignsEntry, IPSEntryResourceCompositionSectionVitalSignsEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que cria secao de Imunizacao RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where((profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministrado') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministradoCarga') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministradoCampanha')).empty().not()) -> IPSEntryResourceComposition then { RNDSEntry -> IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionImmunizations then { // cria section de immunizations no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionImmunizations then { RNDSEntryResource -> IPSEntryResourceCompositionSectionImmunizations.title = 'Immunizations', create('Coding') as c, c.system = 'http://loinc.org', c.code = '11369-6', c.display = 'History of Immunization Narrative', create('CodeableConcept') as cc, cc.coding = c, IPSEntryResourceCompositionSectionImmunizations.code = cc "SetImmunizationsNarrative"; } "SetCompositionSectionImmunizations"; // Bloco que mapeia BRImunobiologicoAdministrado-2.0, BRImunobiologicoAdministradoCampanha-1.0 e BRImunobiologicoAdministradoCarga-2.0 RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where((profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministrado') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministradoCarga') or (profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRImunobiologicoAdministradoCampanha')).empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionImmunizations.entry as IPSEntryResourceCompositionSectionImmunizationsEntry, IPSEntryResourceCompositionSectionImmunizationsEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "CreateSectionImmunizations"; } "CreateSectionImmunizationsIfExists"; // http://www.saude.gov.br/fhir/r4/StructureDefinition/BRProcedimentoRealizado-1.0 RNDSEntryResource where (RNDSEntryResource.entry.resource.entry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRProcedimentoRealizado').empty().not()) -> IPSEntryResourceComposition then { RNDSEntry -> IPSEntryResourceComposition.section as IPSEntryResourceCompositionSectionProcedures then { // cria section de procedures no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionProcedures then { RNDSEntryResource -> IPSEntryResourceCompositionSectionProcedures.title = 'History of procedures', create('CodeableConcept') as cc, create('Coding') as c, c.system = 'http://loinc.org', c.code = '47519-4', c.display = 'History of Procedures Narrative', cc.coding = c, IPSEntryResourceCompositionSectionProcedures.code = cc "SetProceduresNarrative"; } "SetCompositionSectionProcedures"; // Bloco que mapeia BRImunobiologicoAdministrado-2.0, BRImunobiologicoAdministradoCampanha-1.0 e BRImunobiologicoAdministradoCarga-2.0 RNDSEntryResource.entry as RNDSEntryResourceEntry -> tgt.entry then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> tgt.entry then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRProcedimentoRealizado').empty().not()) -> tgt.entry then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionProcedures.entry as IPSEntryResourceCompositionSectionProceduresEntry, IPSEntryResourceCompositionSectionProceduresEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "CreateSectionProcedures"; } "CreateSectionProceduresIfExists"; // cria section de medications no composition RNDSEntryResource -> IPSEntryResourceCompositionSectionMedications then { RNDSEntryResource -> IPSEntryResourceCompositionSectionMedications.title = 'Medication', create('Coding') as c, c.system = 'http://loinc.org', c.code = '10160-0', c.display = 'History of Medication use Narrative', create('CodeableConcept') as cc, cc.coding = c, IPSEntryResourceCompositionSectionMedications.code = cc "SetMedicationsNarrative"; // http://www.saude.gov.br/fhir/r4/StructureDefinition/BRPrescricaoMedicamento RNDSEntryResource.entry as RNDSEntryResourceEntry -> IPSEntryMedicationRequests then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> IPSEntryMedicationRequests then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRPrescricaoMedicamento').empty().not()) -> IPSEntryMedicationRequests.resource as IPSEntryMedicationRequestsResource then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> IPSEntryResourceCompositionSectionMedications.entry as IPSEntryResourceCompositionSectionMedicationsEntry, IPSEntryResourceCompositionSectionMedicationsEntry.reference = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; // http://www.saude.gov.br/fhir/r4/StructureDefinition/BRMedicamento RNDSEntryResource.entry as RNDSEntryResourceEntry -> IPSEntryMedications then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> IPSEntryMedications then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRMedicamento').empty().not()) -> IPSEntryMedications.resource as IPSEntryMedicationsResource then { RNDSEntryResourceEntryResourceEntryResource.id as RNDSEntryResourceEntryResourceEntryResourceId -> tgt.entry as AddEntry, AddEntry.fullUrl = append('urn:uuid:', RNDSEntryResourceEntryResourceEntryResourceId), AddEntry.resource = RNDSEntryResourceEntryResourceEntryResource "AddEntry"; } "SetResource"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "SetCompositionSectionMedications"; // Bloco que cria Patient RNDSEntry -> IPSEntryPatient then { RNDSEntry.resource as RNDSEntryResource -> IPSEntryPatient then { RNDSEntryResource.entry as RNDSEntryResourceEntry -> IPSEntryPatient then { RNDSEntryResourceEntry.resource as RNDSEntryResourceEntryResource -> IPSEntryPatient then { RNDSEntryResourceEntryResource.entry as RNDSEntryResourceEntryResourceEntry then { RNDSEntryResourceEntryResourceEntry.resource as RNDSEntryResourceEntryResourceEntryResource where (RNDSEntryResourceEntryResourceEntry.resource.meta.where(profile = 'http://www.saude.gov.br/fhir/r4/StructureDefinition/BRIndividuo').empty().not()) -> IPSEntryPatient.resource as IPSEntryPatientResource then { RNDSEntryResourceEntryResourceEntryResource -> IPSEntryPatient.fullUrl = append('urn:uuid:', IPSPatientReference) "SetPatientFullUrl"; RNDSEntryResourceEntryResourceEntryResource -> IPSEntryPatient.resource = RNDSEntryResourceEntryResourceEntryResource "SetPatientResource"; RNDSEntryResourceEntryResourceEntryResource -> IPSEntryPatientResource.id = IPSPatientReference "SetPatientId"; } "SetPatient"; } "IterateRNDSEntryResourceEntryResourceEntry"; } "IterateRNDSEntryResourceEntryResource"; } "IterateRNDSEntryResourceEntry"; } "IterateRNDSEntryResource"; } "IterateRNDSEntry"; // Bloco que cria organization para author e custodian RNDSEntry -> IPSEntryPractitioner then { RNDSEntry -> IPSEntryPractitioner.fullUrl = append('urn:uuid:', IPSPractitionerReference) "SetFullUrl"; RNDSEntry -> create('Organization') as IPSOrganization then { RNDSEntry -> IPSOrganization.id = IPSPractitionerReference "SetId"; RNDSEntry -> create('Identifier') as IPSPractitionerIdentifier, IPSPractitionerIdentifier.system = 'http://www.saude.gov.br/fhir/r4/NamingSystem/cnpj', IPSPractitionerIdentifier.value = '00394544000185', IPSOrganization.identifier = IPSPractitionerIdentifier "SetIdentifier"; RNDSEntry -> IPSOrganization.name = 'Ministério da Saúde do Brasil' "SetName"; RNDSEntry -> IPSEntryPractitioner.fullUrl = append('urn:uuid:', IPSPractitionerReference), IPSEntryPractitioner.resource = IPSOrganization "SetAuthor"; } "SetAuthor"; } "SetEmptyAuthor"; RNDSEntryResource.id as RNDSEntryResourceId -> IPSEntryResourceComposition.id as IPSEntryResourceCompositionId, IPSEntry.fullUrl = append('urn:uuid:', IPSEntryResourceCompositionId), IPSEntry.resource = IPSEntryResourceComposition "SetResourceComposition"; } "SetSubjectAuthorCustodianSection"; } "SetIPSEntryResourceComposition"; } "SetIPSEntries"; } group DataAbsentReason(source src : Element, target tgt : Element) { src -> create('Extension') as TgtExtension, create('code') as c, c.value = 'unknown', TgtExtension.url = 'http://hl7.org/fhir/StructureDefinition/data-absent-reason', TgtExtension.value = c, tgt.extension = TgtExtension "SetExtension"; } group NotApplicable(source src : Element, target tgt : Element) { src -> create('Extension') as TgtExtension, create('code') as c, c.value = 'not-applicable', TgtExtension.url = 'http://hl7.org/fhir/StructureDefinition/data-absent-reason', TgtExtension.value = c, tgt.extension = TgtExtension "SetExtension"; }