Skip to content

Feature/petasos version 1.5 #472

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ plugins {
id 'signing'
}

group = 'io.github.linuxforhealth'
// group = 'io.github.linuxforhealth'
group = 'net.fhirfactory.pegacorn'
version = (findProperty('version') == 'unspecified') ? '1.0.1-SNAPSHOT' : version
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
distributionUrl=https\://downloads.gradle-dn.com/distributions/gradle-6.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
263 changes: 263 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,263 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<!--***********************************************************************************-->
<!-- WARNING: -->
<!-- This pom file has been created for Pegacorn for ease of deployment. It is based -->
<!-- off of the pom generated by gradle and manually altered. It does not run tests -->
<!-- correctly. Any merging of upstream development (from linuxforhealth) may require -->
<!-- manual changes to this pom. Alternatively the install can be created directly -->
<!-- from gradle using 'gradle publishToMavenLocal' and then generating as normal. -->
<!-- Note that there is option to call gradle publish from maven using a plugin but -->
<!-- this option has not been looked into in detail -->
<!--***********************************************************************************-->

<modelVersion>4.0.0</modelVersion>

<!--***********************************************************************************-->
<!-- -->
<!-- Project Metadata -->
<!-- -->
<!--***********************************************************************************-->

<parent>
<groupId>net.fhirfactory.pegacorn</groupId>
<artifactId>pegacorn</artifactId>
<version>1.5.0-SNAPSHOT</version>
<relativePath>../pegacorn</relativePath>
</parent>

<artifactId>pegacorn-hl7v2-fhir-converter</artifactId>
<packaging>jar</packaging>
<version>1.0.1-SNAPSHOT</version>

<name>Pegacorn :: HL7-FHIR-Converter</name>
<description>Converter of HL7 to FHIR JSON</description>

<!--***********************************************************************************-->
<!-- -->
<!-- Project Dependencies -->
<!-- -->
<!--***********************************************************************************-->

<!-- TODO: change from explicit versions to properties -->

<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi</groupId>
<artifactId>hapi-base</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi</groupId>
<artifactId>hapi-structures-v26</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>5.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-jexl3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-registry</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>com.ibm.fhir</groupId>
<artifactId>fhir-term</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.json</groupId>
<artifactId>jakarta.json-api</artifactId>
<version>2.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.2</version>
<scope>test</scope>
</dependency>

<!--*******************************************************************************-->
<!-- Logging (SLF4J) Libraries -->
<!--*******************************************************************************-->

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version-ch.qos.logback-classic}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${version-ch.qos.logback-classic}</version>
<scope>compile</scope>
</dependency>

</dependencies>

<!--***********************************************************************************-->
<!-- -->
<!-- Project Build -->
<!-- -->
<!--***********************************************************************************-->

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version-org.apache.maven-compiler-plugin}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version-org.apache.maven-surefire-plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${version-org.apache.maven-failsafe-plugin}</version>
</plugin>

</plugins>
</build>

<!--***********************************************************************************-->
<!-- -->
<!-- Project Profiles -->
<!-- -->
<!--***********************************************************************************-->

