Search in sources :

Example 1 with ConvertedEncounterDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class HaitiEncounterDataSetManager method constructDataSetDefinition.

@Override
public DataSetDefinition constructDataSetDefinition(DataSetDescriptor dataSetDescriptor, File baseConfigDir) {
    EncounterDataSetDefinition dsd = new EncounterDataSetDefinition();
    dsd.addParameter(getStartDateParameter());
    dsd.addParameter(getEndDateParameter());
    BasicEncounterQuery query = new BasicEncounterQuery();
    query.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
    query.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
    dsd.addRowFilter(query, "onOrAfter=${startDate},onOrBefore=${endDate}");
    dsd.addColumn("zlEmrId", patientData(pihPatientData.getPreferredZlEmrIdIdentifier()), null);
    dsd.addColumn("patientId", builtInEncounterData.getPatientId(), null);
    dsd.addColumn("age", pihEncounterData.getPatientAgeAtEncounter(), null, new AgeConverter(AgeConverter.YEARS_TO_ONE_DECIMAL_PLACE));
    dsd.addColumn("gender", patientData(builtInPatientData.getGender()), null);
    dsd.addColumn("visitId", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "visitId"));
    dsd.addColumn("visitStart", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "startDatetime"));
    dsd.addColumn("visitStop", builtInEncounterData.getEncounterVisit(), null, new PropertyConverter(Visit.class, "stopDatetime"));
    dsd.addColumn("encounterId", builtInEncounterData.getEncounterId(), null);
    dsd.addColumn("encounterType", builtInEncounterData.getEncounterTypeName(), null);
    // the "encounterLocation.name" converter is very inefficent
    dsd.addColumn("encounterLocation", new ConvertedEncounterDataDefinition(new EncounterLocationDataDefinition(), new PropertyConverter(String.class, "name")), null);
    dsd.addColumn("encounterDatetime", builtInEncounterData.getEncounterDatetime(), null);
    dsd.addColumn("disposition", pihEncounterData.getDisposition(), null, converterLibrary.getObsValueCodedNameConverterInLocale(Locale.FRENCH));
    dsd.addColumn("enteredBy", pihEncounterData.getCreatorName(), null);
    dsd.addColumn("allProviders", pihEncounterData.getAllProviders(), null);
    dsd.addColumn("numberOfProviders", pihEncounterData.getNumberOfProviders(), null);
    dsd.addColumn("administrativeClerk", pihEncounterData.getClerk(), null);
    dsd.addColumn("nurse", pihEncounterData.getNurse(), null);
    dsd.addColumn("consultingClinician", pihEncounterData.getConsultingClinician(), null);
    dsd.addColumn("dispenser", pihEncounterData.getDispenser(), null);
    dsd.addColumn("radiologyTech", pihEncounterData.getRadiologyTechnician(), null);
    dsd.addColumn("orderingProvider", pihEncounterData.getOrderingProvider(), null);
    dsd.addColumn("principalResultsInterpreter", pihEncounterData.getPrincipalResultsInterpreter(), null);
    dsd.addColumn("attendingSurgeon", pihEncounterData.getAttendingSurgeonName(), null);
    dsd.addColumn("assistingSurgeon", pihEncounterData.getAssistingSurgeon(), null);
    dsd.addColumn("anesthesiologist", pihEncounterData.getAnesthesiologist(), null);
    dsd.addColumn("birthdate", patientData(builtInPatientData.getBirthdate()), null);
    dsd.addColumn("birthdate_estimated", patientData(builtInPatientData.getBirthdateEstimated()), null);
    dsd.addColumn("admissionStatus", pihEncounterData.getAdmissionStatus(), null);
    dsd.addColumn("requestedAdmissionLocation", pihEncounterData.getRequestedAdmissionLocationName(), null);
    dsd.addColumn("requestedTransferLocation", pihEncounterData.getRequestedTransferLocationName(), null);
    dsd.addColumn("department", patientData(pihPatientData.getPreferredAddressDepartment()), "");
    dsd.addColumn("commune", patientData(pihPatientData.getPreferredAddressCommune()), "");
    dsd.addColumn("section", patientData(pihPatientData.getPreferredAddressSection()), "");
    dsd.addColumn("locality", patientData(pihPatientData.getPreferredAddressLocality()), "");
    dsd.addColumn("street_landmark", patientData(pihPatientData.getPreferredAddressStreetLandmark()), "");
    return dsd;
}
Also used : EncounterLocationDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterLocationDataDefinition) AgeConverter(org.openmrs.module.reporting.data.converter.AgeConverter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) Visit(org.openmrs.Visit) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) Parameter(org.openmrs.module.reporting.evaluation.parameter.Parameter) EncounterDataSetDefinition(org.openmrs.module.reporting.dataset.definition.EncounterDataSetDefinition) Date(java.util.Date) BasicEncounterQuery(org.openmrs.module.reporting.query.encounter.definition.BasicEncounterQuery)

