Merge branch 'master' of https://github.com/hapifhir/org.hl7.fhir.core
This commit is contained in:
commit
1a681b3b2d
|
@ -3072,6 +3072,8 @@ public class VersionConvertor_10_30 {
|
||||||
return Appointment10_30.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
return Appointment10_30.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
||||||
return AppointmentResponse10_30.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
return AppointmentResponse10_30.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
||||||
|
if (src instanceof org.hl7.fhir.dstu2.model.AllergyIntolerance)
|
||||||
|
return AllergyIntolerance10_30.convertAllergyIntolerance((org.hl7.fhir.dstu2.model.AllergyIntolerance) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
||||||
return AuditEvent10_30.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src);
|
return AuditEvent10_30.convertAuditEvent((org.hl7.fhir.dstu2.model.AuditEvent) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.Basic)
|
if (src instanceof org.hl7.fhir.dstu2.model.Basic)
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.conv10_40.AllergyIntolerance10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.Appointment10_40;
|
import org.hl7.fhir.convertors.conv10_40.Appointment10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.AppointmentResponse10_40;
|
import org.hl7.fhir.convertors.conv10_40.AppointmentResponse10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.AuditEvent10_40;
|
import org.hl7.fhir.convertors.conv10_40.AuditEvent10_40;
|
||||||
|
@ -36,6 +37,7 @@ import org.hl7.fhir.convertors.conv10_40.ImplementationGuide10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.List10_40;
|
import org.hl7.fhir.convertors.conv10_40.List10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.Location10_40;
|
import org.hl7.fhir.convertors.conv10_40.Location10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.MedicationDispense10_40;
|
import org.hl7.fhir.convertors.conv10_40.MedicationDispense10_40;
|
||||||
|
import org.hl7.fhir.convertors.conv10_40.MedicationRequest10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.MedicationStatement10_40;
|
import org.hl7.fhir.convertors.conv10_40.MedicationStatement10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.MessageHeader10_40;
|
import org.hl7.fhir.convertors.conv10_40.MessageHeader10_40;
|
||||||
import org.hl7.fhir.convertors.conv10_40.NamingSystem10_40;
|
import org.hl7.fhir.convertors.conv10_40.NamingSystem10_40;
|
||||||
|
@ -3174,6 +3176,8 @@ public class VersionConvertor_10_40 {
|
||||||
return Parameters10_40.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
|
return Parameters10_40.convertParameters((org.hl7.fhir.dstu2.model.Parameters) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.Appointment)
|
if (src instanceof org.hl7.fhir.dstu2.model.Appointment)
|
||||||
return Appointment10_40.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
return Appointment10_40.convertAppointment((org.hl7.fhir.dstu2.model.Appointment) src);
|
||||||
|
if (src instanceof org.hl7.fhir.dstu2.model.AllergyIntolerance)
|
||||||
|
return AllergyIntolerance10_40.convertAllergyIntolerance((org.hl7.fhir.dstu2.model.AllergyIntolerance) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
if (src instanceof org.hl7.fhir.dstu2.model.AppointmentResponse)
|
||||||
return AppointmentResponse10_40.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
return AppointmentResponse10_40.convertAppointmentResponse((org.hl7.fhir.dstu2.model.AppointmentResponse) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
if (src instanceof org.hl7.fhir.dstu2.model.AuditEvent)
|
||||||
|
@ -3236,6 +3240,8 @@ public class VersionConvertor_10_40 {
|
||||||
return MedicationDispense10_40.convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src);
|
return MedicationDispense10_40.convertMedicationDispense((org.hl7.fhir.dstu2.model.MedicationDispense) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement)
|
if (src instanceof org.hl7.fhir.dstu2.model.MedicationStatement)
|
||||||
return MedicationStatement10_40.convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src);
|
return MedicationStatement10_40.convertMedicationStatement((org.hl7.fhir.dstu2.model.MedicationStatement) src);
|
||||||
|
if (src instanceof org.hl7.fhir.dstu2.model.MedicationOrder)
|
||||||
|
return MedicationRequest10_40.convertMedicationRequest((org.hl7.fhir.dstu2.model.MedicationOrder) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader)
|
if (src instanceof org.hl7.fhir.dstu2.model.MessageHeader)
|
||||||
return MessageHeader10_40.convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src);
|
return MessageHeader10_40.convertMessageHeader((org.hl7.fhir.dstu2.model.MessageHeader) src);
|
||||||
if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem)
|
if (src instanceof org.hl7.fhir.dstu2.model.NamingSystem)
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_30;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||||
|
import org.hl7.fhir.dstu2.model.AllergyIntolerance;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
|
public class AllergyIntolerance10_30 {
|
||||||
|
public static org.hl7.fhir.dstu3.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu2.model.AllergyIntolerance src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.dstu3.model.AllergyIntolerance tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance();
|
||||||
|
VersionConvertor_10_30.copyDomainResource(src, tgt);
|
||||||
|
for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(identifier));
|
||||||
|
if (src.hasOnset())
|
||||||
|
tgt.setOnset(new org.hl7.fhir.dstu3.model.DateTimeType(src.getOnset()));
|
||||||
|
if (src.hasRecordedDate())
|
||||||
|
tgt.setAssertedDate(src.getRecordedDate());
|
||||||
|
if (src.hasRecorder())
|
||||||
|
tgt.setRecorder(VersionConvertor_10_30.convertReference(src.getRecorder()));
|
||||||
|
if (src.hasPatient())
|
||||||
|
tgt.setPatient(VersionConvertor_10_30.convertReference(src.getPatient()));
|
||||||
|
if (src.hasReporter())
|
||||||
|
tgt.setAsserter(VersionConvertor_10_30.convertReference(src.getReporter()));
|
||||||
|
if (src.hasSubstance())
|
||||||
|
tgt.setCode(VersionConvertor_10_30.convertCodeableConcept(src.getSubstance()));
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.REFUTED
|
||||||
|
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ENTEREDINERROR) {
|
||||||
|
tgt.setClinicalStatus(translateAllergyIntoleranceClinicalStatus(src.getStatus()));
|
||||||
|
}
|
||||||
|
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ACTIVE
|
||||||
|
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.RESOLVED) {
|
||||||
|
tgt.setVerificationStatus(translateAllergyIntoleranceVerificationStatus(src.getStatus()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (src.hasCriticality())
|
||||||
|
tgt.setCriticality(translateAllergyIntoleranceCriticality(src.getCriticality()));
|
||||||
|
if (src.hasType())
|
||||||
|
tgt.setType(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
|
||||||
|
if (src.hasCategory())
|
||||||
|
tgt.addCategory(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
|
||||||
|
if (src.hasLastOccurence())
|
||||||
|
tgt.setLastOccurrence(src.getLastOccurence());
|
||||||
|
if (src.hasNote())
|
||||||
|
tgt.addNote(VersionConvertor_10_30.convertAnnotation(src.getNote()));
|
||||||
|
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
|
||||||
|
tgt.addReaction(algReaction(reaction));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent algReaction(AllergyIntolerance.AllergyIntoleranceReactionComponent src) {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
|
||||||
|
VersionConvertor_10_30.copyElement(src, tgt);
|
||||||
|
for (org.hl7.fhir.dstu2.model.Extension extension : src.getModifierExtension()) tgt.addExtension(VersionConvertor_10_30.convertExtension(extension));
|
||||||
|
if (src.hasSubstance())
|
||||||
|
tgt.setSubstance(VersionConvertor_10_30.convertCodeableConcept(src.getSubstance()));
|
||||||
|
if (src.hasCertainty())
|
||||||
|
tgt.addExtension(new org.hl7.fhir.dstu3.model.Extension(
|
||||||
|
"http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
new org.hl7.fhir.dstu3.model.StringType(src.getCertainty().toCode())
|
||||||
|
));
|
||||||
|
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_30.convertCodeableConcept(concept));
|
||||||
|
if (src.hasDescription())
|
||||||
|
src.setDescription(src.getDescription());
|
||||||
|
if (src.hasOnset())
|
||||||
|
tgt.setOnset(src.getOnset());
|
||||||
|
if (src.hasSeverity())
|
||||||
|
tgt.setSeverity(org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
|
||||||
|
if (src.hasExposureRoute())
|
||||||
|
tgt.setExposureRoute(VersionConvertor_10_30.convertCodeableConcept(src.getExposureRoute()));
|
||||||
|
if (src.hasNote())
|
||||||
|
tgt.addNote(VersionConvertor_10_30.convertAnnotation(src.getNote()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus translateAllergyIntoleranceVerificationStatus(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus src) {
|
||||||
|
switch(src) {
|
||||||
|
case UNCONFIRMED:
|
||||||
|
case INACTIVE:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.UNCONFIRMED;
|
||||||
|
case CONFIRMED:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.CONFIRMED;
|
||||||
|
case REFUTED:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.REFUTED;
|
||||||
|
case ENTEREDINERROR:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.ENTEREDINERROR;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus translateAllergyIntoleranceClinicalStatus(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus src) {
|
||||||
|
switch(src) {
|
||||||
|
case ACTIVE:
|
||||||
|
case UNCONFIRMED:
|
||||||
|
case CONFIRMED:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.ACTIVE;
|
||||||
|
case INACTIVE:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.INACTIVE;
|
||||||
|
case RESOLVED:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.RESOLVED;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality translateAllergyIntoleranceCriticality(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceCriticality src) {
|
||||||
|
switch(src) {
|
||||||
|
case CRITL:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW;
|
||||||
|
case CRITH:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH;
|
||||||
|
case CRITU:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.dstu3.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_40;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||||
|
import org.hl7.fhir.dstu2.model.AllergyIntolerance;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
|
||||||
|
public class AllergyIntolerance10_40 {
|
||||||
|
public static org.hl7.fhir.r4.model.AllergyIntolerance convertAllergyIntolerance(org.hl7.fhir.dstu2.model.AllergyIntolerance src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.AllergyIntolerance tgt = new org.hl7.fhir.r4.model.AllergyIntolerance();
|
||||||
|
for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(t));
|
||||||
|
if (src.hasOnset())
|
||||||
|
tgt.setOnset(VersionConvertor_10_40.convertType(src.getOnsetElement()));
|
||||||
|
if (src.hasRecordedDate())
|
||||||
|
tgt.setRecordedDate(src.getRecordedDate());
|
||||||
|
if (src.hasRecorder())
|
||||||
|
tgt.setRecorder(VersionConvertor_10_40.convertReference(src.getRecorder()));
|
||||||
|
if (src.hasPatient())
|
||||||
|
tgt.setPatient(VersionConvertor_10_40.convertReference(src.getPatient()));
|
||||||
|
if (src.hasReporter())
|
||||||
|
tgt.setAsserter(VersionConvertor_10_40.convertReference(src.getReporter()));
|
||||||
|
if (src.hasSubstance())
|
||||||
|
tgt.setCode(VersionConvertor_10_40.convertCodeableConcept(src.getSubstance()));
|
||||||
|
if (src.hasStatus()) {
|
||||||
|
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.REFUTED
|
||||||
|
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ENTEREDINERROR) {
|
||||||
|
org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding();
|
||||||
|
code.setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical");
|
||||||
|
code.setCode(src.getStatus().toCode());
|
||||||
|
tgt.setClinicalStatus(new org.hl7.fhir.r4.model.CodeableConcept(code));
|
||||||
|
}
|
||||||
|
if (src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.ACTIVE
|
||||||
|
&& src.getStatus() != org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceStatus.RESOLVED) {
|
||||||
|
org.hl7.fhir.r4.model.Coding code = new org.hl7.fhir.r4.model.Coding();
|
||||||
|
code.setSystem("http://terminology.hl7.org/CodeSystem/allergyintolerance-verification");
|
||||||
|
code.setCode(src.getStatus().toCode());
|
||||||
|
tgt.setVerificationStatus(new org.hl7.fhir.r4.model.CodeableConcept(code));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (src.hasCriticality())
|
||||||
|
tgt.setCriticality(translateAllergyIntoleranceCriticality(src.getCriticality()));
|
||||||
|
if (src.hasType())
|
||||||
|
tgt.setType(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceType.fromCode(src.getType().toCode()));
|
||||||
|
if (src.hasCategory())
|
||||||
|
tgt.addCategory(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCategory.fromCode(src.getCategory().toCode()));
|
||||||
|
if (src.hasLastOccurence())
|
||||||
|
tgt.setLastOccurrence(src.getLastOccurence());
|
||||||
|
if (src.hasNote())
|
||||||
|
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
|
||||||
|
for (org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceReactionComponent reaction : src.getReaction())
|
||||||
|
tgt.addReaction(algReaction(reaction));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent algReaction(AllergyIntolerance.AllergyIntoleranceReactionComponent src) {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent tgt = new org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceReactionComponent();
|
||||||
|
VersionConvertor_10_40.copyElement(src, tgt);
|
||||||
|
for (org.hl7.fhir.dstu2.model.Extension extension : src.getModifierExtension()) tgt.addExtension(VersionConvertor_10_40.convertExtension(extension));
|
||||||
|
if (src.hasSubstance())
|
||||||
|
tgt.setSubstance(VersionConvertor_10_40.convertCodeableConcept(src.getSubstance()));
|
||||||
|
if (src.hasCertainty())
|
||||||
|
tgt.addExtension(new org.hl7.fhir.r4.model.Extension(
|
||||||
|
"http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
new org.hl7.fhir.r4.model.StringType(src.getCertainty().toCode())
|
||||||
|
));
|
||||||
|
for (org.hl7.fhir.dstu2.model.CodeableConcept concept : src.getManifestation()) tgt.addManifestation(VersionConvertor_10_40.convertCodeableConcept(concept));
|
||||||
|
if (src.hasDescription())
|
||||||
|
src.setDescription(src.getDescription());
|
||||||
|
if (src.hasOnset())
|
||||||
|
tgt.setOnset(src.getOnset());
|
||||||
|
if (src.hasSeverity())
|
||||||
|
tgt.setSeverity(org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceSeverity.fromCode(src.getSeverity().toCode()));
|
||||||
|
if (src.hasExposureRoute())
|
||||||
|
tgt.setExposureRoute(VersionConvertor_10_40.convertCodeableConcept(src.getExposureRoute()));
|
||||||
|
if (src.hasNote())
|
||||||
|
tgt.addNote(VersionConvertor_10_40.convertAnnotation(src.getNote()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality translateAllergyIntoleranceCriticality(org.hl7.fhir.dstu2.model.AllergyIntolerance.AllergyIntoleranceCriticality src) {
|
||||||
|
switch(src) {
|
||||||
|
case CRITL:
|
||||||
|
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.LOW;
|
||||||
|
case CRITH:
|
||||||
|
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.HIGH;
|
||||||
|
case CRITU:
|
||||||
|
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.UNABLETOASSESS;
|
||||||
|
default:
|
||||||
|
return org.hl7.fhir.r4.model.AllergyIntolerance.AllergyIntoleranceCriticality.NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,98 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_40;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||||
|
import org.hl7.fhir.dstu2.model.MedicationOrder;
|
||||||
|
import org.hl7.fhir.dstu3.model.MedicationRequest;
|
||||||
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
import org.hl7.fhir.r4.model.Dosage;
|
||||||
|
|
||||||
|
public class MedicationRequest10_40 {
|
||||||
|
public static org.hl7.fhir.r4.model.MedicationRequest convertMedicationRequest(org.hl7.fhir.dstu2.model.MedicationOrder src) throws FHIRException {
|
||||||
|
if (src == null)
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.MedicationRequest tgt = new org.hl7.fhir.r4.model.MedicationRequest();
|
||||||
|
VersionConvertor_10_40.copyDomainResource(src, tgt);
|
||||||
|
tgt.setIntent(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestIntent.ORDER);
|
||||||
|
for (org.hl7.fhir.dstu2.model.Identifier identifier : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_40.convertIdentifier(identifier));
|
||||||
|
if (src.hasDateWritten())
|
||||||
|
tgt.setAuthoredOn(src.getDateWritten());
|
||||||
|
if (src.hasStatus())
|
||||||
|
tgt.setStatus(org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestStatus.fromCode(src.getStatus().toCode()));
|
||||||
|
if (src.hasPatient())
|
||||||
|
tgt.setSubject(VersionConvertor_10_40.convertReference(src.getPatient()));
|
||||||
|
if (src.hasPrescriber())
|
||||||
|
tgt.setRequester(VersionConvertor_10_40.convertReference(src.getPrescriber()));
|
||||||
|
if (src.hasReasonCodeableConcept())
|
||||||
|
tgt.addReasonCode(VersionConvertor_10_40.convertCodeableConcept(src.getReasonCodeableConcept()));
|
||||||
|
if (src.hasReasonReference())
|
||||||
|
tgt.addReasonReference(VersionConvertor_10_40.convertReference((src.getReasonReference())));
|
||||||
|
if (src.hasNote())
|
||||||
|
tgt.addNote(new org.hl7.fhir.r4.model.Annotation(new org.hl7.fhir.r4.model.MarkdownType((src.getNote()))));
|
||||||
|
if (src.hasMedicationCodeableConcept())
|
||||||
|
tgt.setMedication(VersionConvertor_10_40.convertCodeableConcept(src.getMedicationCodeableConcept()));
|
||||||
|
if (src.hasMedicationReference())
|
||||||
|
tgt.setMedication(VersionConvertor_10_40.convertReference(src.getMedicationReference()));
|
||||||
|
for (MedicationOrder.MedicationOrderDosageInstructionComponent dosage : src.getDosageInstruction())
|
||||||
|
tgt.addDosageInstruction(medDosageInstruction(dosage));
|
||||||
|
if (src.hasDispenseRequest())
|
||||||
|
tgt.setDispenseRequest(medDispenseRequest(src.getDispenseRequest()));
|
||||||
|
if (src.hasSubstitution())
|
||||||
|
tgt.setSubstitution(medSubstitution(src.getSubstitution()));
|
||||||
|
if (src.hasPriorPrescription())
|
||||||
|
tgt.setPriorPrescription(VersionConvertor_10_40.convertReference(src.getPriorPrescription()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.hl7.fhir.r4.model.Dosage medDosageInstruction(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) {
|
||||||
|
if (src == null || src.isEmpty())
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
|
||||||
|
if (src.hasText())
|
||||||
|
tgt.setText(src.getText());
|
||||||
|
if (src.hasAdditionalInstructions())
|
||||||
|
tgt.addAdditionalInstruction(VersionConvertor_10_40.convertCodeableConcept(src.getAdditionalInstructions()));
|
||||||
|
if (src.hasTiming())
|
||||||
|
tgt.setTiming(VersionConvertor_10_40.convertTiming(src.getTiming()));
|
||||||
|
if (src.hasAsNeeded())
|
||||||
|
tgt.setAsNeeded(VersionConvertor_10_40.convertType(src.getAsNeeded()));
|
||||||
|
if (src.hasSiteCodeableConcept())
|
||||||
|
tgt.setSite(VersionConvertor_10_40.convertCodeableConcept(src.getSiteCodeableConcept()));
|
||||||
|
if (src.hasRoute())
|
||||||
|
tgt.setRoute(VersionConvertor_10_40.convertCodeableConcept(src.getRoute()));
|
||||||
|
if (src.hasMethod())
|
||||||
|
tgt.setMethod(VersionConvertor_10_40.convertCodeableConcept(src.getMethod()));
|
||||||
|
Dosage.DosageDoseAndRateComponent dose_and_rate = new Dosage.DosageDoseAndRateComponent();
|
||||||
|
if (src.hasDose())
|
||||||
|
dose_and_rate.setDose(VersionConvertor_10_40.convertType(src.getDose()));
|
||||||
|
if (src.hasRate())
|
||||||
|
dose_and_rate.setDose(VersionConvertor_10_40.convertType(src.getRate()));
|
||||||
|
tgt.addDoseAndRate(dose_and_rate);
|
||||||
|
if (src.hasMaxDosePerPeriod())
|
||||||
|
tgt.setMaxDosePerPeriod(VersionConvertor_10_40.convertRatio(src.getMaxDosePerPeriod()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent medDispenseRequest(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderDispenseRequestComponent src) {
|
||||||
|
if (src == null || src.isEmpty())
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestDispenseRequestComponent();
|
||||||
|
if (src.hasValidityPeriod())
|
||||||
|
tgt.setValidityPeriod(VersionConvertor_10_40.convertPeriod(src.getValidityPeriod()));
|
||||||
|
if (src.hasNumberOfRepeatsAllowed())
|
||||||
|
tgt.setNumberOfRepeatsAllowed(src.getNumberOfRepeatsAllowed());
|
||||||
|
if (src.hasQuantity())
|
||||||
|
tgt.setQuantity(VersionConvertor_10_40.convertSimpleQuantity(src.getQuantity()));
|
||||||
|
if (src.hasExpectedSupplyDuration())
|
||||||
|
tgt.setExpectedSupplyDuration(VersionConvertor_10_40.convertDuration(src.getExpectedSupplyDuration()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent medSubstitution(org.hl7.fhir.dstu2.model.MedicationOrder.MedicationOrderSubstitutionComponent src) {
|
||||||
|
if (src == null || src.isEmpty())
|
||||||
|
return null;
|
||||||
|
org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationRequest.MedicationRequestSubstitutionComponent();
|
||||||
|
if (src.hasReason())
|
||||||
|
tgt.setReason(VersionConvertor_10_40.convertCodeableConcept(src.getReason()));
|
||||||
|
return tgt;
|
||||||
|
}
|
||||||
|
}
|
|
@ -43,8 +43,14 @@ public class MedicationRequest30_40 {
|
||||||
tgt.setPriorPrescription(VersionConvertor_30_40.convertReference(src.getPriorPrescription()));
|
tgt.setPriorPrescription(VersionConvertor_30_40.convertReference(src.getPriorPrescription()));
|
||||||
for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t));
|
for (org.hl7.fhir.dstu3.model.Reference t : src.getDetectedIssue()) tgt.addDetectedIssue(VersionConvertor_30_40.convertReference(t));
|
||||||
for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t));
|
for (org.hl7.fhir.dstu3.model.Reference t : src.getEventHistory()) tgt.addEventHistory(VersionConvertor_30_40.convertReference(t));
|
||||||
if (src.hasRequester() && src.getRequester().hasAgent()) {
|
if (src.hasRequester()) {
|
||||||
tgt.setRequester(VersionConvertor_30_40.convertReference(src.getRequester().getAgent()));
|
if (src.getRequester().hasAgent()) {
|
||||||
|
tgt.setRequester(VersionConvertor_30_40.convertReference(src.getRequester().getAgent()));
|
||||||
|
}
|
||||||
|
if (src.getRequester().hasOnBehalfOf()) {
|
||||||
|
tgt.addExtension("http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationRequest.requester.onBehalfOf",
|
||||||
|
VersionConvertor_30_40.convertReference(src.getRequester().getOnBehalfOf()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return tgt;
|
return tgt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_30;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertorAdvisor30;
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_30;
|
||||||
|
import org.hl7.fhir.convertors.loaders.R2ToR3Loader;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class AllergyIntolerance10_30Test {
|
||||||
|
private static Stream<Arguments> filesPaths() {
|
||||||
|
return Stream.of(
|
||||||
|
Arguments.of("/0_allergy_intolerance_10.json", "/0_allergy_intolerance_30.json"),
|
||||||
|
Arguments.of("/1_allergy_intolerance_10.json", "/1_allergy_intolerance_30.json")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@MethodSource("filesPaths")
|
||||||
|
@DisplayName("Test 10_30 AllergyIntolerance conversion")
|
||||||
|
public void testMedicationRequestConversion(String dstu2_path, String stu_path) throws IOException {
|
||||||
|
InputStream dstu2_input = this.getClass().getResourceAsStream(dstu2_path);
|
||||||
|
InputStream stu_exepected_input = this.getClass().getResourceAsStream(stu_path);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu2.model.AllergyIntolerance dstu2 = (org.hl7.fhir.dstu2.model.AllergyIntolerance) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
|
||||||
|
VersionConvertorAdvisor30 advisor = new R2ToR3Loader();
|
||||||
|
org.hl7.fhir.dstu3.model.Resource stu_actual = VersionConvertor_10_30.convertResource(dstu2, advisor);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu3.formats.JsonParser stu_parser = new org.hl7.fhir.dstu3.formats.JsonParser();
|
||||||
|
org.hl7.fhir.dstu3.model.Resource stu_expected = stu_parser.parse(stu_exepected_input);
|
||||||
|
|
||||||
|
Assertions.assertTrue(stu_expected.equalsDeep(stu_actual),
|
||||||
|
"Failed comparing\n" + stu_parser.composeString(stu_actual) + "\nand\n" + stu_parser.composeString(stu_expected)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_40;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||||
|
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.jupiter.params.ParameterizedTest;
|
||||||
|
import org.junit.jupiter.params.provider.Arguments;
|
||||||
|
import org.junit.jupiter.params.provider.MethodSource;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class AllergyIntolerance10_40Test {
|
||||||
|
private static Stream<Arguments> filesPaths() {
|
||||||
|
return Stream.of(
|
||||||
|
Arguments.of("/0_allergy_intolerance_10.json", "/0_allergy_intolerance_40.json"),
|
||||||
|
Arguments.of("/1_allergy_intolerance_10.json", "/1_allergy_intolerance_40.json")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParameterizedTest
|
||||||
|
@MethodSource("filesPaths")
|
||||||
|
@DisplayName("Test 10_40 AllergyIntolerance conversion")
|
||||||
|
public void testMedicationRequestConversion(String dstu2_path, String r4_path) throws IOException {
|
||||||
|
InputStream dstu2_input = this.getClass().getResourceAsStream(dstu2_path);
|
||||||
|
InputStream r4_exepected_input = this.getClass().getResourceAsStream(r4_path);
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu2.model.AllergyIntolerance dstu2 = (org.hl7.fhir.dstu2.model.AllergyIntolerance) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
|
||||||
|
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_actual = VersionConvertor_10_40.convertResource(dstu2, advisor);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
|
||||||
|
|
||||||
|
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
|
||||||
|
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package org.hl7.fhir.convertors.conv10_40;
|
||||||
|
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertorAdvisor40;
|
||||||
|
import org.hl7.fhir.convertors.VersionConvertor_10_40;
|
||||||
|
import org.hl7.fhir.convertors.misc.IGR2ConvertorAdvisor;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
|
import org.junit.jupiter.api.DisplayName;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
public class MedicationRequest10_40Test {
|
||||||
|
@Test
|
||||||
|
@DisplayName("Test 10_40 MedicationRequest conversion")
|
||||||
|
public void testMedicationRequestConversion() throws IOException {
|
||||||
|
InputStream dstu2_input = this.getClass().getResourceAsStream("/0_medication_request_10.json");
|
||||||
|
InputStream r4_exepected_input = this.getClass().getResourceAsStream("/0_medication_request_40.json");
|
||||||
|
|
||||||
|
org.hl7.fhir.dstu2.model.MedicationOrder dstu2 = (org.hl7.fhir.dstu2.model.MedicationOrder) new org.hl7.fhir.dstu2.formats.JsonParser().parse(dstu2_input);
|
||||||
|
VersionConvertorAdvisor40 advisor = new IGR2ConvertorAdvisor();
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_actual = VersionConvertor_10_40.convertResource(dstu2, advisor);
|
||||||
|
|
||||||
|
org.hl7.fhir.r4.formats.JsonParser r4_parser = new org.hl7.fhir.r4.formats.JsonParser();
|
||||||
|
org.hl7.fhir.r4.model.Resource r4_expected = r4_parser.parse(r4_exepected_input);
|
||||||
|
|
||||||
|
Assertions.assertTrue(r4_expected.equalsDeep(r4_actual),
|
||||||
|
"Failed comparing\n" + r4_parser.composeString(r4_actual) + "\nand\n" + r4_parser.composeString(r4_expected));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"recordedDate": "2015-08-25T02:11:36",
|
||||||
|
"status": "confirmed",
|
||||||
|
"criticality": "CRITL",
|
||||||
|
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
|
||||||
|
"onset": "2012-11-07T00:00:00Z",
|
||||||
|
"recorder": {"display": "MOORE, NICK",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"},
|
||||||
|
"patient": {"display": "Jason Argonaut",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
|
||||||
|
"substance": {"text": "PENICILLIN G",
|
||||||
|
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "7980",
|
||||||
|
"display": "PENICILLIN G"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "Q42T66VG0C",
|
||||||
|
"display": "PENICILLIN G"}]},
|
||||||
|
"reaction": [{"certainty": "confirmed",
|
||||||
|
"onset": "2012-11-07T00:00:00Z",
|
||||||
|
"manifestation": [{"text": "Hives"}]}]}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"id": "TBwnNbrAqC0Qw5Ha7AFT-2AB",
|
||||||
|
"clinicalStatus": "active",
|
||||||
|
"verificationStatus": "confirmed",
|
||||||
|
"criticality": "low",
|
||||||
|
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "7980",
|
||||||
|
"display": "PENICILLIN G"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "Q42T66VG0C",
|
||||||
|
"display": "PENICILLIN G"}],
|
||||||
|
"text": "PENICILLIN G"},
|
||||||
|
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||||
|
"display": "Jason Argonaut"},
|
||||||
|
"onsetDateTime": "2012-11-07T00:00:00",
|
||||||
|
"assertedDate": "2015-08-25T02:11:36",
|
||||||
|
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||||
|
"display": "MOORE, NICK"},
|
||||||
|
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
"valueString": "confirmed"}],
|
||||||
|
"manifestation": [{"text": "Hives"}],
|
||||||
|
"onset": "2012-11-07T00:00:00"}]}
|
|
@ -0,0 +1,23 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
||||||
|
"code": "confirmed"}]},
|
||||||
|
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
|
||||||
|
"code": "confirmed"}]},
|
||||||
|
"criticality": "low",
|
||||||
|
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "7980",
|
||||||
|
"display": "PENICILLIN G"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "Q42T66VG0C",
|
||||||
|
"display": "PENICILLIN G"}],
|
||||||
|
"text": "PENICILLIN G"},
|
||||||
|
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||||
|
"display": "Jason Argonaut"},
|
||||||
|
"onsetDateTime": "2012-11-07T00:00:00Z",
|
||||||
|
"recordedDate": "2015-08-25T02:11:36",
|
||||||
|
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||||
|
"display": "MOORE, NICK"},
|
||||||
|
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
"valueString": "confirmed"}],
|
||||||
|
"manifestation": [{"text": "Hives"}],
|
||||||
|
"onset": "2012-11-07T00:00:00"}]}
|
|
@ -0,0 +1,37 @@
|
||||||
|
{"resourceType": "MedicationOrder",
|
||||||
|
"dateWritten": "2016-11-13",
|
||||||
|
"status": "active",
|
||||||
|
"id": "T5YI1tCzs--JEvCICFbx8zgB",
|
||||||
|
"identifier": [{"use": "usual",
|
||||||
|
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.798268",
|
||||||
|
"value": "988736"},
|
||||||
|
{"use": "usual",
|
||||||
|
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.3.798268.801",
|
||||||
|
"value": "988736:2150291843"}],
|
||||||
|
"patient": {"display": "Jason Argonaut",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
|
||||||
|
"prescriber": {"display": "Historical Provider, MD",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/T-kmjPGEVPAmnBfmx56HsKgB"},
|
||||||
|
"medicationReference": {"display": "amitriptyline 10 MG tablet",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Medication/T0eKLT7EB2ApMM8HCEURdMAB"},
|
||||||
|
"dosageInstruction": [{"text": "Take 10 mg by mouth nightly.",
|
||||||
|
"asNeededBoolean": "False",
|
||||||
|
"route": {"text": "Oral",
|
||||||
|
"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.698288.330",
|
||||||
|
"code": "15",
|
||||||
|
"display": "Oral"}]},
|
||||||
|
"method": {"text": "Take",
|
||||||
|
"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.798268.8600",
|
||||||
|
"code": "11",
|
||||||
|
"display": "Take"}]},
|
||||||
|
"timing": {"repeat": {"frequency": 1,
|
||||||
|
"period": 1.0,
|
||||||
|
"periodUnits": "d",
|
||||||
|
"boundsPeriod": {"start": "2016-11-15T00:00:00Z",
|
||||||
|
"end": "2016-11-23T00:00:00Z"}}},
|
||||||
|
"doseQuantity": {"value": 10.0,
|
||||||
|
"unit": "mg",
|
||||||
|
"code": "mg",
|
||||||
|
"system": "http://unitsofmeasure.org"}}],
|
||||||
|
"dispenseRequest": {"validityPeriod": {"start": "2016-11-15T00:00:00Z",
|
||||||
|
"end": "2016-11-23T00:00:00Z"}}}
|
|
@ -0,0 +1,40 @@
|
||||||
|
{"resourceType": "MedicationRequest",
|
||||||
|
"id": "T5YI1tCzs--JEvCICFbx8zgB",
|
||||||
|
"identifier": [{"use": "usual",
|
||||||
|
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.2.798268",
|
||||||
|
"value": "988736"},
|
||||||
|
{"use": "usual",
|
||||||
|
"system": "urn:oid:1.2.840.114350.1.13.0.1.7.3.798268.801",
|
||||||
|
"value": "988736:2150291843"}],
|
||||||
|
"status": "active",
|
||||||
|
"intent": "order",
|
||||||
|
"medicationReference": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Medication/T0eKLT7EB2ApMM8HCEURdMAB",
|
||||||
|
"display": "amitriptyline 10 MG tablet"},
|
||||||
|
"subject": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||||
|
"display": "Jason Argonaut"},
|
||||||
|
"authoredOn": "2016-11-13T00:00:00",
|
||||||
|
"requester": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/T-kmjPGEVPAmnBfmx56HsKgB",
|
||||||
|
"display": "Historical Provider, MD"},
|
||||||
|
"dosageInstruction": [{"text": "Take 10 mg by mouth nightly.",
|
||||||
|
"timing": {"repeat": {"boundsPeriod": {"start": "2016-11-15T00:00:00Z",
|
||||||
|
"end": "2016-11-23T00:00:00Z"},
|
||||||
|
"count": 0,
|
||||||
|
"frequency": 1,
|
||||||
|
"frequencyMax": 0,
|
||||||
|
"period": 1.0,
|
||||||
|
"periodUnit": "d"}},
|
||||||
|
"asNeededBoolean": "False",
|
||||||
|
"route": {"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.698288.330",
|
||||||
|
"code": "15",
|
||||||
|
"display": "Oral"}],
|
||||||
|
"text": "Oral"},
|
||||||
|
"method": {"coding": [{"system": "urn:oid:1.2.840.114350.1.13.0.1.7.4.798268.8600",
|
||||||
|
"code": "11",
|
||||||
|
"display": "Take"}],
|
||||||
|
"text": "Take"},
|
||||||
|
"doseAndRate": [{"doseQuantity": {"value": 10.0,
|
||||||
|
"unit": "mg",
|
||||||
|
"system": "http://unitsofmeasure.org",
|
||||||
|
"code": "mg"}}]}],
|
||||||
|
"dispenseRequest": {"validityPeriod": {"start": "2016-11-15T00:00:00Z",
|
||||||
|
"end": "2016-11-23T00:00:00Z"}}}
|
|
@ -0,0 +1,20 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"recordedDate": "2015-11-07T22:56:34",
|
||||||
|
"status": "confirmed",
|
||||||
|
"criticality": "CRITH",
|
||||||
|
"id": "TKebKfLXzu6Sp.LY-IpvpmQB",
|
||||||
|
"onset": "2014-03-07T00:00:00Z",
|
||||||
|
"recorder": {"display": "MOORE, NICK",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB"},
|
||||||
|
"patient": {"display": "Jason Argonaut",
|
||||||
|
"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"},
|
||||||
|
"substance": {"text": "STRAWBERRY",
|
||||||
|
"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "892484",
|
||||||
|
"display": "STRAWBERRY"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "4J2TY8Y81V",
|
||||||
|
"display": "STRAWBERRY"}]},
|
||||||
|
"reaction": [{"certainty": "confirmed",
|
||||||
|
"onset": "2014-03-07T00:00:00Z",
|
||||||
|
"manifestation": [{"text": "Anaphylaxis"}]}]}
|
|
@ -0,0 +1,22 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"id": "TKebKfLXzu6Sp.LY-IpvpmQB",
|
||||||
|
"clinicalStatus": "active",
|
||||||
|
"verificationStatus": "confirmed",
|
||||||
|
"criticality": "high",
|
||||||
|
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "892484",
|
||||||
|
"display": "STRAWBERRY"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "4J2TY8Y81V",
|
||||||
|
"display": "STRAWBERRY"}],
|
||||||
|
"text": "STRAWBERRY"},
|
||||||
|
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||||
|
"display": "Jason Argonaut"},
|
||||||
|
"onsetDateTime": "2014-03-07T00:00:00",
|
||||||
|
"assertedDate": "2015-11-07T22:56:34",
|
||||||
|
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||||
|
"display": "MOORE, NICK"},
|
||||||
|
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
"valueString": "confirmed"}],
|
||||||
|
"manifestation": [{"text": "Anaphylaxis"}],
|
||||||
|
"onset": "2014-03-07T00:00:00"}]}
|
|
@ -0,0 +1,23 @@
|
||||||
|
{"resourceType": "AllergyIntolerance",
|
||||||
|
"clinicalStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical",
|
||||||
|
"code": "confirmed"}]},
|
||||||
|
"verificationStatus": {"coding": [{"system": "http://terminology.hl7.org/CodeSystem/allergyintolerance-verification",
|
||||||
|
"code": "confirmed"}]},
|
||||||
|
"criticality": "high",
|
||||||
|
"code": {"coding": [{"system": "http://www.nlm.nih.gov/research/umls/rxnorm",
|
||||||
|
"code": "892484",
|
||||||
|
"display": "STRAWBERRY"},
|
||||||
|
{"system": "http://fdasis.nlm.nih.gov",
|
||||||
|
"code": "4J2TY8Y81V",
|
||||||
|
"display": "STRAWBERRY"}],
|
||||||
|
"text": "STRAWBERRY"},
|
||||||
|
"patient": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB",
|
||||||
|
"display": "Jason Argonaut"},
|
||||||
|
"onsetDateTime": "2014-03-07T00:00:00Z",
|
||||||
|
"recordedDate": "2015-11-07T22:56:34",
|
||||||
|
"recorder": {"reference": "https://open-ic.epic.com/Argonaut/api/FHIR/DSTU2/Practitioner/TItWfhjChtlo0pFh9nzctSQB",
|
||||||
|
"display": "MOORE, NICK"},
|
||||||
|
"reaction": [{"extension": [{"url": "http://hl7.org/fhir/AllergyIntolerance-r2-certainty",
|
||||||
|
"valueString": "confirmed"}],
|
||||||
|
"manifestation": [{"text": "Anaphylaxis"}],
|
||||||
|
"onset": "2014-03-07T00:00:00"}]}
|
|
@ -188,7 +188,7 @@ public class XmlParser extends ParserBase {
|
||||||
String name = element.getLocalName();
|
String name = element.getLocalName();
|
||||||
String path = "/"+pathPrefix(ns)+name;
|
String path = "/"+pathPrefix(ns)+name;
|
||||||
|
|
||||||
StructureDefinition sd = getDefinition(line(element), col(element), ns, name);
|
StructureDefinition sd = getDefinition(line(element), col(element), (ns == null ? "default" : ns), name);
|
||||||
if (sd == null)
|
if (sd == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
@ -240,7 +240,11 @@ public class XmlParser extends ParserBase {
|
||||||
if (empty(element) && FormatUtilities.FHIR_NS.equals(element.getNamespaceURI())) // this rule only applies to FHIR Content
|
if (empty(element) && FormatUtilities.FHIR_NS.equals(element.getNamespaceURI())) // this rule only applies to FHIR Content
|
||||||
logError(line(element), col(element), path, IssueType.INVALID, context.formatMessage(I18nConstants.ELEMENT_MUST_HAVE_SOME_CONTENT), IssueSeverity.ERROR);
|
logError(line(element), col(element), path, IssueType.INVALID, context.formatMessage(I18nConstants.ELEMENT_MUST_HAVE_SOME_CONTENT), IssueSeverity.ERROR);
|
||||||
String ns = prop.getXmlNamespace();
|
String ns = prop.getXmlNamespace();
|
||||||
if (!element.getNamespaceURI().equals(ns))
|
String elementNs = element.getNamespaceURI();
|
||||||
|
if (elementNs == null) {
|
||||||
|
elementNs = "default";
|
||||||
|
}
|
||||||
|
if (!elementNs.equals(ns))
|
||||||
logError(line(element), col(element), path, IssueType.INVALID, context.formatMessage(I18nConstants.WRONG_NAMESPACE__EXPECTED_, ns), IssueSeverity.ERROR);
|
logError(line(element), col(element), path, IssueType.INVALID, context.formatMessage(I18nConstants.WRONG_NAMESPACE__EXPECTED_, ns), IssueSeverity.ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -539,7 +543,10 @@ public class XmlParser extends ParserBase {
|
||||||
xml.setSortAttributes(false);
|
xml.setSortAttributes(false);
|
||||||
xml.setPretty(style == OutputStyle.PRETTY);
|
xml.setPretty(style == OutputStyle.PRETTY);
|
||||||
xml.start();
|
xml.start();
|
||||||
xml.setDefaultNamespace(e.getProperty().getXmlNamespace());
|
String ns = e.getProperty().getXmlNamespace();
|
||||||
|
if (ns!=null && !"default".equals(ns)) {
|
||||||
|
xml.setDefaultNamespace(ns);
|
||||||
|
}
|
||||||
if (hasTypeAttr(e))
|
if (hasTypeAttr(e))
|
||||||
xml.namespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
|
xml.namespace("http://www.w3.org/2001/XMLSchema-instance", "xsi");
|
||||||
addNamespaces(xml, e);
|
addNamespaces(xml, e);
|
||||||
|
@ -549,7 +556,7 @@ public class XmlParser extends ParserBase {
|
||||||
|
|
||||||
private void addNamespaces(IXMLWriter xml, Element e) throws IOException {
|
private void addNamespaces(IXMLWriter xml, Element e) throws IOException {
|
||||||
String ns = e.getProperty().getXmlNamespace();
|
String ns = e.getProperty().getXmlNamespace();
|
||||||
if (ns!=null && !xml.getDefaultNamespace().equals(ns)){
|
if (ns!=null && xml.getDefaultNamespace()!=null && !xml.getDefaultNamespace().equals(ns)){
|
||||||
if (!xml.namespaceDefined(ns)) {
|
if (!xml.namespaceDefined(ns)) {
|
||||||
String prefix = pathPrefix(ns);
|
String prefix = pathPrefix(ns);
|
||||||
if (prefix.endsWith(":")) {
|
if (prefix.endsWith(":")) {
|
||||||
|
|
|
@ -450,7 +450,7 @@ public class XMLWriter extends OutputStreamWriter implements IXMLWriter {
|
||||||
if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
|
if ("http://www.w3.org/XML/1998/namespace".equals(namespace))
|
||||||
return "xml:";
|
return "xml:";
|
||||||
|
|
||||||
if (namespace == null || "".equals(namespace))
|
if (namespace == null || "".equals(namespace) || "default".equals(namespace))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
XMLNamespace ns = findByNamespace(namespace);
|
XMLNamespace ns = findByNamespace(namespace);
|
||||||
|
|
|
@ -140,7 +140,7 @@ public class BundleValidator extends BaseValidator{
|
||||||
NodeStack localStack = stack.push(section, i, null, null);
|
NodeStack localStack = stack.push(section, i, null, null);
|
||||||
|
|
||||||
// technically R4+, but there won't be matches from before that
|
// technically R4+, but there won't be matches from before that
|
||||||
validateDocumentReference(errors, entries, section, stack, fullUrl, id, false, "author", "Section");
|
validateDocumentReference(errors, entries, section, stack, fullUrl, id, true, "author", "Section");
|
||||||
validateDocumentReference(errors, entries, section, stack, fullUrl, id, false, "focus", "Section");
|
validateDocumentReference(errors, entries, section, stack, fullUrl, id, false, "focus", "Section");
|
||||||
|
|
||||||
List<Element> sectionEntries = new ArrayList<Element>();
|
List<Element> sectionEntries = new ArrayList<Element>();
|
||||||
|
|
|
@ -212,14 +212,16 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
|
||||||
if (content.has("security-checks")) {
|
if (content.has("security-checks")) {
|
||||||
val.setSecurityChecks(content.get("security-checks").getAsBoolean());
|
val.setSecurityChecks(content.get("security-checks").getAsBoolean());
|
||||||
}
|
}
|
||||||
val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false);
|
if (content.has("logical")==false) {
|
||||||
System.out.println(String.format("Start Validating (%d to set up)", (System.nanoTime() - setup) / 1000000));
|
val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false);
|
||||||
if (name.endsWith(".json"))
|
System.out.println(String.format("Start Validating (%d to set up)", (System.nanoTime() - setup) / 1000000));
|
||||||
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON);
|
if (name.endsWith(".json"))
|
||||||
else
|
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON);
|
||||||
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML);
|
else
|
||||||
System.out.println(val.reportTimes());
|
val.validate(null, errors, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML);
|
||||||
checkOutcomes(errors, content, null);
|
System.out.println(val.reportTimes());
|
||||||
|
checkOutcomes(errors, content, null);
|
||||||
|
}
|
||||||
if (content.has("profile")) {
|
if (content.has("profile")) {
|
||||||
System.out.print("** Profile: ");
|
System.out.print("** Profile: ");
|
||||||
JsonObject profile = content.getAsJsonObject("profile");
|
JsonObject profile = content.getAsJsonObject("profile");
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.1.34</validator_test_case_version>
|
<validator_test_case_version>1.1.35</validator_test_case_version>
|
||||||
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
||||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||||
<jacoco_version>0.8.5</jacoco_version>
|
<jacoco_version>0.8.5</jacoco_version>
|
||||||
|
|
Loading…
Reference in New Issue