<profiles>
<profile>
<!-- The default profile skips all tests as this pom does not yet run tests correctly -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version-org.apache.maven-surefire-plugin}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
public class HL7ToFHIRConverter {
private static HL7HapiParser hparser = new HL7HapiParser();
private static final Logger LOGGER = LoggerFactory.getLogger(HL7ToFHIRConverter.class);
private static final String FALLBACK_BASE = "Fallback_Base"; // fallback configuration file to use when Trigger Event does not match anything (only used if enabled in supported.hl7.messages)
private Map<String, HL7MessageModel> messagetemplates = new HashMap<>();

/**
Expand Down Expand Up @@ -130,7 +131,15 @@ public String convert(String hl7MessageData, ConverterOptions options) {
if (hl7MessageTemplateModel != null) {
return hl7MessageTemplateModel.convert(hl7message, engine);
} else {
throw new UnsupportedOperationException("Message type not yet supported " + messageType);
// try to get the our fallback template
hl7MessageTemplateModel = messagetemplates.get(FALLBACK_BASE);
if (hl7MessageTemplateModel != null) {
// fallback template is enabled so use it just like a normal message template model
return hl7MessageTemplateModel.convert(hl7message, engine);
} else {
// it is not enabled by being in the supported.hl7.messages
throw new UnsupportedOperationException("Message type not yet supported " + messageType);
}
}
} else {
throw new IllegalArgumentException("Parsed HL7 message was null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public enum SimpleDataTypeMapper {
ALLERGY_INTOLERANCE_CATEGORY(SimpleDataValueResolver.ALLERGY_INTOLERANCE_CATEGORY_CODE_FHIR),
ALLERGY_INTOLERANCE_CRITICALITY(
SimpleDataValueResolver.ALLERGY_INTOLERANCE_CRITICALITY_CODE_FHIR),
ALLERGY_INTOLERANCE_TYPE(SimpleDataValueResolver.ALLERGY_INTOLERANCE_TYPE_CODE_FHIR),
ADMINISTRATIVE_GENDER(SimpleDataValueResolver.ADMINISTRATIVE_GENDER_CODE_FHIR),
CONDITION_CATEGORY_CODES(SimpleDataValueResolver.CONDITION_CATEGORY_CODES),
DIAGNOSTIC_REPORT_STATUS(SimpleDataValueResolver.DIAGNOSTIC_REPORT_STATUS_CODES),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory;
import org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality;
import org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType;
import org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus;
import org.hl7.fhir.r4.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.r4.model.Immunization.ImmunizationStatus;
Expand Down Expand Up @@ -577,6 +578,11 @@ private static final SimpleCode commonCodingSystemV2 (String table, String code,
String val = Hl7DataHandlerUtil.getStringValue(value);
return getFHIRCode(val, AllergyIntoleranceCategory.class);
};

public static final ValueExtractor<Object, String> ALLERGY_INTOLERANCE_TYPE_CODE_FHIR = (Object value) -> {
String val = Hl7DataHandlerUtil.getStringValue(value);
return getFHIRCode(val, AllergyIntoleranceType.class);
};

public static final ValueExtractor<Object, String> DOSE_SYSTEM = (Object value) -> {
String val = Hl7DataHandlerUtil.getStringValue(value);
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/config.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
base.path.resource=
supported.hl7.messages=ADT_A01, ADT_A08, ADT_A34, ADT_A40, MDM_T02, MDM_T06, ORM_O01, OMP_O09, ORU_R01, PPR_PC1, RDE_O11, RDE_O25, VXU_V04
default.zoneid=+08:00
supported.hl7.messages=Fallback_Base, ADT_A01, ADT_A04, ADT_A05, ADT_A08, ADT_A31, ADT_A34, ADT_A40, ADT_A60, MDM_T02, MDM_T06, ORM_O01, OMP_O09, ORU_R01, PPR_PC1, RDE_O11, RDE_O25, VXU_V04
default.zoneid=+11:00
additional.conceptmap.file=
1 change: 1 addition & 0 deletions src/main/resources/fhir/resourcemapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Condition: org.hl7.fhir.r4.model.Condition
Practitioner: org.hl7.fhir.r4.model.Practitioner
DiagnosticReport: org.hl7.fhir.r4.model.DiagnosticReport
Immunization: org.hl7.fhir.r4.model.Immunization
Location: org.hl7.fhir.r4.model.Location
Organization: org.hl7.fhir.r4.model.Organization
MessageHeader: org.hl7.fhir.r4.model.MessageHeader
Medication: org.hl7.fhir.r4.model.Medication
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/hl7/codesystem/v2ToFhirMapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,19 @@
AllergyIntoleranceCategory:
AA: environment
DA: medication
DRUG: medication
EA: environment
FA: food
FOOD: food
LA: environment
PA: environment
AllergyIntoleranceCriticality:
MI: low
SV: high
U: unable-to-assess
AllergyIntoleranceType:
AL: allergy
IN: intolerance
ObservationStatus:
C: corrected
D: cancelled
Expand Down
Loading