Guía de Implementación de Homologación Regional (PH4H) de Costa Rica - Versión en desarrollo (v0.1.0): borrador de trabajo de la Iniciativa HL7® Costa Rica, que puede cambiar sin aviso.
\r\nmap "https://hl7.or.cr/fhir/ph4h/StructureMap/CRComun" = "CRComun"\r\n\r\n// Identificador: el system pasa de URI a OID (ConceptMap cr-sistema-identificador-oid, opción (a) de la\r\n// homologación) y el tipo conserva solo el coding de HL7 v2-0203, que entienden los demás países.\r\n\r\ngroup Identificador(source id : Identifier, target ti : Identifier) {\r\n id.use as v -> ti.use = v;\r\n id.type as st -> ti.type as tt then {\r\n st.coding as sc where (system = 'http://terminology.hl7.org/CodeSystem/v2-0203') -> tt.coding as c then Codificacion(sc, c) "v2";\r\n };\r\n id.system as s -> ti.system = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid', 'code');\r\n id.value as v -> ti.value = v;\r\n id.period as p -> ti.period as tp then Periodo(p, tp);\r\n id.assigner as a -> ti.assigner as ta then Referencia(a, ta);\r\n}\r\n\r\n// Referencia: se conserva la referencia. Si es lógica (por identificador), su system también pasa a OID y se\r\n// agrega el tipo de HL7 v2-0203, porque con el OID del país el system ya no distingue el tipo de identificador.\r\ngroup Referencia(source r : Reference, target tr : Reference) {\r\n r.reference as v -> tr.reference = v;\r\n r.type as v -> tr.type = v;\r\n r.identifier as id -> tr.identifier as ti then {\r\n id.type as t -> ti.type as tt then Concepto(t, tt) "tipoExplicito";\r\n id where (type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/')) -> ti.type as tt, tt.coding as c then {\r\n id -> c.system = 'http://terminology.hl7.org/CodeSystem/v2-0203', c.code = 'PPN' "ppn";\r\n } "tipoPasaporte";\r\n id where (type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/').not()) -> ti.type as tt, tt.coding as c then {\r\n id.system as s -> c.system = 'http://terminology.hl7.org/CodeSystem/v2-0203', c.code = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-tipo', 'code') "v2";\r\n } "tipoDelSystem";\r\n id.system as s -> ti.system = translate(s, 'https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid', 'code');\r\n id.value as v -> ti.value = v;\r\n };\r\n r.display as v -> tr.display = v;\r\n}\r\n\r\ngroup Concepto(source cc : CodeableConcept, target tc : CodeableConcept) {\r\n cc.coding as c -> tc.coding as t then Codificacion(c, t);\r\n cc.text as v -> tc.text = v;\r\n}\r\n\r\ngroup Codificacion(source c : Coding, target t : Coding) {\r\n c.system as v -> t.system = v;\r\n c.version as v -> t.version = v;\r\n c.code as v -> t.code = v;\r\n c.display as v -> t.display = v;\r\n}\r\n\r\ngroup Nombre(source n : HumanName, target tn : HumanName) {\r\n n.use as v -> tn.use = v;\r\n n.text as v -> tn.text = v;\r\n n.family as v -> tn.family = v;\r\n n.given as v -> tn.given = v;\r\n n.prefix as v -> tn.prefix = v;\r\n n.suffix as v -> tn.suffix = v;\r\n}\r\n\r\ngroup Telecom(source t : ContactPoint, target tt : ContactPoint) {\r\n t.system as v -> tt.system = v;\r\n t.value as v -> tt.value = v;\r\n t.use as v -> tt.use = v;\r\n t.rank as v -> tt.rank = v;\r\n}\r\n\r\n// Dirección: el país pasa de alfa-3 a alfa-2 (ConceptMap cr-pais-alfa3-alfa2 de la IG terminológica).\r\n// Provincia, cantón y distrito van con su código de la DTA; el barrio, en la extensión estándar precinct.\r\ngroup Direccion(source a : Address, target ta : Address) {\r\n a.extension as e where (url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-precinct') -> ta.extension as te then {\r\n e.url as v -> te.url = v;\r\n e.value : string as v -> te.value = v;\r\n } "precinct";\r\n a.use as v -> ta.use = v;\r\n a.text as v -> ta.text = v;\r\n a.line as v -> ta.line = v;\r\n a.city as v -> ta.city = v;\r\n a.district as v -> ta.district = v;\r\n a.state as v -> ta.state = v;\r\n a.postalCode as v -> ta.postalCode = v;\r\n a.country as v -> ta.country = translate(v, 'https://hl7.or.cr/fhir/terminology/ConceptMap/cr-pais-alfa3-alfa2', 'code');\r\n}\r\n\r\ngroup Periodo(source p : Period, target tp : Period) {\r\n p.start as v -> tp.start = v;\r\n p.end as v -> tp.end = v;\r\n}\r\n\r\n "},"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status","valueCode":"draft","_valueCode":{"extension":[{"url":"http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom","valueCanonical":"https://hl7.or.cr/fhir/ph4h/ImplementationGuide/hl7.fhir.cr.ph4h"}]}}],"url":"https://hl7.or.cr/fhir/ph4h/StructureMap/CRComun","version":"0.1.0","name":"CRComun","status":"draft","date":"2026-10-06T00:22:41-06:00","publisher":"Iniciativa HL7 Costa Rica","contact":[{"name":"Iniciativa HL7 Costa Rica","telecom":[{"system":"url","value":"https://hl7.or.cr"}]}],"description":"Identificador: el system pasa de URI a OID (ConceptMap cr-sistema-identificador-oid, opción (a) de la\r\nhomologación) y el tipo conserva solo el coding de HL7 v2-0203, que entienden los demás países.","jurisdiction":[{"coding":[{"system":"urn:iso:std:iso:3166","code":"CR","display":"Costa Rica"}]}],"group":[{"name":"Identificador","typeMode":"none","input":[{"name":"id","type":"Identifier","mode":"source"},{"name":"ti","type":"Identifier","mode":"target"}],"rule":[{"name":"use","source":[{"context":"id","element":"use","variable":"v"}],"target":[{"context":"ti","contextType":"variable","element":"use","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"type","source":[{"context":"id","element":"type","variable":"st"}],"target":[{"context":"ti","contextType":"variable","element":"type","variable":"tt"}],"rule":[{"name":"v2","source":[{"context":"st","element":"coding","variable":"sc","condition":"system = 'http://terminology.hl7.org/CodeSystem/v2-0203'"}],"target":[{"context":"tt","contextType":"variable","element":"coding","variable":"c"}],"dependent":[{"name":"Codificacion","variable":["sc","c"]}]}]},{"name":"system","source":[{"context":"id","element":"system","variable":"s"}],"target":[{"context":"ti","contextType":"variable","element":"system","transform":"translate","parameter":[{"valueId":"s"},{"valueString":"https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid"},{"valueString":"code"}]}]},{"name":"value","source":[{"context":"id","element":"value","variable":"v"}],"target":[{"context":"ti","contextType":"variable","element":"value","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"period","source":[{"context":"id","element":"period","variable":"p"}],"target":[{"context":"ti","contextType":"variable","element":"period","variable":"tp"}],"dependent":[{"name":"Periodo","variable":["p","tp"]}]},{"name":"assigner","source":[{"context":"id","element":"assigner","variable":"a"}],"target":[{"context":"ti","contextType":"variable","element":"assigner","variable":"ta"}],"dependent":[{"name":"Referencia","variable":["a","ta"]}]}]},{"name":"Referencia","typeMode":"none","documentation":"Referencia: se conserva la referencia. Si es lógica (por identificador), su system también pasa a OID y se\r\nagrega el tipo de HL7 v2-0203, porque con el OID del país el system ya no distingue el tipo de identificador.","input":[{"name":"r","type":"Reference","mode":"source"},{"name":"tr","type":"Reference","mode":"target"}],"rule":[{"name":"reference","source":[{"context":"r","element":"reference","variable":"v"}],"target":[{"context":"tr","contextType":"variable","element":"reference","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"type","source":[{"context":"r","element":"type","variable":"v"}],"target":[{"context":"tr","contextType":"variable","element":"type","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"identifier","source":[{"context":"r","element":"identifier","variable":"id"}],"target":[{"context":"tr","contextType":"variable","element":"identifier","variable":"ti"}],"rule":[{"name":"tipoExplicito","source":[{"context":"id","element":"type","variable":"t"}],"target":[{"context":"ti","contextType":"variable","element":"type","variable":"tt"}],"dependent":[{"name":"Concepto","variable":["t","tt"]}]},{"name":"tipoPasaporte","source":[{"context":"id","condition":"type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/')"}],"target":[{"context":"ti","contextType":"variable","element":"type","variable":"tt"},{"context":"tt","contextType":"variable","element":"coding","variable":"c"}],"rule":[{"name":"ppn","source":[{"context":"id"}],"target":[{"context":"c","contextType":"variable","element":"system","transform":"copy","parameter":[{"valueString":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},{"context":"c","contextType":"variable","element":"code","transform":"copy","parameter":[{"valueString":"PPN"}]}]}]},{"name":"tipoDelSystem","source":[{"context":"id","condition":"type.exists().not() and system.startsWith('https://hl7.or.cr/fhir/sid/pasaporte/').not()"}],"target":[{"context":"ti","contextType":"variable","element":"type","variable":"tt"},{"context":"tt","contextType":"variable","element":"coding","variable":"c"}],"rule":[{"name":"v2","source":[{"context":"id","element":"system","variable":"s"}],"target":[{"context":"c","contextType":"variable","element":"system","transform":"copy","parameter":[{"valueString":"http://terminology.hl7.org/CodeSystem/v2-0203"}]},{"context":"c","contextType":"variable","element":"code","transform":"translate","parameter":[{"valueId":"s"},{"valueString":"https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-tipo"},{"valueString":"code"}]}]}]},{"name":"system","source":[{"context":"id","element":"system","variable":"s"}],"target":[{"context":"ti","contextType":"variable","element":"system","transform":"translate","parameter":[{"valueId":"s"},{"valueString":"https://hl7.or.cr/fhir/ph4h/ConceptMap/cr-sistema-identificador-oid"},{"valueString":"code"}]}]},{"name":"value","source":[{"context":"id","element":"value","variable":"v"}],"target":[{"context":"ti","contextType":"variable","element":"value","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"display","source":[{"context":"r","element":"display","variable":"v"}],"target":[{"context":"tr","contextType":"variable","element":"display","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"Concepto","typeMode":"none","input":[{"name":"cc","type":"CodeableConcept","mode":"source"},{"name":"tc","type":"CodeableConcept","mode":"target"}],"rule":[{"name":"coding","source":[{"context":"cc","element":"coding","variable":"c"}],"target":[{"context":"tc","contextType":"variable","element":"coding","variable":"t"}],"dependent":[{"name":"Codificacion","variable":["c","t"]}]},{"name":"text","source":[{"context":"cc","element":"text","variable":"v"}],"target":[{"context":"tc","contextType":"variable","element":"text","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"Codificacion","typeMode":"none","input":[{"name":"c","type":"Coding","mode":"source"},{"name":"t","type":"Coding","mode":"target"}],"rule":[{"name":"system","source":[{"context":"c","element":"system","variable":"v"}],"target":[{"context":"t","contextType":"variable","element":"system","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"version","source":[{"context":"c","element":"version","variable":"v"}],"target":[{"context":"t","contextType":"variable","element":"version","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"code","source":[{"context":"c","element":"code","variable":"v"}],"target":[{"context":"t","contextType":"variable","element":"code","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"display","source":[{"context":"c","element":"display","variable":"v"}],"target":[{"context":"t","contextType":"variable","element":"display","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"Nombre","typeMode":"none","input":[{"name":"n","type":"HumanName","mode":"source"},{"name":"tn","type":"HumanName","mode":"target"}],"rule":[{"name":"use","source":[{"context":"n","element":"use","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"use","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"text","source":[{"context":"n","element":"text","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"text","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"family","source":[{"context":"n","element":"family","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"family","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"given","source":[{"context":"n","element":"given","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"given","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"prefix","source":[{"context":"n","element":"prefix","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"prefix","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"suffix","source":[{"context":"n","element":"suffix","variable":"v"}],"target":[{"context":"tn","contextType":"variable","element":"suffix","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"Telecom","typeMode":"none","input":[{"name":"t","type":"ContactPoint","mode":"source"},{"name":"tt","type":"ContactPoint","mode":"target"}],"rule":[{"name":"system","source":[{"context":"t","element":"system","variable":"v"}],"target":[{"context":"tt","contextType":"variable","element":"system","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"value","source":[{"context":"t","element":"value","variable":"v"}],"target":[{"context":"tt","contextType":"variable","element":"value","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"use","source":[{"context":"t","element":"use","variable":"v"}],"target":[{"context":"tt","contextType":"variable","element":"use","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"rank","source":[{"context":"t","element":"rank","variable":"v"}],"target":[{"context":"tt","contextType":"variable","element":"rank","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"Direccion","typeMode":"none","documentation":"Dirección: el país pasa de alfa-3 a alfa-2 (ConceptMap cr-pais-alfa3-alfa2 de la IG terminológica).\r\nProvincia, cantón y distrito van con su código de la DTA; el barrio, en la extensión estándar precinct.","input":[{"name":"a","type":"Address","mode":"source"},{"name":"ta","type":"Address","mode":"target"}],"rule":[{"name":"precinct","source":[{"context":"a","element":"extension","variable":"e","condition":"url = 'http://hl7.org/fhir/StructureDefinition/iso21090-ADXP-precinct'"}],"target":[{"context":"ta","contextType":"variable","element":"extension","variable":"te"}],"rule":[{"name":"url","source":[{"context":"e","element":"url","variable":"v"}],"target":[{"context":"te","contextType":"variable","element":"url","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"value","source":[{"context":"e","type":"string","element":"value","variable":"v"}],"target":[{"context":"te","contextType":"variable","element":"value","transform":"copy","parameter":[{"valueId":"v"}]}]}]},{"name":"use","source":[{"context":"a","element":"use","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"use","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"text","source":[{"context":"a","element":"text","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"text","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"line","source":[{"context":"a","element":"line","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"line","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"city","source":[{"context":"a","element":"city","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"city","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"district","source":[{"context":"a","element":"district","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"district","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"state","source":[{"context":"a","element":"state","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"state","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"postalCode","source":[{"context":"a","element":"postalCode","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"postalCode","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"country","source":[{"context":"a","element":"country","variable":"v"}],"target":[{"context":"ta","contextType":"variable","element":"country","transform":"translate","parameter":[{"valueId":"v"},{"valueString":"https://hl7.or.cr/fhir/terminology/ConceptMap/cr-pais-alfa3-alfa2"},{"valueString":"code"}]}]}]},{"name":"Periodo","typeMode":"none","input":[{"name":"p","type":"Period","mode":"source"},{"name":"tp","type":"Period","mode":"target"}],"rule":[{"name":"start","source":[{"context":"p","element":"start","variable":"v"}],"target":[{"context":"tp","contextType":"variable","element":"start","transform":"copy","parameter":[{"valueId":"v"}]}]},{"name":"end","source":[{"context":"p","element":"end","variable":"v"}],"target":[{"context":"tp","contextType":"variable","element":"end","transform":"copy","parameter":[{"valueId":"v"}]}]}]}]}
]]>