use of org.hl7.fhir.dstu3.model.Immunization in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeImmunization.
protected void composeImmunization(Complex parent, String parentType, String name, Immunization element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeDomainResource(t, "Immunization", name, element, index);
for (int i = 0; i < element.getIdentifier().size(); i++) composeIdentifier(t, "Immunization", "identifier", element.getIdentifier().get(i), i);
if (element.hasStatusElement())
composeCode(t, "Immunization", "status", element.getStatusElement(), -1);
if (element.hasDateElement())
composeDateTime(t, "Immunization", "date", element.getDateElement(), -1);
if (element.hasVaccineCode())
composeCodeableConcept(t, "Immunization", "vaccineCode", element.getVaccineCode(), -1);
if (element.hasPatient())
composeReference(t, "Immunization", "patient", element.getPatient(), -1);
if (element.hasWasNotGivenElement())
composeBoolean(t, "Immunization", "wasNotGiven", element.getWasNotGivenElement(), -1);
if (element.hasReportedElement())
composeBoolean(t, "Immunization", "reported", element.getReportedElement(), -1);
if (element.hasPerformer())
composeReference(t, "Immunization", "performer", element.getPerformer(), -1);
if (element.hasRequester())
composeReference(t, "Immunization", "requester", element.getRequester(), -1);
if (element.hasEncounter())
composeReference(t, "Immunization", "encounter", element.getEncounter(), -1);
if (element.hasManufacturer())
composeReference(t, "Immunization", "manufacturer", element.getManufacturer(), -1);
if (element.hasLocation())
composeReference(t, "Immunization", "location", element.getLocation(), -1);
if (element.hasLotNumberElement())
composeString(t, "Immunization", "lotNumber", element.getLotNumberElement(), -1);
if (element.hasExpirationDateElement())
composeDate(t, "Immunization", "expirationDate", element.getExpirationDateElement(), -1);
if (element.hasSite())
composeCodeableConcept(t, "Immunization", "site", element.getSite(), -1);
if (element.hasRoute())
composeCodeableConcept(t, "Immunization", "route", element.getRoute(), -1);
if (element.hasDoseQuantity())
composeQuantity(t, "Immunization", "doseQuantity", element.getDoseQuantity(), -1);
for (int i = 0; i < element.getNote().size(); i++) composeAnnotation(t, "Immunization", "note", element.getNote().get(i), i);
if (element.hasExplanation())
composeImmunizationImmunizationExplanationComponent(t, "Immunization", "explanation", element.getExplanation(), -1);
for (int i = 0; i < element.getReaction().size(); i++) composeImmunizationImmunizationReactionComponent(t, "Immunization", "reaction", element.getReaction().get(i), i);
for (int i = 0; i < element.getVaccinationProtocol().size(); i++) composeImmunizationImmunizationVaccinationProtocolComponent(t, "Immunization", "vaccinationProtocol", element.getVaccinationProtocol().get(i), i);
}
use of org.hl7.fhir.dstu3.model.Immunization in project org.hl7.fhir.core by hapifhir.
the class ProfileUtilitiesTests method execute.
public void execute(String[] args) throws FileNotFoundException, IOException, FHIRException {
System.out.println("loading context");
context = SimpleWorkerContext.fromPack(Utilities.path(root, "validation.zip"));
comp = new ProfileComparer(context);
compare("patient-daf-dafpatient.profile.xml", "patient-qicore-qicore-patient.profile.xml");
compare("encounter-daf-dafencounter.profile.xml", "encounter-qicore-qicore-encounter.profile.xml");
compare("substance-daf-dafsubstance.profile.xml", "substance-qicore-qicore-substance.profile.xml");
compare("medication-daf-dafmedication.profile.xml", "medication-qicore-qicore-medication.profile.xml");
compare("procedure-daf-dafprocedure.profile.xml", "procedure-qicore-qicore-procedure.profile.xml");
compare("familymemberhistory-daf-daffamilymemberhistory.profile.xml", "familymemberhistory-qicore-qicore-familymemberhistory.profile.xml");
compare("immunization-daf-dafimmunization.profile.xml", "immunization-qicore-qicore-immunization.profile.xml");
compare("condition-daf-dafcondition.profile.xml", "condition-qicore-qicore-condition.profile.xml");
compare("allergyintolerance-daf-dafallergyintolerance.profile.xml", "allergyintolerance-qicore-qicore-allergyintolerance.profile.xml");
compare("medicationadministration-daf-dafmedicationadministration.profile.xml", "medicationadministration-qicore-qicore-medicationadministration.profile.xml");
compare("medicationdispense-daf-dafmedicationdispense.profile.xml", "medicationdispense-qicore-qicore-medicationdispense.profile.xml");
compare("medicationprescription-daf-dafmedicationprescription.profile.xml", "medicationprescription-qicore-qicore-medicationprescription.profile.xml");
compare("medicationstatement-daf-dafmedicationstatement.profile.xml", "medicationstatement-qicore-qicore-medicationstatement.profile.xml");
compare("observation-daf-smokingstatus-dafsmokingstatus.profile.xml", "observation-qicore-qicore-observation.profile.xml");
compare("observation-daf-vitalsigns-dafvitalsigns.profile.xml", "observation-qicore-qicore-observation.profile.xml");
// compare("observation-daf-results-dafresultobs.profile.xml", "observation-qicore-qicore-observation.profile.xml");
// compare("diagnosticorder-daf-dafdiagnosticorder.profile.xml", "diagnosticorder-qicore-qicore-diagnosticorder.profile.xml");
// compare("diagnosticreport-daf-dafdiagnosticreport.profile.xml", "diagnosticreport-qicore-qicore-diagnosticreport.profile.xml");
System.out.println("processing output");
for (ProfileComparison outcome : comp.getComparisons()) {
if (outcome.getSubset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "intersection-" + outcome.getId() + ".xml")), outcome.getSubset());
if (outcome.getSuperset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "union-" + outcome.getId() + ".xml")), outcome.getSuperset());
System.out.println("\r\n" + outcome.getId() + ": Comparison of " + outcome.getLeft().getUrl() + " and " + outcome.getRight().getUrl());
for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.INFORMATION)
System.out.println(vm.summary());
for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.WARNING)
System.out.println(vm.summary());
for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.ERROR)
System.out.println(vm.summary());
for (ValidationMessage vm : outcome.getMessages()) if (vm.getLevel() == IssueSeverity.FATAL)
System.out.println(vm.summary());
System.out.println("done. " + Integer.toString(outcome.getMessages().size()) + " messages");
System.out.println("=================================================================");
}
}
use of org.hl7.fhir.dstu3.model.Immunization in project org.hl7.fhir.core by hapifhir.
the class RdfParser method composeImmunizationImmunizationPerformerComponent.
protected void composeImmunizationImmunizationPerformerComponent(Complex parent, String parentType, String name, Immunization.ImmunizationPerformerComponent element, int index) {
if (element == null)
return;
Complex t;
if (Utilities.noString(parentType))
t = parent;
else {
t = parent.predicate("fhir:" + parentType + '.' + name);
}
composeBackboneElement(t, "performer", name, element, index);
if (element.hasFunction())
composeCodeableConcept(t, "Immunization", "function", element.getFunction(), -1);
if (element.hasActor())
composeReference(t, "Immunization", "actor", element.getActor(), -1);
}
use of org.hl7.fhir.dstu3.model.Immunization in project eCRNow by drajer-health.
the class CdaImmunizationGenerator method generateImmunizationSection.
public static String generateImmunizationSection(R4FhirData data, LaunchDetails details) {
StringBuilder sb = new StringBuilder(2000);
List<Immunization> imms = data.getImmunizations();
if (imms != null && !imms.isEmpty()) {
// Generate the component and section end tags
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.COMP_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.SECTION_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID));
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID, CdaGeneratorConstants.IMMUNIZATION_SEC_TEMPLATE_ID_EXT));
sb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.CODE_EL_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_CODE, CdaGeneratorConstants.LOINC_CODESYSTEM_OID, CdaGeneratorConstants.LOINC_CODESYSTEM_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_NAME));
// add Title
sb.append(CdaGeneratorUtils.getXmlForText(CdaGeneratorConstants.TITLE_EL_NAME, CdaGeneratorConstants.IMMUNIZATION_SEC_TITLE));
// add Narrative Text
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TEXT_EL_NAME));
// Create Table Header.
List<String> list = new ArrayList<>();
list.add(CdaGeneratorConstants.IMM_TABLE_COL_1_TITLE);
list.add(CdaGeneratorConstants.IMM_TABLE_COL_2_TITLE);
sb.append(CdaGeneratorUtils.getXmlForTableHeader(list, CdaGeneratorConstants.TABLE_BORDER, CdaGeneratorConstants.TABLE_WIDTH));
// add Table Body
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
// add Body Rows
int rowNum = 1;
for (Immunization imm : imms) {
String medDisplayName = CdaGeneratorConstants.UNKNOWN_VALUE;
if (imm.getVaccineCode() != null && imm.getVaccineCode().getCodingFirstRep() != null && !StringUtils.isEmpty(imm.getVaccineCode().getCodingFirstRep().getDisplay())) {
medDisplayName = imm.getVaccineCode().getCodingFirstRep().getDisplay();
}
String dt = null;
if (imm.getOccurrenceDateTimeType() != null) {
dt = imm.getOccurrenceDateTimeType().getValue().toString();
}
Map<String, String> bodyvals = new LinkedHashMap<>();
bodyvals.put(CdaGeneratorConstants.IMM_TABLE_COL_1_BODY_CONTENT, medDisplayName);
bodyvals.put(CdaGeneratorConstants.IMM_TABLE_COL_2_BODY_CONTENT, dt);
sb.append(CdaGeneratorUtils.addTableRow(bodyvals, rowNum));
// TODO: ++rowNum or rowNum++
++rowNum;
}
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_BODY_EL_NAME));
// End Table.
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TABLE_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.TEXT_EL_NAME));
for (Immunization imm : imms) {
// add the Entries.
sb.append(CdaGeneratorUtils.getXmlForActEntry(CdaGeneratorConstants.TYPE_CODE_DEF));
// add the immunization Act
if (imm.getStatus() != ImmunizationStatus.COMPLETED) {
sb.append(CdaGeneratorUtils.getXmlForActWithNegationInd(CdaGeneratorConstants.MED_ACT_EL_NAME, CdaGeneratorConstants.MED_CLASS_CODE, CdaGeneratorConstants.MOOD_CODE_DEF, "true", true));
} else {
sb.append(CdaGeneratorUtils.getXmlForActWithNegationInd(CdaGeneratorConstants.MED_ACT_EL_NAME, CdaGeneratorConstants.MED_CLASS_CODE, CdaGeneratorConstants.MOOD_CODE_DEF, "false", true));
}
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID));
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID, CdaGeneratorConstants.IMMUNIZATION_ACTIVITY_TEMPLATE_ID_EXT));
sb.append(CdaGeneratorUtils.getXmlForII(details.getAssigningAuthorityId(), imm.getId()));
// set status code
sb.append(CdaGeneratorUtils.getXmlForCD(CdaGeneratorConstants.STATUS_CODE_EL_NAME, CdaGeneratorConstants.COMPLETED_STATUS));
// Set up Effective Time for start and End time.
if (imm.getOccurrenceDateTimeType() != null) {
logger.debug("Date Value = {}", imm.getOccurrenceDateTimeType().getValue());
sb.append(CdaFhirUtilities.getDateTimeTypeXml(imm.getOccurrenceDateTimeType(), CdaGeneratorConstants.EFF_TIME_EL_NAME));
} else {
sb.append(CdaGeneratorUtils.getXmlForNullEffectiveTime(CdaGeneratorConstants.EFF_TIME_EL_NAME, CdaGeneratorConstants.NF_NI));
}
// add the consumable presentation.
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.CONSUMABLE_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForStartElementWithClassCode(CdaGeneratorConstants.MAN_PROD_EL_NAME, CdaGeneratorConstants.MANU_CLASS_CODE));
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION));
sb.append(CdaGeneratorUtils.getXmlForTemplateId(CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION, CdaGeneratorConstants.IMMUNIZATION_MEDICATION_INFORMATION_EXT));
sb.append(CdaGeneratorUtils.getXmlForIIUsingGuid());
sb.append(CdaGeneratorUtils.getXmlForStartElement(CdaGeneratorConstants.MANU_MAT_EL_NAME));
List<CodeableConcept> cds = new ArrayList<>();
cds.add(imm.getVaccineCode());
String codeXml = CdaFhirUtilities.getCodeableConceptXmlForCodeSystem(cds, CdaGeneratorConstants.CODE_EL_NAME, false, CdaGeneratorConstants.FHIR_CVX_URL, false);
if (!codeXml.isEmpty()) {
sb.append(codeXml);
} else {
sb.append(CdaFhirUtilities.getCodeableConceptXml(cds, CdaGeneratorConstants.CODE_EL_NAME, false));
}
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MANU_MAT_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MAN_PROD_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.CONSUMABLE_EL_NAME));
// End Tags for Entries
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.MED_ACT_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.ENTRY_EL_NAME));
}
// Complete the section end tags.
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.SECTION_EL_NAME));
sb.append(CdaGeneratorUtils.getXmlForEndElement(CdaGeneratorConstants.COMP_EL_NAME));
} else {
sb.append(generateEmptyImmunizations());
}
return sb.toString();
}
use of org.hl7.fhir.dstu3.model.Immunization in project nia-patient-switching-standard-adaptor by NHSDigital.
the class ImmunizationMapper method mapImmunization.
private Immunization mapImmunization(RCMRMT030101UK04EhrComposition ehrComposition, RCMRMT030101UK04ObservationStatement observationStatement, Patient patientResource, List<Encounter> encounterList, String practiseCode) {
Immunization immunization = new Immunization();
var id = observationStatement.getId().getRoot();
var practitioner = ParticipantReferenceUtil.getParticipantReference(observationStatement.getParticipant(), ehrComposition);
var encounter = getEncounterReference(encounterList, ehrComposition.getId());
immunization.setMeta(generateMeta(META_PROFILE));
immunization.addIdentifier(buildIdentifier(id, practiseCode));
immunization.addExtension(createVaccineProcedureExtension(observationStatement));
immunization.addExtension(createRecordedTimeExtension(ehrComposition));
immunization.setEncounter(encounter).addPractitioner(new ImmunizationPractitionerComponent(practitioner)).setStatus(ImmunizationStatus.COMPLETED).setNotGiven(false).setPrimarySource(false).setPatient(new Reference(patientResource)).setId(id);
buildNote(observationStatement).forEach(immunization::addNote);
setDateFields(immunization, observationStatement);
return immunization;
}
Aggregations