Skip to content

Commit

Permalink
Merge pull request #111 from udsm-dhis2-lab/feat/extract-data-templat…
Browse files Browse the repository at this point in the history
…e-block

fix: Use http instead of https in extension urls
  • Loading branch information
yuzalsif authored Dec 8, 2024
2 parents 4c220f8 + 96bd1b6 commit 1981969
Showing 1 changed file with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -848,10 +848,10 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
for (Procedure procedure : chemotherapyProcedures) {
Map<String, Object> chemoTherapy = new HashMap<>();
chemoTherapy.put("diagnosis", procedure.hasReasonCode() && !procedure.getReasonCode().isEmpty() && procedure.getReasonCode().get(0).hasCoding() ? procedure.getReasonCode().get(0).getCoding().get(0).getDisplay() : null);
chemoTherapy.put("regiment", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "regiment"));
chemoTherapy.put("stage", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "stage"));
chemoTherapy.put("totalNumberOfExpectedCycles", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "totalExpectedCycles"));
chemoTherapy.put("currentChemotherapeuticCycles", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "currentCycles"));
chemoTherapy.put("regiment", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "regiment"));
chemoTherapy.put("stage", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "stage"));
chemoTherapy.put("totalNumberOfExpectedCycles", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "totalExpectedCycles"));
chemoTherapy.put("currentChemotherapeuticCycles", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/chemotherapy-details", "currentCycles"));
chemotherapyTreatment.add(chemoTherapy);
}
treatmentDetailsDTO.setChemoTherapy(chemotherapyTreatment);
Expand All @@ -865,12 +865,12 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
Map<String, Object> radioTherapy = new HashMap<>();
//Prescription
Map<String, Object> prescription = new HashMap<>();
prescription.put("type", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "prescriptionType"));
prescription.put("intention", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "intention"));
prescription.put("technique", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "technique"));
prescription.put("site", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "site"));
prescription.put("dailyDose", getNestedExtensionValueQuantityValue(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "dailyDose"));
prescription.put("totalDose", getNestedExtensionValueQuantityValue(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "totalDose"));
prescription.put("type", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "prescriptionType"));
prescription.put("intention", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "intention"));
prescription.put("technique", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "technique"));
prescription.put("site", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "site"));
prescription.put("dailyDose", getNestedExtensionValueQuantityValue(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "dailyDose"));
prescription.put("totalDose", getNestedExtensionValueQuantityValue(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-details", "totalDose"));
//TODO: Add the following values startDate, dosageDates, administrationDates and remarks
//Dosage dates
List<String> dosageDates = new ArrayList<>();
Expand All @@ -893,7 +893,7 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
report.put("date", documentReference.hasDate() ? documentReference.getDate() : null);
//TODO: attachments is a string but has been saved as a list in the radiologytherapy treatment
// report.put("attachments", documentReference.hasAttachment() ? documentReference.getAttachment() : null);
report.put("MU", getNestedExtensionValueInteger(documentReference, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-report", "measurementUnits"));
report.put("MU", getNestedExtensionValueInteger(documentReference, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/radiotherapy-report", "measurementUnits"));
}
reports.add(report);
}
Expand Down Expand Up @@ -944,10 +944,10 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
for (Procedure procedure : hormoneTherapyTreatments) {
Map<String, Object> treatment = new HashMap<>();
treatment.put("diagnosis", procedure.hasReasonCode() && !procedure.getReasonCode().isEmpty() ? procedure.getReasonCode().get(0).getCoding().get(0).getDisplay() : null);
treatment.put("regiment", getNestedExtensionValueString(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "regiment"));
treatment.put("stage", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "stage"));
treatment.put("totalNumberOfExpectedCycles", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "totalExpectedCycles"));
treatment.put("currentCycles", getNestedExtensionValueInteger(procedure, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "currentCycles"));
treatment.put("regiment", getNestedExtensionValueString(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "regiment"));
treatment.put("stage", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "stage"));
treatment.put("totalNumberOfExpectedCycles", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "totalExpectedCycles"));
treatment.put("currentCycles", getNestedExtensionValueInteger(procedure, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/hormone-therapy-details", "currentCycles"));
hormoneTherapy.add(treatment);
}
treatmentDetailsDTO.setHormoneTherapy(hormoneTherapy);
Expand Down Expand Up @@ -991,8 +991,8 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
billingsDetailsDTO.setBillingCode(chargeItem.hasCode() && chargeItem.getCode().hasCoding() && !chargeItem.getCode().getCoding().isEmpty() ? chargeItem.getCode().getCoding().get(0).getCode() : null);
billingsDetailsDTO.setAmountBilled(chargeItem.hasPriceOverride() ? chargeItem.getPriceOverride().getValue() : null);
billingsDetailsDTO.setBillDate(chargeItem.hasOccurrenceDateTimeType() ? chargeItem.getOccurrenceDateTimeType().getValue() : null);
billingsDetailsDTO.setExemptionType(getNestedExtensionValueString(chargeItem, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/billing-details", "exemptionType"));
billingsDetailsDTO.setStandardCode(getNestedExtensionValueString(chargeItem, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/billing-details", "standardCode"));
billingsDetailsDTO.setExemptionType(getNestedExtensionValueString(chargeItem, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/billing-details", "exemptionType"));
billingsDetailsDTO.setStandardCode(getNestedExtensionValueString(chargeItem, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/billing-details", "standardCode"));
billingsDetailsDTOS.add(billingsDetailsDTO);
}
templateData.setBillingsDetails(billingsDetailsDTOS);
Expand Down Expand Up @@ -1051,13 +1051,13 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
}
if (deliveryProcedure.hasExtension() && !deliveryProcedure.getExtension().isEmpty()) {
for (Extension extension : deliveryProcedure.getExtension()) {
if (extension.hasUrl() && extension.getUrl().equals("https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/placeOfBirth")) {
if (extension.hasUrl() && extension.getUrl().equals("http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/placeOfBirth")) {
laborAndDeliveryDetailsDTO.setPlaceOfBirth(extension.hasValue() && extension.getValue() instanceof StringType ? ((StringType) extension.getValue()).getValue() : null);
}
if (extension.hasUrl() && extension.getUrl().equals("https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/timeBetweenLaborPainAndDeliveryInHrs")) {
if (extension.hasUrl() && extension.getUrl().equals("http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/timeBetweenLaborPainAndDeliveryInHrs")) {
laborAndDeliveryDetailsDTO.setTimeBetweenLaborPainAndDeliveryInHrs(extension.hasValue() && extension.getValue() instanceof DecimalType ? ((DecimalType) extension.getValue()).getValue().intValue() : null);
}
if (extension.hasUrl() && extension.getUrl().equals("https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/isAttendantSkilled")) {
if (extension.hasUrl() && extension.getUrl().equals("http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/isAttendantSkilled")) {
laborAndDeliveryDetailsDTO.setIsAttendantSkilled(extension.hasValue() && extension.getValue() instanceof BooleanType ? ((BooleanType) extension.getValue()).getValue() : null);
}
}
Expand Down Expand Up @@ -1112,13 +1112,13 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
if (!birthDetailsObservations.isEmpty()) {
for (Observation observation : birthDetailsObservations) {
BirthDetailsDTO birthDetailsDTO = new BirthDetailsDTO();
birthDetailsDTO.setDateOfBirth(getNestedExtensionValueDateTime(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "dateOfBirth"));
birthDetailsDTO.setExclusiveBreastFed(getNestedExtensionValueBoolean(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "exclusiveBreastFed"));
birthDetailsDTO.setMotherAgeInYears(getNestedExtensionValueInteger(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherAgeInYears"));
birthDetailsDTO.setDateOfBirth(getNestedExtensionValueDateTime(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "dateOfBirth"));
birthDetailsDTO.setExclusiveBreastFed(getNestedExtensionValueBoolean(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "exclusiveBreastFed"));
birthDetailsDTO.setMotherAgeInYears(getNestedExtensionValueInteger(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherAgeInYears"));
//TODO: Add Mother HIV status
// birthDetailsDTO.setMotherHivStatus(getNestedExtensionValueString(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherHivStatus"));
// birthDetailsDTO.setMotherHivStatus(getNestedExtensionValueString(observation, "://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherHivStatus"));

birthDetailsDTO.setProvidedWithARV(getNestedExtensionValueBoolean(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "providedWithARV"));
birthDetailsDTO.setProvidedWithARV(getNestedExtensionValueBoolean(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "providedWithARV"));
birthDetailsDTO.setWeightInKgs(getComponentValueQuantityInt(observation, 0) != null ? getComponentValueQuantityInt(observation, 0).floatValue() : null);
birthDetailsDTO.setMultipleBirth(getComponentValueBoolean(observation, 1));
birthDetailsDTO.setBirthOrder(getComponentIntValue(observation, 2));
Expand Down Expand Up @@ -1191,12 +1191,12 @@ public Map<String, Object> getSharedRecordsWithPagination(Integer page, Integer
if (!birthDetailsPostnatalObservations.isEmpty()) {
for (Observation observation : birthDetailsPostnatalObservations) {
BirthDetailsDTO birthDetailsDTO = new BirthDetailsDTO();
birthDetailsDTO.setDateOfBirth(getNestedExtensionValueDateTime(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "dateOfBirth"));
birthDetailsDTO.setExclusiveBreastFed(getNestedExtensionValueBoolean(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "exclusiveBreastFed"));
birthDetailsDTO.setMotherAgeInYears(getNestedExtensionValueInteger(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherAgeInYears"));
birthDetailsDTO.setDateOfBirth(getNestedExtensionValueDateTime(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "dateOfBirth"));
birthDetailsDTO.setExclusiveBreastFed(getNestedExtensionValueBoolean(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/newborn-birth-details", "exclusiveBreastFed"));
birthDetailsDTO.setMotherAgeInYears(getNestedExtensionValueInteger(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherAgeInYears"));
//TODO: Add Mother HIV status
// birthDetailsDTO.setMotherHivStatus(getNestedExtensionValueString(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherHivStatus"));
birthDetailsDTO.setProvidedWithARV(getNestedExtensionValueBoolean(observation, "https://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "providedWithARV"));
// birthDetailsDTO.setMotherHivStatus(getNestedExtensionValueString(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "motherHivStatus"));
birthDetailsDTO.setProvidedWithARV(getNestedExtensionValueBoolean(observation, "http://fhir.dhis2.udsm.ac.tz/fhir/StructureDefinition/maternal-details", "providedWithARV"));
birthDetailsDTO.setWeightInKgs(getComponentValueQuantityInt(observation, 0) != null ? getComponentValueQuantityInt(observation, 0).floatValue() : null);
birthDetailsDTO.setMultipleBirth(getComponentValueBoolean(observation, 1));
birthDetailsDTO.setBirthOrder(getComponentIntValue(observation, 2));
Expand Down

0 comments on commit 1981969

Please sign in to comment.