Example 2 with ConvertedEncounterDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getAllProviders.

@DocumentedDefinition
public EncounterDataDefinition getAllProviders() {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setSingleProvider(false);
    ChainedConverter itemConverter = new ChainedConverter(new PropertyConverter(Provider.class, "person"), new PropertyConverter(Person.class, "personName"), new ObjectFormatter("{givenName} {familyName}"));
    return new ConvertedEncounterDataDefinition(dd, new CollectionConverter(itemConverter, false, null), new ObjectFormatter(", "));
}
Also used : ChainedConverter(org.openmrs.module.reporting.data.converter.ChainedConverter) ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) Person(org.openmrs.Person) CollectionConverter(org.openmrs.module.reporting.data.converter.CollectionConverter) Provider(org.openmrs.Provider) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 3 with ConvertedEncounterDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getNumberOfProviders.

@DocumentedDefinition
public EncounterDataDefinition getNumberOfProviders() {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setSingleProvider(false);
    return new ConvertedEncounterDataDefinition(dd, new CountConverter());
}
Also used : CountConverter(org.openmrs.module.reporting.data.converter.CountConverter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 4 with ConvertedEncounterDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getEncounterProvider.

@DocumentedDefinition
public EncounterDataDefinition getEncounterProvider() {
    EncounterProviderDataDefinition epdd = new EncounterProviderDataDefinition();
    epdd.setSingleProvider(true);
    return new ConvertedEncounterDataDefinition(epdd, new DataConverter[] { new ObjectFormatter() });
}
Also used : ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) DocumentedDefinition(org.openmrs.module.reporting.definition.library.DocumentedDefinition)

Example 5 with ConvertedEncounterDataDefinition

use of org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition in project openmrs-module-pihcore by PIH.

the class PihEncounterDataLibrary method getProvider.

private EncounterDataDefinition getProvider(String encounterRoleUuid) {
    EncounterProviderDataDefinition dd = new EncounterProviderDataDefinition();
    dd.setEncounterRole(encounterService.getEncounterRoleByUuid(encounterRoleUuid));
    return new ConvertedEncounterDataDefinition(dd, new PropertyConverter(Provider.class, "person"), new PropertyConverter(Person.class, "personName"), new ObjectFormatter("{givenName} {familyName}"));
}
Also used : ObjectFormatter(org.openmrs.module.reporting.data.converter.ObjectFormatter) ConvertedEncounterDataDefinition(org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition) PropertyConverter(org.openmrs.module.reporting.data.converter.PropertyConverter) EncounterProviderDataDefinition(org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition) Person(org.openmrs.Person) Provider(org.openmrs.Provider)

Aggregations

ConvertedEncounterDataDefinition (org.openmrs.module.reporting.data.encounter.definition.ConvertedEncounterDataDefinition)8 ObjectFormatter (org.openmrs.module.reporting.data.converter.ObjectFormatter)6 DocumentedDefinition (org.openmrs.module.reporting.definition.library.DocumentedDefinition)6 PropertyConverter (org.openmrs.module.reporting.data.converter.PropertyConverter)4 EncounterProviderDataDefinition (org.openmrs.module.reporting.data.encounter.definition.EncounterProviderDataDefinition)4 ObsForEncounterDataDefinition (org.openmrs.module.reporting.data.encounter.definition.ObsForEncounterDataDefinition)3 Location (org.openmrs.Location)2 Person (org.openmrs.Person)2 Provider (org.openmrs.Provider)2 Date (java.util.Date)1 Obs (org.openmrs.Obs)1 Visit (org.openmrs.Visit)1 AgeConverter (org.openmrs.module.reporting.data.converter.AgeConverter)1 ChainedConverter (org.openmrs.module.reporting.data.converter.ChainedConverter)1 CollectionConverter (org.openmrs.module.reporting.data.converter.CollectionConverter)1 CountConverter (org.openmrs.module.reporting.data.converter.CountConverter)1 EncounterLocationDataDefinition (org.openmrs.module.reporting.data.encounter.definition.EncounterLocationDataDefinition)1 EncounterDataSetDefinition (org.openmrs.module.reporting.dataset.definition.EncounterDataSetDefinition)1 Parameter (org.openmrs.module.reporting.evaluation.parameter.Parameter)1 BasicEncounterQuery (org.openmrs.module.reporting.query.encounter.definition.BasicEncounterQuery)1