health.hl7v2.utils.v2tofhirr4
Module health.hl7v2.utils.v2tofhirr4
API
Definitions
ballerinax/health.hl7v2.utils.v2tofhirr4 Ballerina library
Package containing HL7v2.x to FHIR pre-built mapping functionalities.
HL7v2 to FHIR Package
Package Overview
This package implements the HL7 version 2 to FHIR implementation guide (https://build.fhir.org/ig/HL7/v2-to-fhir/branches/master/datatype_maps.html).
Note:
From Ballerina Swan Lake Update 10 upwards, --optimize-dependency-compilation
flag is
introduced to optimize the memory usage during the compilation time.
Use the flag in the build command as follows,
bal build --optimize-dependency-compilation
or add as a config in the Ballerina.toml
file.
[build-options] optimizeDependencyCompilation = true
Functions
al1ToAllerygyIntolerance
function al1ToAllerygyIntolerance(Al1 al1) returns AllergyIntolerance
Parameters
- al1 Al1 -
ceToCode
function ceToCode(Ce ce) returns code?
Parameters
- ce Ce -
ceToCodeableConcept
function ceToCodeableConcept(Ce ce) returns CodeableConcept
Parameters
- ce Ce -
ceToCodeableConcepts
function ceToCodeableConcepts(Ce|CWE ce) returns CodeableConcept[]
Parameters
- ce Ce|CWE -
ceToCoding
function ceToCoding(Ce ce) returns Coding
Parameters
- ce Ce -
ceToCodings
function ceToCodings(Ce ce) returns Coding[]?
Parameters
- ce Ce -
ceToUri
function ceToUri(Ce ce) returns uri?
Parameters
- ce Ce -
cweToCode
function cweToCode(Cwe cwe) returns code?
Parameters
- cwe Cwe -
cweToCodeableConcept
function cweToCodeableConcept(Cwe cwe) returns CodeableConcept
Parameters
- cwe Cwe -
cweToCoding
function cweToCoding(Cwe cwe) returns Coding
Parameters
- cwe Cwe -
cweToCodings
function cweToCodings(Cwe ce) returns Coding[]?
Parameters
- ce Cwe -
cweToUri
function cweToUri(Cwe cwe) returns uri?
Parameters
- cwe Cwe -
dg1ToCondition
function dg1ToCondition(Dg1 dg1) returns Condition
Parameters
- dg1 Dg1 -
dg1ToEncounter
function dg1ToEncounter(Dg1 dg1, string? conditionId) returns Encounter
dg1ToEpisodeOfCare
dtmToDateTime
function dtmToDateTime(Dtm ts) returns dateTime?
Parameters
- ts Dtm -
dtmToInstant
function dtmToInstant(Dtm ts) returns instant
Parameters
- ts Dtm -
eiToCoding
function eiToCoding(Ei ei) returns Coding
Parameters
- ei Ei -
eiToIdentifier
function eiToIdentifier(Ei ei) returns Identifier
Parameters
- ei Ei -
eiToReferenceWithType
evnToProvenance
function evnToProvenance(Evn evn) returns Provenance
Parameters
- evn Evn -
generateFhirResourceId
function generateFhirResourceId() returns string
hdToMessageHeaderDestination
function hdToMessageHeaderDestination(Hd hd) returns MessageHeaderDestination
Parameters
- hd Hd -
hdToMessageHeaderSource
function hdToMessageHeaderSource(Hd hd) returns MessageHeaderSource
Parameters
- hd Hd -
idToAddressType
function idToAddressType(Id id) returns AddressType
Parameters
- id Id -
idToAddressUse
function idToAddressUse(Id id) returns AddressUse?
Parameters
- id Id -
idToCodeableConcept
function idToCodeableConcept(ID id) returns CodeableConcept?
Parameters
- id ID -
idToCodeableConceptArray
function idToCodeableConceptArray(Id id) returns CodeableConcept[]
Parameters
- id Id -
idToCoding
function idToCoding(ID id) returns Coding
Parameters
- id ID -
idToContactPointSystem
function idToContactPointSystem(Id id) returns ContactPointSystem
Parameters
- id Id -
idToContactPointUse
function idToContactPointUse(Id id) returns ContactPointUse
Parameters
- id Id -
idToDiagnosticReportStatus
function idToDiagnosticReportStatus(ID id) returns DiagnosticReportStatus
Parameters
- id ID -
idToHumanNameUse
function idToHumanNameUse(Id id) returns HumanNameUse
Parameters
- id Id -
idToServiceRequestPriority
function idToServiceRequestPriority(ID id) returns ServiceRequestPriority
Parameters
- id ID -
isToAllergyIntoleranceCategory
function isToAllergyIntoleranceCategory(Is 'is) returns AllergyIntoleranceCategory
Parameters
- 'is Is -
isToAllergyIntoleranceCriticality
function isToAllergyIntoleranceCriticality(Is 'is) returns AllergyIntoleranceCriticality
Parameters
- 'is Is -
isToAllergyIntoleranceType
function isToAllergyIntoleranceType(string 'is) returns AllergyIntoleranceType
Parameters
- 'is string -
msgToCoding
function msgToCoding(CM_MSG msg) returns Coding
Parameters
- msg CM_MSG -
mshToMessageHeader
function mshToMessageHeader(Msh msh) returns MessageHeader
Parameters
- msh Msh -
nameToServiceRequestIntent
function nameToServiceRequestIntent(string name) returns ServiceRequestIntent
Parameters
- name string -
nk1ToContact
function nk1ToContact(Nk12 nk12, Nk14 nk14, Nk15 nk15, Nk16 nk16, Nk17 nk17, Nk18 nk18, Nk19 nk19, Nk113 nk113, Nk115 nk115, Nk130 nk130, Nk131 nk131, Nk132 nk132) returns PatientContact[]
Parameters
- nk12 Nk12 -
- nk14 Nk14 -
- nk15 Nk15 -
- nk16 Nk16 -
- nk17 Nk17 -
- nk18 Nk18 -
- nk19 Nk19 -
- nk113 Nk113 -
- nk115 Nk115 -
- nk130 Nk130 -
- nk131 Nk131 -
- nk132 Nk132 -
nk1ToPatient
function nk1ToPatient(Nk1 nk1) returns Patient
Parameters
- nk1 Nk1 -
obrToDiagnosticReport
function obrToDiagnosticReport(Obr obr) returns DiagnosticReport
Parameters
- obr Obr -
obrToServiceRequest
function obrToServiceRequest(Obr obr) returns ServiceRequest
Parameters
- obr Obr -
obxToObservation
function obxToObservation(Obx obx) returns Observation
Parameters
- obx Obx -
orcToDiagnosticReport
function orcToDiagnosticReport(Orc orc) returns DiagnosticReport
Parameters
- orc Orc -
orcToImmunization
function orcToImmunization(Orc orc) returns Immunization
Parameters
- orc Orc -
pd1ToExtension
function pd1ToExtension(string pd16) returns Extension[]?
Parameters
- pd16 string -
pd1ToGeneralPractitioner
function pd1ToGeneralPractitioner(Pd13 pd13, Pd14 pd14) returns Reference[]?
Parameters
- pd13 Pd13 -
- pd14 Pd14 -
pd1ToPatient
function pd1ToPatient(Pd1 pd1) returns Patient
Parameters
- pd1 Pd1 -
pidToAddress
function pidToAddress(string pid12, Pid11 pid11) returns Address[]?
pidToAdministrativeSex
function pidToAdministrativeSex(string pid8) returns PatientGender?
Parameters
- pid8 string -
pidToBirthOrder
pidToBirthPlace
function pidToBirthPlace(string pid23) returns Extension[]
Parameters
- pid23 string -
pidToMaritalStatus
function pidToMaritalStatus(Pid16 pid16) returns CodeableConcept?
Parameters
- pid16 Pid16 -
pidToMultipleBirthIndicator
Parameters
- pid24 string -
pidToPatient
function pidToPatient(Pid pid) returns Patient
Parameters
- pid Pid -
pidToPatientDeathIndicator
Parameters
- pid30 string -
pidToPatientName
function pidToPatientName(Pid5 pid5, Pid9 pid9) returns HumanName[]?
Parameters
- pid5 Pid5 -
- pid9 Pid9 -
pidToPhoneNumber
function pidToPhoneNumber(Pid13 pid13, Pid14 pid14) returns ContactPoint[]?
Parameters
- pid13 Pid13 -
- pid14 Pid14 -
pidToPrimaryLanguage
function pidToPrimaryLanguage(Pid15 pid15) returns PatientCommunication[]?
Parameters
- pid15 Pid15 -
pidToSsnNumberIdentifier
function pidToSsnNumberIdentifier(string pid19) returns Identifier[]?
Parameters
- pid19 string -
ptToMeta
function ptToMeta(Pt pt) returns Meta
Parameters
- pt Pt -
pv1ToEncounter
function pv1ToEncounter(Pv1 pv1) returns Encounter
Parameters
- pv1 Pv1 -
pv1ToExtension
function pv1ToExtension(string pv116) returns Extension[]
Parameters
- pv116 string -
pv1ToPatient
function pv1ToPatient(Pv1 pv1) returns Patient
Parameters
- pv1 Pv1 -
pv2ToEncounter
function pv2ToEncounter(Pv2 pv2) returns Encounter
Parameters
- pv2 Pv2 -
segmentToFhir
function segmentToFhir(string segmentName, Segment segment, V2SegmentToFhirMapper? customMapper, V2ToFhirCustomMapperServiceConfig? serviceconf) returns BundleEntry[]|error
Transform an HL7 segment to FHIR Bundle.
Parameters
- segmentName string - Name of the HL7 segment
- segment Segment - HL7 segment
- customMapper V2SegmentToFhirMapper? - Custom mapper implementation
- serviceconf V2ToFhirCustomMapperServiceConfig? - Custom mapping service configuration
Return Type
- BundleEntry[]|error - FHIR Bundle
stringToHl7
Parse a string to an HL7 message.
Parameters
- msg string - HL7 message as a string
Return Type
- Message|error - hl7v2:Message
tsToDateTime
function tsToDateTime(Ts ts) returns dateTime?
Parameters
- ts Ts -
tsToInstant
function tsToInstant(Ts ts) returns instant?
Parameters
- ts Ts -
v2ToFhir
function v2ToFhir(string|Message hl7, V2SegmentToFhirMapper? customMapper, V2ToFhirCustomMapperServiceConfig? mapperServiceConf) returns json|error
Transform an HL7 message to FHIR.
Parameters
- hl7 string|Message - HL7 message as a string or an hl7v2:Message
- customMapper V2SegmentToFhirMapper? (default ()) - Custom mapper implementation
- mapperServiceConf V2ToFhirCustomMapperServiceConfig? (default ()) - Custom mapping service configuration
Return Type
- json|error - FHIR Bundle as a json
xadToAddress
function xadToAddress(Xad xad) returns Address?
Parameters
- xad Xad -
xcnToCodeableConcept
function xcnToCodeableConcept(Xcn xcn) returns CodeableConcept
Parameters
- xcn Xcn -
xcnToReference
function xcnToReference(Xcn xcn) returns Reference
Parameters
- xcn Xcn -
xcnToReferenceWithType
xonToOrganization
function xonToOrganization(Xon xon) returns Organization
Parameters
- xon Xon -
xonToReference
function xonToReference(Xon xon) returns Reference?
Parameters
- xon Xon -
xpnToHumanName
function xpnToHumanName(Xpn xpn) returns HumanName
Parameters
- xpn Xpn -
xtnToContactPoint
function xtnToContactPoint(Xtn xtn) returns ContactPoint?
Parameters
- xtn Xtn -
Records
health.hl7v2.utils.v2tofhirr4: V2SegmentToFhirMapper
V2toFHIR Mapper function implementation holder record.
Fields
- pv1ToPatient? Pv1ToPatient - PV1 segment to Patient FHIR resource mapping function
- pv1ToEncounter? Pv1ToEncounter - PV1 segment to Encounter FHIR resource mapping function
- nk1ToPatient? Nk1ToPatient - NK1 segment to Patient FHIR resource mapping function
- pd1ToPatient? Pd1ToPatient - PD1 segment to Patient FHIR resource mapping function
- pidToPatient? PidToPatient - PID segment to Patient FHIR resource mapping function
- dg1ToCondition? Dg1ToCondition - DG1 segment to Condition FHIR resource mapping function
- dg1ToEncounter? Dg1ToEncounter - DG1 segment to Encounter FHIR resource mapping function
- dg1ToEpisodeOfCare? Dg1ToEpisodeOfCare - DG1 segment to EpisodeOfCare FHIR resource mapping function
- obxToObservation? ObxToObservation - OBX segment to Observation FHIR resource mapping function
- obrToDiagnosticReport? ObrToDiagnosticReport - OBR segment to DiagnosticReport FHIR resource mapping function
- al1ToAllerygyIntolerance? Al1ToAllerygyIntolerance - AL1 segment to AllergyIntolerance FHIR resource mapping function
- evnToProvenance? EvnToProvenance - EVN segment to Provenance FHIR resource mapping function
- mshToMessageHeader? MshToMessageHeader - MSH segment to MessageHeader FHIR resource mapping function
- pv2ToEncounter? Pv2ToEncounter - PV2 segment to Encounter FHIR resource mapping function
- orcToImmunization? OrcToImmunization - ORC segment to Immunization FHIR resource mapping function
health.hl7v2.utils.v2tofhirr4: V2ToFhirCustomMapperServiceConfig
Fields
- baseUrl string -
Union types
health.hl7v2.utils.v2tofhirr4: Ce
Ce
Union type for CE data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Cwe
Cwe
Union type for CWE data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Xad
Xad
Union type for XAD data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Xon
Xon
Union type for XON data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Xpn
Xpn
Union type for XPN data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Xtn
Xtn
Union type for XTN data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Hd
Hd
Union type for HD data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Pt
Pt
Union type for PT data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Ei
Ei
Union type for EI data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Id
Id
Union type for ID data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Xcn
Xcn
Union type for XCN data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Dtm
Dtm
Union type for DTM data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Ts
Ts
Union type for TS data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Is
Is
Union type for IS data type for all supported hl7 versions.
health.hl7v2.utils.v2tofhirr4: Msh
DeprecatedMsh
Union types for holding hl7 segments for supported hl7 versions.
######################################################################## Union type for holding message header segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Al1
DeprecatedAl1
Union type for holding patient allergy information segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Evn
DeprecatedEvn
Union type for holding event type segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Dg1
DeprecatedDg1
Union type for holding patient visit segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk1
DeprecatedNk1
Union type for holding next of kin segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pd1
DeprecatedPd1
Union type for holding patient identification segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid
DeprecatedPid
Union type for holding patient identification segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pv1
DeprecatedPv1
Union type for holding patient visit segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pv2
DeprecatedPv2
Union type for holding patient visit additional information segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Obx
DeprecatedObx
Union type for holding observation segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Orc
DeprecatedOrc
Union type for holding common order segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Obr
DeprecatedObr
Union type for holding observation request segment for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid5
DeprecatedPid5
Union types defined for data types for supported hl7 versions.
###################################################################### Union type for holding patient name for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid9
DeprecatedPid9
Union type for holding patient alias name for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid11
DeprecatedPid11
Union type for holding patient address for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid13
DeprecatedPid13
Union type for holding patient home phone number for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid14
DeprecatedPid14
Union type for holding patient business phone number for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid15
DeprecatedPid15
Union type for holding patient primary language for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pid16
DeprecatedPid16
Union type for holding patient marital status for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pd13
DeprecatedPd13
Union type for patient primary facility for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Pd14
DeprecatedPd14
Union type for patient primary care provider for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk12
DeprecatedNk12
Union type for patient's extended person's name for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk14
DeprecatedNk14
Union type for patient's extended person's address for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk15
DeprecatedNk15
Union type for patient's extended person's home phone number for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk16
DeprecatedNk16
Union type for patient's extended person's business phone number for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk17
DeprecatedNk17
Union type for patient's extended person's contact role for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk18
DeprecatedNk18
Union type for patient's extended person's start date for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk19
DeprecatedNk19
Union type for patient's extended person's end date for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk113
DeprecatedNk113
Union type for patient's extended person's organization name for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk115
DeprecatedNk115
Union type for patient's extended person's gender for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk130
DeprecatedNk130
Union type for patient's extended person's contact person name for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk131
DeprecatedNk131
Union type for patient's extended person's contact person phone number for all supported hl7 versions.
Deprecated
health.hl7v2.utils.v2tofhirr4: Nk132
DeprecatedNk132
Union type for patient's extended person's contact person address for all supported hl7 versions.
Deprecated
Function types
health.hl7v2.utils.v2tofhirr4: Pv1ToPatient
function(Pv1) returns (Patient)
Pv1ToPatient
#################################################################################################### Mapping function definitions for V2 to FHIR #################################################################################################### Mapping function type for PV1 segment to Patient FHIR resource.
health.hl7v2.utils.v2tofhirr4: Pv1ToEncounter
function(Pv1) returns (Encounter)
Pv1ToEncounter
Mapping function type for PV1 segment to Encounter FHIR resource.
health.hl7v2.utils.v2tofhirr4: Nk1ToPatient
function(Nk1) returns (Patient)
Nk1ToPatient
Mapping function type for NK1 segment to Patient FHIR resource.
health.hl7v2.utils.v2tofhirr4: Pd1ToPatient
function(Pd1) returns (Patient)
Pd1ToPatient
Mapping function type for PD1 segment to Patient FHIR resource.
health.hl7v2.utils.v2tofhirr4: PidToPatient
function(Pid) returns (Patient)
PidToPatient
Mapping function type for PID segment to Patient FHIR resource.
health.hl7v2.utils.v2tofhirr4: Dg1ToCondition
function(Dg1) returns (Condition)
Dg1ToCondition
Mapping function type for DG1 segment to Condition FHIR resource.
health.hl7v2.utils.v2tofhirr4: Dg1ToEncounter
function(Dg1, string?) returns (Encounter)
Dg1ToEncounter
Mapping function type for DG1 segment to Encounter FHIR resource.
health.hl7v2.utils.v2tofhirr4: Dg1ToEpisodeOfCare
function(Dg1, string?, string?) returns (EpisodeOfCare)
Dg1ToEpisodeOfCare
Mapping function type for DG1 segment to EpisodeOfCare FHIR resource.
health.hl7v2.utils.v2tofhirr4: ObxToObservation
function(Obx) returns (Observation)
ObxToObservation
Mapping function type for OBX segment to Observation FHIR resource.
health.hl7v2.utils.v2tofhirr4: ObrToDiagnosticReport
function(Obr) returns (DiagnosticReport)
ObrToDiagnosticReport
Mapping function type for OBR segment to DiagnosticReport FHIR resource.
health.hl7v2.utils.v2tofhirr4: Al1ToAllerygyIntolerance
function(Al1) returns (AllergyIntolerance)
Al1ToAllerygyIntolerance
Mapping function type for AL1 segment to AllergyIntolerance FHIR resource.
health.hl7v2.utils.v2tofhirr4: EvnToProvenance
function(Evn) returns (Provenance)
EvnToProvenance
Mapping function type for EVN segment to Provenance FHIR resource.
health.hl7v2.utils.v2tofhirr4: MshToMessageHeader
function(Msh) returns (MessageHeader)
MshToMessageHeader
Mapping function type for MSH segment to MessageHeader FHIR resource.
health.hl7v2.utils.v2tofhirr4: Pv2ToEncounter
function(Pv2) returns (Encounter)
Pv2ToEncounter
Mapping function type for PV2 segment to Encounter FHIR resource.
health.hl7v2.utils.v2tofhirr4: OrcToImmunization
function(Orc) returns (Immunization)
OrcToImmunization
Mapping function type for ORC segment to Immunization FHIR resource.
Import
import ballerinax/health.hl7v2.utils.v2tofhirr4;
Metadata
Released date: 16 days ago
Version: 4.0.0
Compatibility
Platform: any
Ballerina version: 2201.12.3
GraalVM compatible: Yes
Pull count
Total: 1635
Current verison: 13
Weekly downloads
Keywords
Healthcare
HL7
FHIR
Contributors