Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ncrouzier-nist committed Jan 29, 2025
0 parents commit 0efa18b
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 0 deletions.
73 changes: 73 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>gov.nist.healthcare.pcd.pcdtool</groupId>
<artifactId>pcdtool-core</artifactId>
<version>1.0.0-SNAPSHOT</version>
<name>pcdtool-core</name>

<properties>
<hitcorehl7v2.version>1.0.25.ex-SNAPSHOT</hitcorehl7v2.version>
<hitcorexml.version>1.0.2.ex-SNAPSHOT</hitcorexml.version>
<hitcorewctp.version>0.0.1-SNAPSHOT</hitcorewctp.version>
</properties>

<dependencies>
<dependency>
<groupId>gov.nist.hit.core.hl7v2</groupId>
<artifactId>hit-core-hl7v2-api</artifactId>
<version>${hitcorehl7v2.version}</version>
</dependency>
<!--<dependency>
<groupId>gov.nist.hit.core.xml</groupId>
<artifactId>hit-core-xml-api</artifactId>
<version>${hitcorexml.version}</version>
</dependency> -->
<dependency>
<groupId>gov.nist.hit.core.wctp</groupId>
<artifactId>hit-core-wctp-api</artifactId>
<version>${hitcorewctp.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<scm>
<connection>scm:git:https://github.com/usnistgov/hit-mu-tools-core.git</connection>
<developerConnection>scm:git:https://github.com/usnistgov/hit-mu-tools-core.git</developerConnection>
<tag>HEAD</tag>
</scm>
<distributionManagement>
<repository>
<id>releases</id>
<url>https://hit-nexus.nist.gov/repository/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Snapshots</name>
<url>https://hit-nexus.nist.gov/repository/snapshots</url>
</snapshotRepository>
</distributionManagement>

</project>
20 changes: 20 additions & 0 deletions src/main/java/gov/nist/hit/pcd/core/PCDResourceLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package gov.nist.hit.pcd.core;

import gov.nist.hit.core.service.ResourceLoader;

/**
* This software was developed at the National Institute of Standards and Technology by employees of
* the Federal Government in the course of their official duties. Pursuant to title 17 Section 105
* of the United States Code this software is not subject to copyright protection and is in the
* public domain. This is an experimental system. NIST assumes no responsibility whatsoever for its
* use by other parties, and makes no guarantees, expressed or implied, about its quality,
* reliability, or any other characteristic. We would appreciate acknowledgement if the software is
* used. This software can be redistributed and/or modified freely provided that any derivative
* works bear some notice that they are derived from it, and any modified versions bear some notice
* that they have been modified.
* <p>
* Created by Nicolas Crouzier on 7/24/2018.
*/

public abstract class PCDResourceLoader extends ResourceLoader {
}
125 changes: 125 additions & 0 deletions src/main/java/gov/nist/hit/pcd/core/PCDResourceLoaderImpl.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
package gov.nist.hit.pcd.core;

import java.io.IOException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.JsonNode;

import gov.nist.hit.core.domain.ProfileModel;
import gov.nist.hit.core.domain.ResourceUploadStatus;
import gov.nist.hit.core.domain.TestCaseDocument;
import gov.nist.hit.core.domain.TestContext;
import gov.nist.hit.core.domain.TestScope;
import gov.nist.hit.core.domain.TestingStage;
import gov.nist.hit.core.domain.VocabularyLibrary;
import gov.nist.hit.core.hl7v2.service.HL7V2ResourceLoader;
import gov.nist.hit.core.service.exception.ProfileParserException;
import gov.nist.hit.core.service.wctp.WCTPResourceLoader;

public class PCDResourceLoaderImpl extends PCDResourceLoader {

@Autowired
@Qualifier("hl7v2ResourceLoader")
HL7V2ResourceLoader hl7v2rb;

@Autowired
@Qualifier("wctpResourceLoader")
WCTPResourceLoader wctprb;

@Override
public List<ResourceUploadStatus> addOrReplaceValueSet(String rootPath, String domain, TestScope scope,
String username, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceValueSet(rootPath, domain, scope, username, preloaded);
}

@Override
public List<ResourceUploadStatus> addOrReplaceConstraints(String rootPath, String domain, TestScope scope,
String username, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceConstraints(rootPath, domain, scope, username, preloaded);
}

@Override
public List<ResourceUploadStatus> addOrReplaceIntegrationProfile(String rootPath, String domain, TestScope scope,
String username, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceIntegrationProfile(rootPath, domain, scope, username, preloaded);
}

@Override
public List<ResourceUploadStatus> addOrReplaceValueSetBindings(String rootPath, String domain, TestScope scope,
String authorUsername, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceValueSetBindings(rootPath, domain, scope, authorUsername, preloaded);
}

@Override
public List<ResourceUploadStatus> addOrReplaceCoConstraints(String rootPath, String domain, TestScope scope,
String authorUsername, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceCoConstraints(rootPath, domain, scope, authorUsername, preloaded);
}

@Override
public List<ResourceUploadStatus> addOrReplaceSlicings(String rootPath, String domain, TestScope scope,
String authorUsername, boolean preloaded) throws IOException {
return hl7v2rb.addOrReplaceSlicings(rootPath, domain, scope, authorUsername, preloaded);
}

@Override
public TestContext testContext(String location, JsonNode parentOb, TestingStage stage, String rootPath,
String domain, TestScope scope, String authorUsername, boolean preloaded) throws Exception {
if (parentOb.has("wctp")) {
return wctprb.testContext(location, parentOb, stage, rootPath, domain, scope, authorUsername, preloaded);
}else {
// if (!parentOb.findValues("hl7v2").isEmpty()) {
return hl7v2rb.testContext(location, parentOb, stage, rootPath, domain, scope, authorUsername, preloaded);
}
// return null;
}

@Override
public TestCaseDocument generateTestCaseDocument(TestContext c) throws IOException {
if ("wctp".equals(c.getFormat())) {
return wctprb.generateTestCaseDocument(c);
}else {
// if ("hl7v2".equals(c.getFormat())) {
return hl7v2rb.generateTestCaseDocument(c);
}
// return new TestCaseDocument();
}

@Override
public ProfileModel parseProfile(String integrationProfileXml, String conformanceProfileId, String constraintsXml,
String additionalConstraintsXml) throws ProfileParserException, UnsupportedOperationException {
return hl7v2rb.parseProfile(integrationProfileXml, conformanceProfileId, constraintsXml,
additionalConstraintsXml);
}

@Override
public VocabularyLibrary vocabLibrary(String content, String domain, TestScope scope, String authorUsername,
boolean preloaded)
throws JsonGenerationException, JsonMappingException, IOException, UnsupportedOperationException {
return hl7v2rb.vocabLibrary(content, domain, scope, authorUsername, preloaded);
}

// @Override
// public ProfileModel parseEnhanced(String integrationProfileXml, String conformanceProfileId,
// String constraintsXml, String additionalConstraintsXml, String valueSetBindings, String coConstraints,
// String slicings) throws ProfileParserException, UnsupportedOperationException {
// return hl7v2rb.parseEnhanced(integrationProfileXml, conformanceProfileId, constraintsXml,
// additionalConstraintsXml,valueSetBindings, coConstraints, slicings);
// }

@Override
public ProfileModel parseEnhanced(String integrationProfileXml, String conformanceProfileId,
String constraintsXml, String additionalConstraintsXml, String valueSets, String valueSetBindings,
String coConstraints,
String slicings) throws ProfileParserException, UnsupportedOperationException {
return hl7v2rb.parseEnhanced(integrationProfileXml, conformanceProfileId, constraintsXml,
additionalConstraintsXml, valueSets, valueSetBindings, coConstraints, slicings);
}


}

0 comments on commit 0efa18b

Please sign in to comment.