Convertor refactor iii (#635)
* Move loaders to own packages * Move inner loader classes up one level * Use lombok annotaions for BaseLoaderX classes * Move ADLImporter * Use lombok for ADLImporter inner classes * Move inner ADLImporter classes up one level * Move misc classes with inner classes to their own packages * Encapsulate and add lombok to misc internal classes * Move inner misc classes up one level * Clean up explicit type arguments * Revert back to master validator_test_case_version in pom.xml * Update RELEASE_NOTES.md Co-authored-by: David Otasek <david.otasek@Davids-MacBook-Pro.local>
This commit is contained in:
parent
83b1702cc5
commit
20989776db
|
@ -0,0 +1 @@
|
|||
* Refactoring of converter loader and misc packages.
|
|
@ -37,9 +37,9 @@ import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40;
|
|||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_40;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40;
|
||||
import org.hl7.fhir.convertors.loaders.R2016MayToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R2ToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R3ToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR4.R2016MayToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR4.R2ToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR4.R3ToR4Loader;
|
||||
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.conformance.ProfileUtilities;
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.convertors;
|
|||
|
||||
*/
|
||||
|
||||
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR3.R2ToR3Loader;
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.dstu3.elementmodel.Manager;
|
||||
import org.hl7.fhir.dstu3.elementmodel.Manager.FhirFormat;
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
||||
public abstract class BaseLoaderR3 implements IContextResourceLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
private final String[] types;
|
||||
private final ILoaderKnowledgeProvider lkp;
|
||||
protected boolean patchUrls;
|
||||
protected boolean killPrimitives;
|
||||
|
||||
public BaseLoaderR3(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public BaseLoaderR3 setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public BaseLoaderR3 setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ILoaderKnowledgeProvider {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
||||
|
||||
public static class NullLoaderKnowledgeProvider implements ILoaderKnowledgeProvider {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
|
||||
import org.hl7.fhir.r4.context.SimpleWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
|
||||
public abstract class BaseLoaderR4 implements IContextResourceLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
private final String[] types;
|
||||
private final ILoaderKnowledgeProvider lkp;
|
||||
protected boolean patchUrls;
|
||||
protected boolean killPrimitives;
|
||||
|
||||
public BaseLoaderR4(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public BaseLoaderR4 setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public BaseLoaderR4 setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ILoaderKnowledgeProvider {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
||||
|
||||
public static class NullLoaderKnowledgeProvider implements ILoaderKnowledgeProvider {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR3;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Accessors(chain = true)
|
||||
public abstract class BaseLoaderR3 implements IContextResourceLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
@Getter private final String[] types;
|
||||
private final ILoaderKnowledgeProviderR3 lkp;
|
||||
|
||||
@Getter @Setter protected boolean patchUrls;
|
||||
@Getter @Setter protected boolean killPrimitives;
|
||||
|
||||
public BaseLoaderR3(@Nonnull String[] types, @Nonnull ILoaderKnowledgeProviderR3 lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR3;
|
||||
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
||||
public interface ILoaderKnowledgeProviderR3 {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR3;
|
||||
|
||||
import org.hl7.fhir.dstu3.model.Resource;
|
||||
|
||||
public class NullLoaderKnowledgeProviderR3 implements ILoaderKnowledgeProviderR3 {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR3;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -55,7 +55,7 @@ public class R2ToR3Loader extends BaseLoaderR3 {
|
|||
private final BaseAdvisor_10_30 advisor_10_30 = new BaseAdvisor_10_30();
|
||||
|
||||
public R2ToR3Loader() {
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
super(new String[0], new NullLoaderKnowledgeProviderR3());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -0,0 +1,42 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hl7.fhir.r4.context.SimpleWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@Accessors(chain = true)
|
||||
public abstract class BaseLoaderR4 implements IContextResourceLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
protected final String URL_DSTU2 = "http://hl7.org/fhir/1.0/";
|
||||
protected final String URL_DSTU2016MAY = "http://hl7.org/fhir/1.4/";
|
||||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
@Getter private final String[] types;
|
||||
private final ILoaderKnowledgeProviderR4 lkp;
|
||||
@Getter @Setter protected boolean patchUrls;
|
||||
@Getter @Setter protected boolean killPrimitives;
|
||||
|
||||
public BaseLoaderR4(@Nonnull String[] types, @Nonnull ILoaderKnowledgeProviderR4 lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
||||
public void setPath(Resource r) {
|
||||
String path = lkp.getResourcePath(r);
|
||||
if (path != null) {
|
||||
r.setUserData("path", path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
|
||||
public interface ILoaderKnowledgeProviderR4 {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
import org.hl7.fhir.r4.model.Resource;
|
||||
|
||||
public class NullLoaderKnowledgeProviderR4 implements ILoaderKnowledgeProviderR4 {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -55,7 +55,7 @@ public class R2ToR4Loader extends BaseLoaderR4 {
|
|||
private final BaseAdvisor_10_40 advisor = new BaseAdvisor_10_40();
|
||||
|
||||
public R2ToR4Loader() {
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
super(new String[0], new NullLoaderKnowledgeProviderR4());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR4;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -54,7 +54,7 @@ public class R3ToR4Loader extends BaseLoaderR4 implements IContextResourceLoader
|
|||
private final BaseAdvisor_30_40 advisor = new BaseAdvisor_30_40();
|
||||
|
||||
public R3ToR4Loader() {
|
||||
super(new String[0], new NullLoaderKnowledgeProvider());
|
||||
super(new String[0], new NullLoaderKnowledgeProviderR4());
|
||||
}
|
||||
|
||||
@Override
|
|
@ -1,6 +1,9 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
|
@ -9,6 +12,7 @@ import org.hl7.fhir.utilities.npm.NpmPackage;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
@Accessors(chain = true)
|
||||
public abstract class BaseLoaderR5 implements IContextResourceLoader {
|
||||
|
||||
protected final String URL_BASE = "http://hl7.org/fhir/";
|
||||
|
@ -17,39 +21,17 @@ public abstract class BaseLoaderR5 implements IContextResourceLoader {
|
|||
protected final String URL_DSTU3 = "http://hl7.org/fhir/3.0/";
|
||||
protected final String URL_R4 = "http://hl7.org/fhir/4.0/";
|
||||
protected final String URL_ELEMENT_DEF_NAMESPACE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace";
|
||||
protected boolean patchUrls;
|
||||
protected boolean killPrimitives;
|
||||
protected String[] types;
|
||||
protected ILoaderKnowledgeProvider lkp;
|
||||
@Getter @Setter protected boolean patchUrls;
|
||||
@Getter @Setter protected boolean killPrimitives;
|
||||
@Getter protected String[] types;
|
||||
protected ILoaderKnowledgeProviderR5 lkp;
|
||||
|
||||
public BaseLoaderR5(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public BaseLoaderR5(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super();
|
||||
this.types = types;
|
||||
this.lkp = lkp;
|
||||
}
|
||||
|
||||
public String[] getTypes() {
|
||||
return types;
|
||||
}
|
||||
|
||||
public boolean isPatchUrls() {
|
||||
return patchUrls;
|
||||
}
|
||||
|
||||
public BaseLoaderR5 setPatchUrls(boolean patchUrls) {
|
||||
this.patchUrls = patchUrls;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isKillPrimitives() {
|
||||
return killPrimitives;
|
||||
}
|
||||
|
||||
public BaseLoaderR5 setKillPrimitives(boolean killPrimitives) {
|
||||
this.killPrimitives = killPrimitives;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getResourcePath(Resource resource) {
|
||||
return lkp.getResourcePath(resource);
|
||||
}
|
||||
|
@ -84,27 +66,4 @@ public abstract class BaseLoaderR5 implements IContextResourceLoader {
|
|||
}
|
||||
}
|
||||
|
||||
public interface ILoaderKnowledgeProvider {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
|
||||
ILoaderKnowledgeProvider forNewPackage(NpmPackage npm) throws JsonSyntaxException, IOException;
|
||||
}
|
||||
|
||||
public static class NullLoaderKnowledgeProvider implements ILoaderKnowledgeProvider {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILoaderKnowledgeProvider forNewPackage(NpmPackage npm) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public interface ILoaderKnowledgeProviderR5 {
|
||||
/**
|
||||
* get the path for references to this resource.
|
||||
*
|
||||
* @param resource
|
||||
* @return null if not tracking paths
|
||||
*/
|
||||
String getResourcePath(Resource resource);
|
||||
|
||||
ILoaderKnowledgeProviderR5 forNewPackage(NpmPackage npm) throws JsonSyntaxException, IOException;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
|
||||
public class NullLoaderKnowledgeProviderR5 implements ILoaderKnowledgeProviderR5 {
|
||||
@Override
|
||||
public String getResourcePath(Resource resource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILoaderKnowledgeProviderR5 forNewPackage(NpmPackage npm) {
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -53,7 +53,7 @@ public class R2016MayToR5Loader extends BaseLoaderR5 {
|
|||
|
||||
private final BaseAdvisor_14_50 advisor = new BaseAdvisor_14_50();
|
||||
|
||||
public R2016MayToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public R2016MayToR5Loader(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -53,7 +53,7 @@ public class R2ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
|
|||
|
||||
private final BaseAdvisor_10_50 advisor = new BaseAdvisor_10_50();
|
||||
|
||||
public R2ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public R2ToR5Loader(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -53,7 +53,7 @@ public class R3ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
|
|||
|
||||
private final BaseAdvisor_30_50 advisor = new BaseAdvisor_30_50();
|
||||
|
||||
public R3ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public R3ToR5Loader(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -53,7 +53,7 @@ public class R4ToR5Loader extends BaseLoaderR5 implements IContextResourceLoader
|
|||
|
||||
private final BaseAdvisor_40_50 advisor = new BaseAdvisor_40_50();
|
||||
|
||||
public R4ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public R4ToR5Loader(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.loaders;
|
||||
package org.hl7.fhir.convertors.loaders.loaderR5;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -50,7 +50,7 @@ public class R5ToR5Loader extends BaseLoaderR5 {
|
|||
// TODO Grahame, will this ever be populated? No conversion is being done?
|
||||
private final List<CodeSystem> cslist = new ArrayList<>();
|
||||
|
||||
public R5ToR5Loader(String[] types, ILoaderKnowledgeProvider lkp) {
|
||||
public R5ToR5Loader(String[] types, ILoaderKnowledgeProviderR5 lkp) {
|
||||
super(types, lkp);
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@ package org.hl7.fhir.convertors.misc;
|
|||
*/
|
||||
|
||||
|
||||
import org.hl7.fhir.convertors.misc.adl.ADLImporter;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xml.XMLUtil;
|
||||
|
|
|
@ -34,6 +34,7 @@ package org.hl7.fhir.convertors.misc;
|
|||
*/
|
||||
|
||||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.hl7.fhir.convertors.misc.ccda.CCDAConverter;
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.dstu3.formats.IParser;
|
||||
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.adl;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -133,20 +133,20 @@ public class ADLImporter {
|
|||
// load data and protocol
|
||||
Element definition = XMLUtil.getNamedChild(adl, "definition");
|
||||
NodeTreeEntry root = new NodeTreeEntry();
|
||||
root.typeName = XMLUtil.getNamedChild(definition, "rm_type_name").getTextContent();
|
||||
root.atCode = XMLUtil.getNamedChild(definition, "node_id").getTextContent();
|
||||
root.name = generateToken(root.atCode, true);
|
||||
sd.setName(root.name);
|
||||
root.cardinality = readCardinality("root", XMLUtil.getNamedChild(definition, "occurrences"));
|
||||
root.setTypeName(XMLUtil.getNamedChild(definition, "rm_type_name").getTextContent());
|
||||
root.setAtCode(XMLUtil.getNamedChild(definition, "node_id").getTextContent());
|
||||
root.setName(generateToken(root.getAtCode(), true));
|
||||
sd.setName(root.getName());
|
||||
root.setCardinality(readCardinality("root", XMLUtil.getNamedChild(definition, "occurrences")));
|
||||
set.clear();
|
||||
XMLUtil.getNamedChildren(definition, "attributes", set);
|
||||
for (Element item : set) {
|
||||
// we're actually skipping this level - we don't care about data protocol etc.
|
||||
Element attributes = item; // XMLUtil.getNamedChild(XMLUtil.getNamedChild(item, "children"), "attributes");
|
||||
loadChildren(root.atCode, root, attributes);
|
||||
loadChildren(root.getAtCode(), root, attributes);
|
||||
}
|
||||
dumpChildren("", root);
|
||||
genElements(sd, root.name, root);
|
||||
genElements(sd, root.getName(), root);
|
||||
|
||||
// save
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(dest), sd);
|
||||
|
@ -156,20 +156,20 @@ public class ADLImporter {
|
|||
private void genElements(StructureDefinition sd, String path, NodeTreeEntry item) throws Exception {
|
||||
ElementDefinition ed = sd.getSnapshot().addElement();
|
||||
ed.setPath(path);
|
||||
ed.setMax(item.cardinality.max);
|
||||
ed.setMin(Integer.parseInt(item.cardinality.min));
|
||||
ed.setShort(texts.get(item.atCode).text);
|
||||
ed.setDefinition(texts.get(item.atCode).description);
|
||||
ed.setComment(texts.get(item.atCode).comment);
|
||||
Element te = findTypeElement(item.typeName);
|
||||
ed.setMax(item.getCardinality().getMax());
|
||||
ed.setMin(Integer.parseInt(item.getCardinality().getMin()));
|
||||
ed.setShort(texts.get(item.getAtCode()).getText());
|
||||
ed.setDefinition(texts.get(item.getAtCode()).getDescription());
|
||||
ed.setComment(texts.get(item.getAtCode()).getComment());
|
||||
Element te = findTypeElement(item.getTypeName());
|
||||
if (te.hasAttribute("profile"))
|
||||
ed.addType().setCode(te.getAttribute("fhir")).setProfile(te.getAttribute("profile"));
|
||||
else
|
||||
ed.addType().setCode(te.getAttribute("fhir"));
|
||||
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
|
||||
|
||||
for (NodeTreeEntry child : item.children) {
|
||||
genElements(sd, path + "." + child.name, child);
|
||||
for (NodeTreeEntry child : item.getChildren()) {
|
||||
genElements(sd, path + "." + child.getName(), child);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,13 +185,13 @@ public class ADLImporter {
|
|||
}
|
||||
|
||||
private void dumpChildren(String prefix, NodeTreeEntry item) throws Exception {
|
||||
Element te = findTypeElement(item.typeName);
|
||||
Element te = findTypeElement(item.getTypeName());
|
||||
if (te.hasAttribute("profile"))
|
||||
System.out.println(prefix + item.atCode + " [" + item.cardinality.min + ".." + item.cardinality.max + "]:" + te.getAttribute("fhir") + "{" + te.getAttribute("profile") + "} // " + item.name + " = " + texts.get(item.atCode).text);
|
||||
System.out.println(prefix + item.getAtCode() + " [" + item.getCardinality().getMin() + ".." + item.getCardinality().getMax() + "]:" + te.getAttribute("fhir") + "{" + te.getAttribute("profile") + "} // " + item.getName() + " = " + texts.get(item.getAtCode()).getText());
|
||||
else
|
||||
System.out.println(prefix + item.atCode + " [" + item.cardinality.min + ".." + item.cardinality.max + "]:" + te.getAttribute("fhir") + " // " + item.name + " = " + texts.get(item.atCode).text);
|
||||
System.out.println(prefix + item.getAtCode() + " [" + item.getCardinality().getMin() + ".." + item.getCardinality().getMax() + "]:" + te.getAttribute("fhir") + " // " + item.getName() + " = " + texts.get(item.getAtCode()).getText());
|
||||
|
||||
for (NodeTreeEntry child : item.children)
|
||||
for (NodeTreeEntry child : item.getChildren())
|
||||
dumpChildren(prefix + " ", child);
|
||||
}
|
||||
|
||||
|
@ -200,22 +200,22 @@ public class ADLImporter {
|
|||
XMLUtil.getNamedChildren(attributes, "children", set);
|
||||
for (Element e : set) {
|
||||
NodeTreeEntry item = new NodeTreeEntry();
|
||||
item.typeName = XMLUtil.getNamedChild(e, "rm_type_name").getTextContent();
|
||||
item.atCode = XMLUtil.getNamedChild(e, "node_id").getTextContent();
|
||||
item.name = generateToken(item.atCode, false);
|
||||
item.cardinality = readCardinality(path + "/" + item.atCode, XMLUtil.getNamedChild(e, "occurrences"));
|
||||
parent.children.add(item);
|
||||
item.setTypeName(XMLUtil.getNamedChild(e, "rm_type_name").getTextContent());
|
||||
item.setAtCode(XMLUtil.getNamedChild(e, "node_id").getTextContent());
|
||||
item.setName(generateToken(item.getAtCode(), false));
|
||||
item.setCardinality(readCardinality(path + "/" + item.getAtCode(), XMLUtil.getNamedChild(e, "occurrences")));
|
||||
parent.getChildren().add(item);
|
||||
Element attr = XMLUtil.getNamedChild(e, "attributes");
|
||||
String type = attr.getAttribute("xsi:type");
|
||||
if ("C_SINGLE_ATTRIBUTE".equals(type)) {
|
||||
check(path, item.typeName, "ELEMENT", "type for simple element: " + item.typeName);
|
||||
check(path, item.getTypeName(), "ELEMENT", "type for simple element: " + item.getTypeName());
|
||||
checkCardSingle(path, XMLUtil.getNamedChild(attr, "existence"));
|
||||
Element c = XMLUtil.getNamedChild(attr, "children");
|
||||
checkCardSingle(path, XMLUtil.getNamedChild(c, "occurrences"));
|
||||
item.typeName = XMLUtil.getNamedChild(c, "rm_type_name").getTextContent();
|
||||
item.setTypeName(XMLUtil.getNamedChild(c, "rm_type_name").getTextContent());
|
||||
} else {
|
||||
check(path, item.typeName, "CLUSTER", "type for complex element");
|
||||
loadChildren(path + "/" + item.atCode, item, attr);
|
||||
check(path, item.getTypeName(), "CLUSTER", "type for complex element");
|
||||
loadChildren(path + "/" + item.getAtCode(), item, attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -261,11 +261,11 @@ public class ADLImporter {
|
|||
check(path, XMLUtil.getNamedChild(element, "upper_included").getTextContent(), "true", "Cardinality check");
|
||||
check(path, XMLUtil.getNamedChild(element, "lower_unbounded").getTextContent(), "false", "Cardinality check");
|
||||
Cardinality card = new Cardinality();
|
||||
card.min = XMLUtil.getNamedChild(element, "lower").getTextContent();
|
||||
card.setMin(XMLUtil.getNamedChild(element, "lower").getTextContent());
|
||||
if ("true".equals(XMLUtil.getNamedChild(element, "upper_unbounded").getTextContent()))
|
||||
card.max = "*";
|
||||
card.setMax("*");
|
||||
else
|
||||
card.max = XMLUtil.getNamedChild(element, "upper").getTextContent();
|
||||
card.setMax(XMLUtil.getNamedChild(element, "upper").getTextContent());
|
||||
return card;
|
||||
}
|
||||
|
||||
|
@ -293,50 +293,4 @@ public class ADLImporter {
|
|||
throw new Exception(message + ". Expected '" + expected + "' but found '" + found.trim() + "', at " + path);
|
||||
}
|
||||
|
||||
public class Cardinality {
|
||||
private String min;
|
||||
private String max;
|
||||
}
|
||||
|
||||
public class TextSet {
|
||||
|
||||
private String text;
|
||||
private String description;
|
||||
private String comment;
|
||||
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
|
||||
public void setText(String value) {
|
||||
this.text = value;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String value) {
|
||||
this.description = value;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String value) {
|
||||
this.comment = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class NodeTreeEntry {
|
||||
private final List<NodeTreeEntry> children = new ArrayList<NodeTreeEntry>();
|
||||
private String name;
|
||||
private String atCode;
|
||||
private String typeName;
|
||||
private Cardinality cardinality;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package org.hl7.fhir.convertors.misc.adl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Cardinality {
|
||||
private String min;
|
||||
private String max;
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
package org.hl7.fhir.convertors.misc.adl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class NodeTreeEntry {
|
||||
private final List<NodeTreeEntry> children = new ArrayList<NodeTreeEntry>();
|
||||
private String name;
|
||||
private String atCode;
|
||||
private String typeName;
|
||||
private Cardinality cardinality;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package org.hl7.fhir.convertors.misc.adl;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TextSet {
|
||||
|
||||
private String text;
|
||||
private String description;
|
||||
private String comment;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.argonaut;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -33,6 +33,10 @@ package org.hl7.fhir.convertors.misc;
|
|||
import org.apache.commons.io.IOUtils;
|
||||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.fhir.ucum.UcumService;
|
||||
import org.hl7.fhir.convertors.misc.CDAUtilities;
|
||||
import org.hl7.fhir.convertors.misc.ccda.CcdaExtensions;
|
||||
import org.hl7.fhir.convertors.misc.Convert;
|
||||
import org.hl7.fhir.convertors.misc.ConverterBase;
|
||||
import org.hl7.fhir.dstu3.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
|
||||
import org.hl7.fhir.dstu3.formats.JsonParser;
|
||||
|
@ -84,18 +88,18 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private final UcumService ucumSvc;
|
||||
// private ValidationEngine validator;
|
||||
private final SimpleWorkerContext context;
|
||||
private final Map<String, Map<String, Integer>> sections = new HashMap<String, Map<String, Integer>>();
|
||||
private final Map<String, Practitioner> practitionerCache = new HashMap<String, Practitioner>();
|
||||
private final Set<String> oids = new HashSet<String>();
|
||||
private final Map<String, ZipGenerator> zipsX = new HashMap<String, ZipGenerator>();
|
||||
private final Map<String, ZipGenerator> zipsJ = new HashMap<String, ZipGenerator>();
|
||||
private final Map<String, Stats> stats = new HashMap<String, Stats>();
|
||||
private final Map<String, Map<String, Integer>> sections = new HashMap<>();
|
||||
private final Map<String, Practitioner> practitionerCache = new HashMap<>();
|
||||
private final Set<String> oids = new HashSet<>();
|
||||
private final Map<String, ZipGenerator> zipsX = new HashMap<>();
|
||||
private final Map<String, ZipGenerator> zipsJ = new HashMap<>();
|
||||
private final Map<String, Stats> stats = new HashMap<>();
|
||||
public int perfCount;
|
||||
int errors = 0;
|
||||
int warnings = 0;
|
||||
Map<String, Integer> procCodes = new HashMap<String, Integer>();
|
||||
Map<String, Integer> condCodes = new HashMap<String, Integer>();
|
||||
Map<String, Integer> allergyCodes = new HashMap<String, Integer>();
|
||||
Map<String, Integer> procCodes = new HashMap<>();
|
||||
Map<String, Integer> condCodes = new HashMap<>();
|
||||
Map<String, Integer> allergyCodes = new HashMap<>();
|
||||
private String destFolder;
|
||||
private ZipGenerator zipJ;
|
||||
private ZipGenerator zipX;
|
||||
|
@ -150,7 +154,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
System.out.println("Statistics:");
|
||||
for (String n : sorted(stats.keySet())) {
|
||||
Stats s = stats.get(n);
|
||||
System.out.println(" " + n + ": generated " + s.instances + ", errors " + s.errors + ", warnings " + s.warnings);
|
||||
System.out.println(" " + n + ": generated " + s.getInstances() + ", errors " + s.getErrors() + ", warnings " + s.getWarnings());
|
||||
}
|
||||
|
||||
System.out.println("OIDs:");
|
||||
|
@ -169,7 +173,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
}
|
||||
|
||||
private List<String> sorted(Set<String> keys) {
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
names.addAll(keys);
|
||||
Collections.sort(names);
|
||||
return names;
|
||||
|
@ -189,17 +193,17 @@ public class ArgonautConverter extends ConverterBase {
|
|||
Convert convert = new Convert(cda, ucumSvc, "-0400");
|
||||
convert.setGenerateMissingExtensions(true);
|
||||
Context context = new Context();
|
||||
context.baseId = Utilities.changeFileExt(filename, "");
|
||||
context.encClass = clss;
|
||||
makeSubject(cda, convert, doc, context, context.baseId + "-patient");
|
||||
makeAuthor(cda, convert, doc, context, context.baseId + "-author");
|
||||
makeEncounter(cda, convert, doc, context, context.baseId + "-encounter");
|
||||
context.setBaseId(Utilities.changeFileExt(filename, ""));
|
||||
context.setEncClass(clss);
|
||||
makeSubject(cda, convert, doc, context, context.getBaseId() + "-patient");
|
||||
makeAuthor(cda, convert, doc, context, context.getBaseId() + "-author");
|
||||
makeEncounter(cda, convert, doc, context, context.getBaseId() + "-encounter");
|
||||
Element body = cda.getDescendent(doc, "component/structuredBody");
|
||||
for (Element c : cda.getChildren(body, "component")) {
|
||||
processSection(cda, convert, context, cda.getChild(c, "section"));
|
||||
}
|
||||
oids.addAll(convert.getOids());
|
||||
saveResource(context.encounter);
|
||||
saveResource(context.getEncounter());
|
||||
makeBinary(sourceFolder, filename, context);
|
||||
makeDocumentReference(cda, convert, doc, context);
|
||||
zipJ.close();
|
||||
|
@ -249,7 +253,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
if (sections.containsKey(name))
|
||||
section = sections.get(name);
|
||||
else {
|
||||
section = new HashMap<String, Integer>();
|
||||
section = new HashMap<>();
|
||||
sections.put(name, section);
|
||||
}
|
||||
iterateChildren(section, "/", child);
|
||||
|
@ -340,7 +344,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
zipsJ.get(rn).addBytes(resource.getId() + ".json", srcJ, false);
|
||||
zipsX.get(rn).addBytes(resource.getId() + ".xml", srcX, false);
|
||||
Stats ss = stats.get(rn);
|
||||
ss.instances++;
|
||||
ss.setInstances(ss.getInstances() + 1);
|
||||
|
||||
String profile = resource.getUserString("profile");
|
||||
validate(srcX, profile, resource, ss);
|
||||
|
@ -370,11 +374,11 @@ public class ArgonautConverter extends ConverterBase {
|
|||
}
|
||||
System.out.println(" " + m.getLevel().toCode() + ": " + m.getMessage() + " @ " + m.getLocation());
|
||||
if (m.getLevel() == IssueSeverity.WARNING) {
|
||||
stats.warnings++;
|
||||
stats.setWarnings(stats.getWarnings() + 1);
|
||||
warnings++;
|
||||
}
|
||||
if (m.getLevel() == IssueSeverity.ERROR || m.getLevel() == IssueSeverity.FATAL) {
|
||||
stats.errors++;
|
||||
stats.setErrors(stats.getErrors() + 1);
|
||||
errors++;
|
||||
}
|
||||
}
|
||||
|
@ -464,15 +468,15 @@ public class ArgonautConverter extends ConverterBase {
|
|||
if (prv != null)
|
||||
pat.setManagingOrganization(new Reference().setReference("Organization/" + processOrganization(prv, cda, convert, context).getId()));
|
||||
|
||||
context.subjectRef = new Reference().setDisplay(b.toString()).setReference("Patient/" + pat.getId());
|
||||
context.setSubjectRef(new Reference().setDisplay(b.toString()).setReference("Patient/" + pat.getId()));
|
||||
saveResource(pat);
|
||||
}
|
||||
|
||||
private Organization processOrganization(Element oo, CDAUtilities cda, Convert convert, Context context) throws Exception {
|
||||
Organization org = new Organization();
|
||||
org.setId(context.baseId + "-organization-" + context.orgId);
|
||||
org.setId(context.getBaseId() + "-organization-" + context.getOrgId());
|
||||
org.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/org-daf-daforganization");
|
||||
context.orgId++;
|
||||
context.setOrgId(context.getOrgId() + 1);
|
||||
for (Element e : cda.getChildren(oo, "id"))
|
||||
org.getIdentifier().add(convert.makeIdentifierFromII(e));
|
||||
for (Element e : cda.getChildren(oo, "addr"))
|
||||
|
@ -523,7 +527,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
Element a = cda.getChild(doc, "author");
|
||||
scanSection("Author", a);
|
||||
Practitioner author = processPerformer(cda, convert, context, a, "assignedAuthor", "assignedPerson");
|
||||
context.authorRef = new Reference().setDisplay(author.getUserString("display")).setReference("Practitioner/" + author.getId());
|
||||
context.setAuthorRef(new Reference().setDisplay(author.getUserString("display")).setReference("Practitioner/" + author.getId()));
|
||||
return author;
|
||||
}
|
||||
|
||||
|
@ -585,8 +589,8 @@ public class ArgonautConverter extends ConverterBase {
|
|||
Encounter enc = new Encounter();
|
||||
enc.setId(id);
|
||||
enc.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/encounter-daf-dafencounter");
|
||||
context.encounter = enc;
|
||||
enc.setSubject(context.subjectRef);
|
||||
context.setEncounter(enc);
|
||||
enc.setSubject(context.getSubjectRef());
|
||||
|
||||
for (Element e : cda.getChildren(ee, "id"))
|
||||
enc.getIdentifier().add(convert.makeIdentifierFromII(e));
|
||||
|
@ -601,7 +605,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
enc.setStatus(EncounterStatus.FINISHED);
|
||||
else
|
||||
enc.setStatus(EncounterStatus.INPROGRESS);
|
||||
enc.setClass_(context.encClass);
|
||||
enc.setClass_(context.getEncClass());
|
||||
|
||||
Element dd = cda.getChild(ee, "dischargeDispositionCode");
|
||||
if (dd != null) {
|
||||
|
@ -656,26 +660,26 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processProcedureSection(CDAUtilities cda, Convert convert, Element sect, Context context) throws Exception {
|
||||
scanSection("Procedures", sect);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-procedures");
|
||||
list.setId(context.getBaseId() + "-list-procedures");
|
||||
// list.setUserData("profile", "") none?
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(sect, "code")), null));
|
||||
list.setTitle(cda.getChild(sect, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(sect, "text"));
|
||||
|
||||
int i = 0;
|
||||
for (Element c : cda.getChildren(sect, "entry")) {
|
||||
Element p = cda.getChild(c, "procedure");
|
||||
Procedure proc = new Procedure();
|
||||
proc.setId(context.baseId + "-procedure-" + i);
|
||||
proc.setId(context.getBaseId() + "-procedure-" + i);
|
||||
proc.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/procedure-daf-dafprocedure");
|
||||
i++;
|
||||
proc.setSubject(context.subjectRef);
|
||||
proc.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
proc.setSubject(context.getSubjectRef());
|
||||
proc.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
list.addEntry().setItem(new Reference().setReference("Procedure/" + proc.getId()));
|
||||
proc.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(p, "code")), null));
|
||||
recordProcedureCode(proc.getCode());
|
||||
|
@ -725,32 +729,32 @@ public class ArgonautConverter extends ConverterBase {
|
|||
|
||||
private void processReasonForEncounter(CDAUtilities cda, Convert convert, Element sect, Context context) throws Exception {
|
||||
scanSection("Reason", sect);
|
||||
context.encounter.addReason().setText(cda.getChild(sect, "text").getTextContent());
|
||||
context.getEncounter().addReason().setText(cda.getChild(sect, "text").getTextContent());
|
||||
}
|
||||
|
||||
private void processProblemsSection(CDAUtilities cda, Convert convert, Element sect, Context context) throws Exception {
|
||||
scanSection("Problems", sect);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-problems");
|
||||
list.setId(context.getBaseId() + "-list-problems");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafproblemlist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(sect, "code")), null));
|
||||
list.setTitle(cda.getChild(sect, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(sect, "text"));
|
||||
|
||||
int i = 0;
|
||||
for (Element c : cda.getChildren(sect, "entry")) {
|
||||
Element pca = cda.getChild(c, "act"); // problem concern act
|
||||
Condition cond = new Condition();
|
||||
cond.setId(context.baseId + "-problem-" + i);
|
||||
cond.setId(context.getBaseId() + "-problem-" + i);
|
||||
cond.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/condition-daf-dafcondition");
|
||||
i++;
|
||||
cond.setSubject(context.subjectRef);
|
||||
cond.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
cond.setSubject(context.getSubjectRef());
|
||||
cond.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
cond.setVerificationStatus(getVerificationStatusFromAct(cda.getChild(pca, "statusCode")));
|
||||
|
||||
cond.setAssertedDateElement(convert.makeDateTimeFromTS(cda.getChild(cda.getChild(pca, "effectiveTime"), "low")));
|
||||
|
@ -795,14 +799,14 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processAllergiesSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
|
||||
scanSection("Allergies", section);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-allergies");
|
||||
list.setId(context.getBaseId() + "-list-allergies");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafallergylist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
|
@ -810,10 +814,10 @@ public class ArgonautConverter extends ConverterBase {
|
|||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element apa = cda.getChild(c, "act"); // allergy problem act
|
||||
AllergyIntolerance ai = new AllergyIntolerance();
|
||||
ai.setId(context.baseId + "-allergy-" + i);
|
||||
ai.setId(context.getBaseId() + "-allergy-" + i);
|
||||
ai.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/allergyintolerance-daf-dafallergyintolerance");
|
||||
i++;
|
||||
ai.setPatient(context.subjectRef);
|
||||
ai.setPatient(context.getSubjectRef());
|
||||
|
||||
ai.setAssertedDateElement(convert.makeDateTimeFromTS(cda.getChild(cda.getChild(apa, "effectiveTime"), "low")));
|
||||
boolean found = false;
|
||||
|
@ -859,15 +863,15 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processVitalSignsSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
|
||||
scanSection("Vital Signs", section);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-vitalsigns");
|
||||
list.setId(context.getBaseId() + "-list-vitalsigns");
|
||||
//. list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafproblemlist"); no list
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
int i = 0;
|
||||
|
@ -876,11 +880,11 @@ public class ArgonautConverter extends ConverterBase {
|
|||
for (Element oc : cda.getChildren(org, "component")) {
|
||||
Element o = cda.getChild(oc, "observation"); // problem concern act
|
||||
Observation obs = new Observation();
|
||||
obs.setId(context.baseId + "-vitals-" + i);
|
||||
obs.setId(context.getBaseId() + "-vitals-" + i);
|
||||
obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-vitalsigns-dafvitalsigns");
|
||||
i++;
|
||||
obs.setSubject(context.subjectRef);
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
obs.setSubject(context.getSubjectRef());
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), null));
|
||||
|
||||
boolean found = false;
|
||||
|
@ -909,27 +913,27 @@ public class ArgonautConverter extends ConverterBase {
|
|||
scanSection("Results", section);
|
||||
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-results");
|
||||
list.setId(context.getBaseId() + "-list-results");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafresultlist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
context.obsId = 0;
|
||||
context.setObsId(0);
|
||||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element org = cda.getChild(c, "organizer");
|
||||
if (org != null) {
|
||||
Observation panel = new Observation();
|
||||
panel.setId(context.baseId + "-results-" + context.obsId);
|
||||
panel.setId(context.getBaseId() + "-results-" + context.getObsId());
|
||||
panel.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-results-dafresultobspanel");
|
||||
context.obsId++;
|
||||
panel.setSubject(context.subjectRef);
|
||||
panel.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
context.setObsId(context.getObsId() + 1);
|
||||
panel.setSubject(context.getSubjectRef());
|
||||
panel.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
panel.setStatus(ObservationStatus.FINAL);
|
||||
boolean found = false;
|
||||
for (Element e : cda.getChildren(org, "id")) {
|
||||
|
@ -971,10 +975,10 @@ public class ArgonautConverter extends ConverterBase {
|
|||
|
||||
private Observation processObservation(CDAUtilities cda, Convert convert, Context context, Element o) throws Exception {
|
||||
Observation obs = new Observation();
|
||||
obs.setId(context.baseId + "-results-" + context.obsId);
|
||||
context.obsId++;
|
||||
obs.setSubject(context.subjectRef);
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
obs.setId(context.getBaseId() + "-results-" + context.getObsId());
|
||||
context.setObsId(context.getObsId() + 1);
|
||||
obs.setSubject(context.getSubjectRef());
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
obs.setStatus(ObservationStatus.FINAL);
|
||||
obs.setEffective(convert.makeDateTimeFromTS(cda.getChild(o, "effectiveTime")));
|
||||
obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), null));
|
||||
|
@ -1015,11 +1019,11 @@ public class ArgonautConverter extends ConverterBase {
|
|||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element o = cda.getChild(c, "observation");
|
||||
Observation obs = new Observation();
|
||||
obs.setId(context.baseId + "-smoking-" + (i == 0 ? "" : Integer.toString(i)));
|
||||
obs.setId(context.getBaseId() + "-smoking-" + (i == 0 ? "" : Integer.toString(i)));
|
||||
obs.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/observation-daf-smokingstatus-dafsmokingstatus");
|
||||
i++;
|
||||
obs.setSubject(context.subjectRef);
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
obs.setSubject(context.getSubjectRef());
|
||||
obs.setContext(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
obs.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(o, "code")), new Coding().setSystem("http://loinc.org").setCode("72166-2")));
|
||||
|
||||
boolean found = false;
|
||||
|
@ -1039,25 +1043,25 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processMedicationsSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
|
||||
scanSection("Medications", section);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-medications");
|
||||
list.setId(context.getBaseId() + "-list-medications");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafmedicationlist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
int i = 0;
|
||||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element sa = cda.getChild(c, "substanceAdministration"); // allergy problem act
|
||||
MedicationStatement ms = new MedicationStatement();
|
||||
ms.setId(context.baseId + "-medication-" + i);
|
||||
ms.setId(context.getBaseId() + "-medication-" + i);
|
||||
ms.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/medicationstatement-daf-dafmedicationstatement");
|
||||
i++;
|
||||
ms.setSubject(context.subjectRef);
|
||||
ms.setSubject(context.getSubjectRef());
|
||||
|
||||
boolean found = false;
|
||||
for (Element e : cda.getChildren(sa, "id")) {
|
||||
|
@ -1084,7 +1088,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
dosage.setDose(convert.makeQuantityFromPQ(qty));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(" invalid dose quantity '" + qty.getAttribute("value") + " " + qty.getAttribute("unit") + "' (" + e.getClass().getName() + ") in " + context.baseId);
|
||||
System.out.println(" invalid dose quantity '" + qty.getAttribute("value") + " " + qty.getAttribute("unit") + "' (" + e.getClass().getName() + ") in " + context.getBaseId());
|
||||
}
|
||||
dosage.setRoute(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(sa, "routeCode")), null));
|
||||
Type t = convert.makeSomethingFromGTS(cda.getChildren(sa, "effectiveTime"));
|
||||
|
@ -1114,25 +1118,25 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processEncountersSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
|
||||
scanSection("Encounters", section);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-encounters");
|
||||
list.setId(context.getBaseId() + "-list-encounters");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafencounterlist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
int i = 0;
|
||||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element ee = cda.getChild(c, "encounter"); // allergy problem act
|
||||
Encounter enc = new Encounter();
|
||||
enc.setId(context.baseId + "-encounter-" + i);
|
||||
enc.setId(context.getBaseId() + "-encounter-" + i);
|
||||
enc.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/encounter-daf-dafencounter");
|
||||
i++;
|
||||
enc.setSubject(context.subjectRef);
|
||||
enc.setSubject(context.getSubjectRef());
|
||||
list.addEntry().setItem(new Reference().setReference("Encounter/" + enc.getId()));
|
||||
|
||||
for (Element e : cda.getChildren(ee, "id"))
|
||||
|
@ -1187,26 +1191,26 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void processImmunizationsSection(CDAUtilities cda, Convert convert, Element section, Context context) throws Exception {
|
||||
scanSection("Immunizations", section);
|
||||
ListResource list = new ListResource();
|
||||
list.setId(context.baseId + "-list-immunizations");
|
||||
list.setId(context.getBaseId() + "-list-immunizations");
|
||||
list.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/list-daf-dafimmunizationlist");
|
||||
list.setSubject(context.subjectRef);
|
||||
list.setSubject(context.getSubjectRef());
|
||||
list.setCode(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(section, "code")), null));
|
||||
list.setTitle(cda.getChild(section, "title").getTextContent());
|
||||
list.setStatus(ListStatus.CURRENT);
|
||||
list.setMode(ListMode.SNAPSHOT);
|
||||
list.setDateElement(context.now);
|
||||
list.setSource(context.authorRef);
|
||||
list.setDateElement(context.getNow());
|
||||
list.setSource(context.getAuthorRef());
|
||||
buildNarrative(list, cda.getChild(section, "text"));
|
||||
|
||||
int i = 0;
|
||||
for (Element c : cda.getChildren(section, "entry")) {
|
||||
Element sa = cda.getChild(c, "substanceAdministration"); // allergy problem act
|
||||
Immunization imm = new Immunization();
|
||||
imm.setId(context.baseId + "-immunization-" + i);
|
||||
imm.setId(context.getBaseId() + "-immunization-" + i);
|
||||
imm.setUserData("profile", "http://hl7.org/fhir/StructureDefinition/immunization-daf-dafimmunization");
|
||||
i++;
|
||||
imm.setPatient(context.subjectRef);
|
||||
imm.setEncounter(new Reference().setReference("Encounter/" + context.encounter.getId()));
|
||||
imm.setPatient(context.getSubjectRef());
|
||||
imm.setEncounter(new Reference().setReference("Encounter/" + context.getEncounter().getId()));
|
||||
imm.setNotGiven("true".equals(sa.getAttribute("negationInd")));
|
||||
imm.setStatus(convertImmunizationStatus(cda.getChild(sa, "statusCode")));
|
||||
boolean found = false;
|
||||
|
@ -1273,7 +1277,7 @@ public class ArgonautConverter extends ConverterBase {
|
|||
|
||||
private void makeBinary(String sourceFolder, String filename, Context context) throws Exception {
|
||||
Binary binary = new Binary();
|
||||
binary.setId(context.baseId + "-binary");
|
||||
binary.setId(context.getBaseId() + "-binary");
|
||||
binary.setContentType("application/hl7-v3+xml");
|
||||
binary.setContent(IOUtils.toByteArray(new FileInputStream(Utilities.path(sourceFolder, filename))));
|
||||
saveResource(binary);
|
||||
|
@ -1282,22 +1286,22 @@ public class ArgonautConverter extends ConverterBase {
|
|||
private void makeDocumentReference(CDAUtilities cda, Convert convert, Element doc, Context context) throws Exception {
|
||||
scanSection("document", doc);
|
||||
DocumentReference ref = new DocumentReference();
|
||||
ref.setId(context.baseId + "-document");
|
||||
ref.setId(context.getBaseId() + "-document");
|
||||
ref.setMasterIdentifier(convert.makeIdentifierFromII(cda.getChild(doc, "id")));
|
||||
ref.setSubject(context.subjectRef);
|
||||
ref.setSubject(context.getSubjectRef());
|
||||
ref.setType(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(doc, "code")), null));
|
||||
ref.addAuthor(context.authorRef);
|
||||
ref.addAuthor(context.getAuthorRef());
|
||||
ref.setCreatedElement(convert.makeDateTimeFromTS(cda.getChild(doc, "effectiveTime")));
|
||||
ref.setIndexedElement(InstantType.now());
|
||||
ref.setStatus(DocumentReferenceStatus.CURRENT);
|
||||
ref.addSecurityLabel(inspectCode(convert.makeCodeableConceptFromCD(cda.getChild(doc, "confidentialityCode")), null));
|
||||
DocumentReferenceContentComponent cnt = ref.addContent();
|
||||
cnt.getAttachment().setContentType("application/hl7-v3+xml").setUrl("Binary/" + context.baseId).setLanguage(convertLanguage(cda.getChild(doc, "language")));
|
||||
cnt.getAttachment().setContentType("application/hl7-v3+xml").setUrl("Binary/" + context.getBaseId()).setLanguage(convertLanguage(cda.getChild(doc, "language")));
|
||||
// for (Element ti : cda.getChildren(doc, "templateId"))
|
||||
// cnt.addFormat().setSystem("urn:oid:1.3.6.1.4.1.19376.1.2.3").setCode(value)("urn:oid:"+ti.getAttribute("root"));
|
||||
ref.setContext(new DocumentReferenceContextComponent());
|
||||
ref.getContext().setPeriod(convert.makePeriodFromIVL(cda.getChild(cda.getChild(doc, "serviceEvent"), "effectiveTime")));
|
||||
for (CodeableConcept cc : context.encounter.getType())
|
||||
for (CodeableConcept cc : context.getEncounter().getType())
|
||||
ref.getContext().addEvent(cc);
|
||||
ref.setDescription(cda.getChild(doc, "title").getTextContent());
|
||||
ref.setCustodian(new Reference().setReference("Organization/" + processOrganization(cda.getDescendent(doc, "custodian/assignedCustodian/representedCustodianOrganization"), cda, convert, context).getId()));
|
||||
|
@ -1371,23 +1375,4 @@ public class ArgonautConverter extends ConverterBase {
|
|||
System.out.println();
|
||||
}
|
||||
|
||||
public class Context {
|
||||
|
||||
public String baseId;
|
||||
public Reference authorRef;
|
||||
public Encounter encounter;
|
||||
public Coding encClass;
|
||||
public int obsId;
|
||||
public DateTimeType now = DateTimeType.now();
|
||||
public int orgId;
|
||||
public Reference subjectRef;
|
||||
}
|
||||
|
||||
public class Stats {
|
||||
public int instances;
|
||||
public int errors;
|
||||
public int warnings;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package org.hl7.fhir.convertors.misc.argonaut;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hl7.fhir.dstu3.model.Coding;
|
||||
import org.hl7.fhir.dstu3.model.DateTimeType;
|
||||
import org.hl7.fhir.dstu3.model.Encounter;
|
||||
import org.hl7.fhir.dstu3.model.Reference;
|
||||
|
||||
@Data
|
||||
public class Context {
|
||||
private String baseId;
|
||||
private Reference authorRef;
|
||||
private Encounter encounter;
|
||||
private Coding encClass;
|
||||
private int obsId;
|
||||
private DateTimeType now = DateTimeType.now();
|
||||
private int orgId;
|
||||
private Reference subjectRef;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package org.hl7.fhir.convertors.misc.argonaut;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Stats {
|
||||
private int instances;
|
||||
private int errors;
|
||||
private int warnings;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.ccda;
|
||||
|
||||
|
||||
|
||||
|
@ -35,6 +35,8 @@ package org.hl7.fhir.convertors.misc;
|
|||
|
||||
|
||||
import org.fhir.ucum.UcumService;
|
||||
import org.hl7.fhir.convertors.misc.CDAUtilities;
|
||||
import org.hl7.fhir.convertors.misc.Convert;
|
||||
import org.hl7.fhir.dstu3.context.IWorkerContext;
|
||||
import org.hl7.fhir.dstu3.model.*;
|
||||
import org.hl7.fhir.dstu3.model.AllergyIntolerance.*;
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.ccda;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
|
@ -0,0 +1,15 @@
|
|||
package org.hl7.fhir.convertors.misc.iso21090;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
class DataType {
|
||||
private final List<Property> properties = new ArrayList<>();
|
||||
private boolean isAbstract;
|
||||
private String name;
|
||||
private String doco;
|
||||
private String parent;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package org.hl7.fhir.convertors.misc.iso21090;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class EnumValueSet {
|
||||
private final List<String> codes = new ArrayList<>();
|
||||
private final Map<String, String> members = new HashMap<>();
|
||||
private String name;
|
||||
private String template;
|
||||
private String system;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.iso21090;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -62,8 +62,8 @@ import java.util.*;
|
|||
|
||||
public class ISO21090Importer {
|
||||
|
||||
private final Map<String, EnumValueSet> bindings = new HashMap<String, EnumValueSet>();
|
||||
private final Map<String, DataType> types = new HashMap<String, DataType>();
|
||||
private final Map<String, EnumValueSet> bindings = new HashMap<>();
|
||||
private final Map<String, DataType> types = new HashMap<>();
|
||||
private IWorkerContext ctxt;
|
||||
private Element schema;
|
||||
|
||||
|
@ -92,64 +92,64 @@ public class ISO21090Importer {
|
|||
|
||||
private void generateType(DataType dt) throws Exception {
|
||||
StructureDefinition sd = new StructureDefinition();
|
||||
sd.setId(dt.name);
|
||||
sd.setId(dt.getName());
|
||||
sd.setUrl("http://hl7.org/fhir/iso21090/StructureDefinition/" + sd.getId());
|
||||
sd.setName(dt.name + " data type");
|
||||
sd.setName(dt.getName() + " data type");
|
||||
sd.setStatus(PublicationStatus.ACTIVE);
|
||||
sd.setExperimental(false);
|
||||
sd.setPublisher("HL7 / ISO");
|
||||
sd.setDate(new Date());
|
||||
sd.setDescription(dt.doco);
|
||||
sd.setDescription(dt.getDoco());
|
||||
sd.setKind(StructureDefinitionKind.LOGICAL);
|
||||
sd.setAbstract(Utilities.existsInList(dt.name, "HXIT", "QTY"));
|
||||
sd.setAbstract(Utilities.existsInList(dt.getName(), "HXIT", "QTY"));
|
||||
sd.setType("Element");
|
||||
if (dt.parent == null)
|
||||
if (dt.getParent() == null)
|
||||
sd.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/Element");
|
||||
else
|
||||
sd.setBaseDefinition("http://hl7.org/fhir/iso21090/StructureDefinition/" + dt.parent);
|
||||
sd.setBaseDefinition("http://hl7.org/fhir/iso21090/StructureDefinition/" + dt.getParent());
|
||||
sd.setDerivation(TypeDerivationRule.SPECIALIZATION);
|
||||
ElementDefinition ed = sd.getDifferential().addElement();
|
||||
ed.setPath(dt.name);
|
||||
produceProperties(sd.getDifferential().getElement(), dt.name, dt.properties, true, false);
|
||||
produceProperties(sd.getDifferential().getElement(), dt.name, dt.properties, false, false);
|
||||
ed.setPath(dt.getName());
|
||||
produceProperties(sd.getDifferential().getElement(), dt.getName(), dt.getProperties(), true, false);
|
||||
produceProperties(sd.getDifferential().getElement(), dt.getName(), dt.getProperties(), false, false);
|
||||
ed = sd.getSnapshot().addElement();
|
||||
ed.setPath(dt.name);
|
||||
if (dt.parent != null)
|
||||
addParentProperties(sd.getSnapshot().getElement(), dt.name, dt.parent, true, true);
|
||||
produceProperties(sd.getSnapshot().getElement(), dt.name, dt.properties, true, true);
|
||||
if (dt.parent != null)
|
||||
addParentProperties(sd.getSnapshot().getElement(), dt.name, dt.parent, false, true);
|
||||
produceProperties(sd.getSnapshot().getElement(), dt.name, dt.properties, false, true);
|
||||
ed.setPath(dt.getName());
|
||||
if (dt.getParent() != null)
|
||||
addParentProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getParent(), true, true);
|
||||
produceProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getProperties(), true, true);
|
||||
if (dt.getParent() != null)
|
||||
addParentProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getParent(), false, true);
|
||||
produceProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getProperties(), false, true);
|
||||
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\StructureDefinition-" + dt.name + ".xml"), sd);
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\StructureDefinition-" + dt.getName() + ".xml"), sd);
|
||||
}
|
||||
|
||||
private void addParentProperties(List<ElementDefinition> elements, String name, String parent, boolean attrMode, boolean snapshot) throws FHIRFormatError {
|
||||
DataType dt = types.get(parent);
|
||||
if (dt == null)
|
||||
throw new Error("No find " + parent);
|
||||
if (dt.parent != null)
|
||||
addParentProperties(elements, name, dt.parent, attrMode, snapshot);
|
||||
produceProperties(elements, name, dt.properties, attrMode, snapshot);
|
||||
if (dt.getParent() != null)
|
||||
addParentProperties(elements, name, dt.getParent(), attrMode, snapshot);
|
||||
produceProperties(elements, name, dt.getProperties(), attrMode, snapshot);
|
||||
}
|
||||
|
||||
private void produceProperties(List<ElementDefinition> elements, String name, List<Property> properties, boolean attrMode, boolean snapshot) throws FHIRFormatError {
|
||||
for (Property p : properties) {
|
||||
if (p.isattr == attrMode) {
|
||||
if (p.isIsattr() == attrMode) {
|
||||
ElementDefinition ed = new ElementDefinition();
|
||||
elements.add(ed);
|
||||
ed.setPath(name + "." + p.name);
|
||||
if (p.type.startsWith("xsd:"))
|
||||
ToolingExtensions.addStringExtension(ed.addType(), ToolingExtensions.EXT_XML_TYPE, p.type);
|
||||
ed.setPath(name + "." + p.getName());
|
||||
if (p.getType().startsWith("xsd:"))
|
||||
ToolingExtensions.addStringExtension(ed.addType(), ToolingExtensions.EXT_XML_TYPE, p.getType());
|
||||
else
|
||||
ed.addType().setCode(p.type);
|
||||
ed.setMin(p.min);
|
||||
ed.setMax(p.max == Integer.MAX_VALUE ? "*" : Integer.toString(p.max));
|
||||
ed.setDefinition(p.doco);
|
||||
if (p.isattr)
|
||||
ed.addType().setCode(p.getType());
|
||||
ed.setMin(p.getMin());
|
||||
ed.setMax(p.getMax() == Integer.MAX_VALUE ? "*" : Integer.toString(p.getMax()));
|
||||
ed.setDefinition(p.getDoco());
|
||||
if (p.isIsattr())
|
||||
ed.addRepresentation(PropertyRepresentation.XMLATTR);
|
||||
if (p.binding != null)
|
||||
ed.getBinding().setStrength(BindingStrength.REQUIRED).setValueSet(new UriType("http://hl7.org/fhir/iso21090/ValueSet/" + p.binding));
|
||||
if (p.getBinding() != null)
|
||||
ed.getBinding().setStrength(BindingStrength.REQUIRED).setValueSet(new UriType("http://hl7.org/fhir/iso21090/ValueSet/" + p.getBinding()));
|
||||
if (snapshot)
|
||||
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
|
||||
}
|
||||
|
@ -157,22 +157,22 @@ public class ISO21090Importer {
|
|||
}
|
||||
|
||||
private void generateValueSet(EnumValueSet evs) throws Exception {
|
||||
ValueSet bvs = ctxt.fetchResource(ValueSet.class, evs.template);
|
||||
ValueSet bvs = ctxt.fetchResource(ValueSet.class, evs.getTemplate());
|
||||
if (bvs == null)
|
||||
throw new Exception("Did not find template value set " + evs.template);
|
||||
throw new Exception("Did not find template value set " + evs.getTemplate());
|
||||
ValueSet vs = bvs.copy();
|
||||
vs.getCompose().getInclude().clear();
|
||||
vs.getIdentifier().clear();
|
||||
vs.setName("ISO 20190 " + evs.name + " Enumeration");
|
||||
vs.setId(evs.name);
|
||||
vs.setName("ISO 20190 " + evs.getName() + " Enumeration");
|
||||
vs.setId(evs.getName());
|
||||
vs.setUrl("http://hl7.org/fhir/iso21090/ValueSet/" + vs.getId());
|
||||
vs.setDate(new Date());
|
||||
vs.setExperimental(false);
|
||||
ConceptSetComponent inc = vs.getCompose().addInclude().setSystem(evs.system);
|
||||
for (String code : evs.codes) {
|
||||
ConceptSetComponent inc = vs.getCompose().addInclude().setSystem(evs.getSystem());
|
||||
for (String code : evs.getCodes()) {
|
||||
inc.addConcept().setCode(code);
|
||||
}
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\ValueSet-" + evs.name + ".xml"), vs);
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\ValueSet-" + evs.getName() + ".xml"), vs);
|
||||
}
|
||||
|
||||
private void processDataTypes() {
|
||||
|
@ -190,19 +190,19 @@ public class ISO21090Importer {
|
|||
private void processDataType(String n, Element type) {
|
||||
DataType dt = new DataType();
|
||||
types.put(n, dt);
|
||||
dt.name = n;
|
||||
dt.doco = getDoco(type);
|
||||
dt.setName(n);
|
||||
dt.setDoco(getDoco(type));
|
||||
Element cnt;
|
||||
Element ext = XMLUtil.getNamedChild(XMLUtil.getNamedChild(type, "xsd:complexContent"), "xsd:extension");
|
||||
if (ext != null) {
|
||||
dt.parent = ext.getAttribute("base");
|
||||
dt.setParent(ext.getAttribute("base"));
|
||||
cnt = XMLUtil.getFirstChild(ext);
|
||||
} else {
|
||||
cnt = XMLUtil.getFirstChild(type);
|
||||
}
|
||||
if (cnt.getTagName().equals("xsd:annotation"))
|
||||
cnt = XMLUtil.getNextSibling(cnt);
|
||||
System.out.println(n + " (" + dt.parent + ")");
|
||||
System.out.println(n + " (" + dt.getParent() + ")");
|
||||
while (cnt != null) {
|
||||
if (cnt.getTagName().equals("xsd:attribute")) {
|
||||
processAttribute(dt, cnt);
|
||||
|
@ -224,44 +224,44 @@ public class ISO21090Importer {
|
|||
|
||||
private void processElement(DataType dt, Element elem) {
|
||||
Property prop = new Property();
|
||||
prop.name = elem.getAttribute("name");
|
||||
prop.min = Integer.parseInt(elem.getAttribute("minOccurs"));
|
||||
prop.max = "unbounded".equals(elem.getAttribute("maxOccurs")) ? Integer.MAX_VALUE : Integer.parseInt(elem.getAttribute("maxOccurs"));
|
||||
prop.type = elem.getAttribute("type");
|
||||
prop.doco = getDoco(elem);
|
||||
dt.properties.add(prop);
|
||||
System.out.println(" " + prop.name + " : " + prop.type + " [" + prop.min + ".." + prop.max + "]");
|
||||
prop.setName(elem.getAttribute("name"));
|
||||
prop.setMin(Integer.parseInt(elem.getAttribute("minOccurs")));
|
||||
prop.setMax("unbounded".equals(elem.getAttribute("maxOccurs")) ? Integer.MAX_VALUE : Integer.parseInt(elem.getAttribute("maxOccurs")));
|
||||
prop.setType(elem.getAttribute("type"));
|
||||
prop.setDoco(getDoco(elem));
|
||||
dt.getProperties().add(prop);
|
||||
System.out.println(" " + prop.getName() + " : " + prop.getType() + " [" + prop.getMin() + ".." + prop.getMax() + "]");
|
||||
}
|
||||
|
||||
private void processAttribute(DataType dt, Element attr) {
|
||||
Property prop = new Property();
|
||||
prop.name = attr.getAttribute("name");
|
||||
prop.type = attr.getAttribute("type");
|
||||
if (!prop.type.startsWith("xsd:")) {
|
||||
if (Utilities.noString(prop.type))
|
||||
prop.type = "xsd:string";
|
||||
else if (bindings.containsKey(prop.type)) {
|
||||
prop.binding = prop.type;
|
||||
prop.type = "xsd:string";
|
||||
} else if (prop.type.startsWith("set_") && bindings.containsKey(prop.type.substring(4))) {
|
||||
prop.binding = prop.type.substring(4);
|
||||
prop.type = "xsd:string";
|
||||
prop.max = Integer.MAX_VALUE;
|
||||
} else if ("Uid".equals(prop.type))
|
||||
prop.type = "xsd:string";
|
||||
else if ("Code".equals(prop.type))
|
||||
prop.type = "xsd:token";
|
||||
else if ("Decimal".equals(prop.type))
|
||||
prop.type = "xsd:decimal";
|
||||
prop.setName(attr.getAttribute("name"));
|
||||
prop.setType(attr.getAttribute("type"));
|
||||
if (!prop.getType().startsWith("xsd:")) {
|
||||
if (Utilities.noString(prop.getType()))
|
||||
prop.setType("xsd:string");
|
||||
else if (bindings.containsKey(prop.getType())) {
|
||||
prop.setBinding(prop.getType());
|
||||
prop.setType("xsd:string");
|
||||
} else if (prop.getType().startsWith("set_") && bindings.containsKey(prop.getType().substring(4))) {
|
||||
prop.setBinding(prop.getType().substring(4));
|
||||
prop.setType("xsd:string");
|
||||
prop.setMax(Integer.MAX_VALUE);
|
||||
} else if ("Uid".equals(prop.getType()))
|
||||
prop.setType("xsd:string");
|
||||
else if ("Code".equals(prop.getType()))
|
||||
prop.setType("xsd:token");
|
||||
else if ("Decimal".equals(prop.getType()))
|
||||
prop.setType("xsd:decimal");
|
||||
else
|
||||
throw new Error("Unknown type " + prop.type + " on " + dt.name + "." + prop.name);
|
||||
throw new Error("Unknown type " + prop.getType() + " on " + dt.getName() + "." + prop.getName());
|
||||
}
|
||||
prop.min = "optional".equals(attr.getAttribute("use")) ? 0 : 1;
|
||||
prop.max = 1;
|
||||
prop.doco = getDoco(attr);
|
||||
prop.isattr = true;
|
||||
dt.properties.add(prop);
|
||||
System.out.println(" " + prop.name + " : " + prop.type + " [" + prop.min + ".." + prop.max + "]");
|
||||
prop.setMin("optional".equals(attr.getAttribute("use")) ? 0 : 1);
|
||||
prop.setMax(1);
|
||||
prop.setDoco(getDoco(attr));
|
||||
prop.setIsattr(true);
|
||||
dt.getProperties().add(prop);
|
||||
System.out.println(" " + prop.getName() + " : " + prop.getType() + " [" + prop.getMin() + ".." + prop.getMax() + "]");
|
||||
}
|
||||
|
||||
private void processEnums() {
|
||||
|
@ -280,7 +280,7 @@ public class ISO21090Importer {
|
|||
private void processEnum(String n, Element en) {
|
||||
EnumValueSet vs = new EnumValueSet();
|
||||
bindings.put(n, vs);
|
||||
vs.name = n;
|
||||
vs.setName(n);
|
||||
String v3n;
|
||||
if (n.contains("EntityName"))
|
||||
v3n = n + "R2";
|
||||
|
@ -296,12 +296,12 @@ public class ISO21090Importer {
|
|||
v3n = "TelecommunicationCapabilities";
|
||||
else
|
||||
v3n = n;
|
||||
vs.system = "http://hl7.org/fhir/v3-" + v3n;
|
||||
vs.template = "http://hl7.org/fhir/ValueSet/v3-" + v3n;
|
||||
System.out.println("Enum: " + n + " == " + vs.system);
|
||||
vs.setSystem("http://hl7.org/fhir/v3-" + v3n);
|
||||
vs.setTemplate("http://hl7.org/fhir/ValueSet/v3-" + v3n);
|
||||
System.out.println("Enum: " + n + " == " + vs.getSystem());
|
||||
while (en != null) {
|
||||
vs.codes.add(en.getAttribute("value"));
|
||||
vs.members.put(en.getAttribute("value"), getDoco(en));
|
||||
vs.getCodes().add(en.getAttribute("value"));
|
||||
vs.getMembers().put(en.getAttribute("value"), getDoco(en));
|
||||
en = XMLUtil.getNextSibling(en);
|
||||
}
|
||||
}
|
||||
|
@ -319,30 +319,4 @@ public class ISO21090Importer {
|
|||
schema = doc.getDocumentElement();
|
||||
}
|
||||
|
||||
private class Property {
|
||||
private boolean isattr;
|
||||
private String name;
|
||||
private int min;
|
||||
private int max;
|
||||
private String type;
|
||||
private String doco;
|
||||
private String binding;
|
||||
}
|
||||
|
||||
private class DataType {
|
||||
private final List<Property> properties = new ArrayList<Property>();
|
||||
private boolean isAbstract;
|
||||
private String name;
|
||||
private String doco;
|
||||
private String parent;
|
||||
|
||||
}
|
||||
|
||||
public class EnumValueSet {
|
||||
private final List<String> codes = new ArrayList<String>();
|
||||
private final Map<String, String> members = new HashMap<String, String>();
|
||||
private String name;
|
||||
private String template;
|
||||
private String system;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package org.hl7.fhir.convertors.misc.iso21090;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
class Property {
|
||||
private boolean isattr;
|
||||
private String name;
|
||||
private int min;
|
||||
private int max;
|
||||
private String type;
|
||||
private String doco;
|
||||
private String binding;
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.hl7.fhir.convertors.misc.searchparam;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SPRelationship {
|
||||
private final String r4;
|
||||
private final String r3;
|
||||
private final String r2b;
|
||||
private final String r2;
|
||||
|
||||
public String getByCode(String code) {
|
||||
if ("R4".equals(code))
|
||||
return r4;
|
||||
if ("R3".equals(code))
|
||||
return r3;
|
||||
if ("R2b".equals(code))
|
||||
return r2b;
|
||||
if ("R2".equals(code))
|
||||
return getR2();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.searchparam;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc.
|
||||
|
@ -135,17 +135,17 @@ public class SearchParameterProcessor {
|
|||
for (String s : list4) {
|
||||
boolean ok = false;
|
||||
for (SPRelationship t : list) {
|
||||
if (s.equals(t.r4))
|
||||
if (s.equals(t.getR4()))
|
||||
ok = true;
|
||||
}
|
||||
if (!ok)
|
||||
System.out.println("R4 missing : " + s);
|
||||
}
|
||||
for (SPRelationship sp : list) {
|
||||
if (!Utilities.noString(sp.r4)) {
|
||||
boolean ok = list4.contains(sp.r4);
|
||||
if (!Utilities.noString(sp.getR4())) {
|
||||
boolean ok = list4.contains(sp.getR4());
|
||||
if (!ok)
|
||||
System.out.println("R4 extra : " + sp.r4);
|
||||
System.out.println("R4 extra : " + sp.getR4());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,17 +154,17 @@ public class SearchParameterProcessor {
|
|||
for (String s : list3) {
|
||||
boolean ok = false;
|
||||
for (SPRelationship t : list) {
|
||||
if (s.equals(t.r3))
|
||||
if (s.equals(t.getR3()))
|
||||
ok = true;
|
||||
}
|
||||
if (!ok)
|
||||
System.out.println("R3 : " + s);
|
||||
}
|
||||
for (SPRelationship sp : list) {
|
||||
if (!Utilities.noString(sp.r3)) {
|
||||
boolean ok = list3.contains(sp.r3);
|
||||
if (!Utilities.noString(sp.getR3())) {
|
||||
boolean ok = list3.contains(sp.getR3());
|
||||
if (!ok)
|
||||
System.out.println("R3 extra : " + sp.r3);
|
||||
System.out.println("R3 extra : " + sp.getR3());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -173,17 +173,17 @@ public class SearchParameterProcessor {
|
|||
for (String s : list2b) {
|
||||
boolean ok = false;
|
||||
for (SPRelationship t : list) {
|
||||
if (s.equals(t.r2b))
|
||||
if (s.equals(t.getR2b()))
|
||||
ok = true;
|
||||
}
|
||||
if (!ok)
|
||||
System.out.println("R2b : " + s);
|
||||
}
|
||||
for (SPRelationship sp : list) {
|
||||
if (!Utilities.noString(sp.r2b)) {
|
||||
boolean ok = list2b.contains(sp.r2b);
|
||||
if (!Utilities.noString(sp.getR2b())) {
|
||||
boolean ok = list2b.contains(sp.getR2b());
|
||||
if (!ok)
|
||||
System.out.println("R2b extra : " + sp.r2b);
|
||||
System.out.println("R2b extra : " + sp.getR2b());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -192,17 +192,17 @@ public class SearchParameterProcessor {
|
|||
for (String s : list2) {
|
||||
boolean ok = false;
|
||||
for (SPRelationship t : list) {
|
||||
if (s.equals(t.r2))
|
||||
if (s.equals(t.getR2()))
|
||||
ok = true;
|
||||
}
|
||||
if (!ok)
|
||||
System.out.println("R2 : " + s);
|
||||
}
|
||||
for (SPRelationship sp : list) {
|
||||
if (!Utilities.noString(sp.r2)) {
|
||||
boolean ok = list2.contains(sp.r2);
|
||||
if (!Utilities.noString(sp.getR2())) {
|
||||
boolean ok = list2.contains(sp.getR2());
|
||||
if (!ok)
|
||||
System.out.println("R2 extra : " + sp.r2);
|
||||
System.out.println("R2 extra : " + sp.getR2());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,49 +278,5 @@ public class SearchParameterProcessor {
|
|||
System.out.println("Map loaded - " + list.size() + " entries");
|
||||
}
|
||||
|
||||
public class SPRelationship {
|
||||
private final String r4;
|
||||
private final String r3;
|
||||
private final String r2b;
|
||||
private final String r2;
|
||||
|
||||
public SPRelationship(String r4, String r3, String r2b, String r2) {
|
||||
super();
|
||||
this.r4 = r4;
|
||||
this.r3 = r3;
|
||||
this.r2b = r2b;
|
||||
this.r2 = r2;
|
||||
}
|
||||
|
||||
public String getR4() {
|
||||
return r4;
|
||||
}
|
||||
|
||||
public String getR3() {
|
||||
return r3;
|
||||
}
|
||||
|
||||
public String getR2b() {
|
||||
return r2b;
|
||||
}
|
||||
|
||||
public String getR2() {
|
||||
return r2;
|
||||
}
|
||||
|
||||
public String getByCode(String code) {
|
||||
if ("R4".equals(code))
|
||||
return r4;
|
||||
if ("R3".equals(code))
|
||||
return r3;
|
||||
if ("R2b".equals(code))
|
||||
return r2b;
|
||||
if ("R2".equals(code))
|
||||
return r2;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.hl7.fhir.convertors.misc;
|
||||
package org.hl7.fhir.convertors.misc.utg;
|
||||
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
|
|
@ -1,6 +1,6 @@
|
|||
package org.hl7.fhir.validation;
|
||||
|
||||
import org.hl7.fhir.convertors.loaders.*;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.*;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
|
@ -42,15 +42,15 @@ public class ValidatorUtils {
|
|||
if (Utilities.noString(version))
|
||||
return null;
|
||||
if (version.startsWith("1.0"))
|
||||
return new R2ToR5Loader(new String[]{"Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new BaseLoaderR5.NullLoaderKnowledgeProvider());
|
||||
return new R2ToR5Loader(new String[]{"Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
if (version.startsWith("1.4"))
|
||||
return new R2016MayToR5Loader(new String[]{"Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new BaseLoaderR5.NullLoaderKnowledgeProvider()); // special case
|
||||
return new R2016MayToR5Loader(new String[]{"Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5()); // special case
|
||||
if (version.startsWith("3.0"))
|
||||
return new R3ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new BaseLoaderR5.NullLoaderKnowledgeProvider());
|
||||
return new R3ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
if (version.startsWith("4.0"))
|
||||
return new R4ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new BaseLoaderR5.NullLoaderKnowledgeProvider());
|
||||
return new R4ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
if (version.startsWith("5.0"))
|
||||
return new R5ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new BaseLoaderR5.NullLoaderKnowledgeProvider());
|
||||
return new R5ToR5Loader(new String[]{"CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire", "ConceptMap", "StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,15 +14,12 @@ import java.util.Map.Entry;
|
|||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.VersionConvertor_14_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.VersionConvertor_30_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50;
|
||||
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.R4ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.NullLoaderKnowledgeProviderR5;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
|
@ -116,7 +113,7 @@ public class ComparisonTests {
|
|||
BaseWorkerContext bc = (BaseWorkerContext) context;
|
||||
boolean dupl = bc.isAllowLoadingDuplicates();
|
||||
bc.setAllowLoadingDuplicates(true);
|
||||
context.loadFromPackage(npm, new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider()));
|
||||
context.loadFromPackage(npm, new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5()));
|
||||
bc.setAllowLoadingDuplicates(dupl);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ import java.util.zip.ZipInputStream;
|
|||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.hl7.fhir.convertors.loaders.R3ToR4Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR4.R3ToR4Loader;
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||
|
|
|
@ -46,11 +46,11 @@ import javax.xml.parsers.DocumentBuilderFactory;
|
|||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.hl7.fhir.convertors.loaders.BaseLoaderR5.NullLoaderKnowledgeProvider;
|
||||
import org.hl7.fhir.convertors.loaders.R2016MayToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R2ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R3ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.R4ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.NullLoaderKnowledgeProviderR5;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R2016MayToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R2ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R3ToR5Loader;
|
||||
import org.hl7.fhir.convertors.loaders.loaderR5.R4ToR5Loader;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
|
@ -101,13 +101,13 @@ public class UtilitiesXTests {
|
|||
if (Utilities.noString(version))
|
||||
return null;
|
||||
if (version.startsWith("1.0"))
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
return new R2ToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
if (version.startsWith("1.4"))
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider()); // special case
|
||||
return new R2016MayToR5Loader(new String[] { "Conformance", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5()); // special case
|
||||
if (version.startsWith("3.0"))
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
return new R3ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
if (version.startsWith("4.0"))
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProvider());
|
||||
return new R4ToR5Loader(new String[] { "CapabilityStatement", "StructureDefinition", "ValueSet", "CodeSystem", "SearchParameter", "OperationDefinition", "Questionnaire","ConceptMap","StructureMap", "NamingSystem"}, new NullLoaderKnowledgeProviderR5());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue