use of org.openmrs.Concept in project openmrs-module-pihcore by PIH.
the class BaseEncounterDataSetManager method addObsColumn.
/**
* Adds a column containing the value of an obs in the encounter, assuming a single observation exists for the given concept
*/
protected void addObsColumn(EncounterDataSetDefinition dsd, String columnName, String conceptLookup, DataConverter... converters) {
Concept concept = Metadata.getConcept(conceptLookup);
addColumn(dsd, columnName, pihEncounterData.getSingleObsInEncounter(concept), converters);
}
use of org.openmrs.Concept in project openmrs-module-pihcore by PIH.
the class BaseEncounterDataSetManager method addSymptomPresentOrAbsentColumn.
protected void addSymptomPresentOrAbsentColumn(EncounterDataSetDefinition dsd, String columnName, String symptomPresentQuestion, String symptomAbsentQuestion, String symptomAnswer, Object valueIfPresent, Object valueIfAbsent) {
Concept presentConcept = Metadata.getConcept(symptomPresentQuestion);
Concept absentConcept = Metadata.getConcept(symptomAbsentQuestion);
Concept answerConcept = Metadata.getConcept(symptomAnswer);
MultipleObsForEncounterDataDefinition d = new MultipleObsForEncounterDataDefinition();
d.addQuestion(presentConcept);
d.addQuestion(absentConcept);
CodedObsConverter converter = new CodedObsConverter();
converter.addOption(presentConcept.getUuid(), answerConcept.getUuid(), valueIfPresent);
converter.addOption(absentConcept.getUuid(), answerConcept.getUuid(), valueIfAbsent);
addColumn(dsd, columnName, d, converter);
}
use of org.openmrs.Concept in project openmrs-module-pihcore by PIH.
the class InpatientStatsDailyDataSetManager method constructDataSetDefinition.
@Override
public DataSetDefinition constructDataSetDefinition(DataSetDescriptor dataSetDescriptor, File file) {
List<Location> inpatientLocations = adtService.getInpatientLocations();
EncounterType admissionEncounterType = encounterService.getEncounterTypeByUuid(PihEmrConfigConstants.ENCOUNTERTYPE_ADMISSION_UUID);
Concept dischargedDisposition = conceptService.getConceptByMapping("DISCHARGED", "PIH");
Concept deathDisposition = conceptService.getConceptByMapping("DEATH", "PIH");
Concept transferOutDisposition = conceptService.getConceptByMapping("Transfer out of hospital", "PIH");
Concept leftWithoutCompletionOfTreatmentDisposition = conceptService.getConceptByMapping("Departed without medical discharge", "PIH");
Concept leftWithoutSeeingClinicianDisposition = conceptService.getConceptByMapping("Left without seeing a clinician", "PIH");
List<Concept> dispositionsToConsider = Arrays.asList(dischargedDisposition, deathDisposition, transferOutDisposition, leftWithoutCompletionOfTreatmentDisposition, leftWithoutSeeingClinicianDisposition);
// Dispositions we're currently ignoring: "Transfer within hospital", "Admit to hospital", "Discharged", "Emergency Department observation", "Home"
CohortIndicatorDataSetDefinition cohortDsd = new CohortIndicatorDataSetDefinition();
cohortDsd.addParameter(getStartDateParameter());
cohortDsd.addParameter(getEndDateParameter());
DiedSoonAfterEncounterCohortDefinition diedSoonAfterAdmission = new DiedSoonAfterEncounterCohortDefinition();
diedSoonAfterAdmission.setEncounterType(admissionEncounterType);
diedSoonAfterAdmission.addParameter(new Parameter("diedOnOrAfter", "Died on or after", Date.class));
diedSoonAfterAdmission.addParameter(new Parameter("diedOnOrBefore", "Died on or before", Date.class));
for (Location location : inpatientLocations) {
addIndicator(cohortDsd, "censusAtStart", "Census at start", location, Mapped.map(pihCohorts.getInpatientAtLocationOnDate(), "date=${startDate}"));
addIndicator(cohortDsd, "censusAtEnd", "Census at end", location, Mapped.map(pihCohorts.getInpatientAtLocationOnDate(), "date=${endDate}"));
addIndicator(cohortDsd, "admissions", "Admission", location, Mapped.mapStraightThrough(pihCohorts.getAdmissionAtLocationDuringPeriod()));
addIndicator(cohortDsd, "transfersIn", "Transfer In", location, Mapped.mapStraightThrough(pihCohorts.getTransferInToLocationDuringPeriod()));
addIndicator(cohortDsd, "transfersOut", "Transfer Out", location, Mapped.mapStraightThrough(pihCohorts.getTransferOutOfLocationDuringPeriod()));
addIndicator(cohortDsd, "discharged", "Discharged", location, Mapped.mapStraightThrough(pihCohorts.getDischargeExitFromLocationDuringPeriod()));
addIndicator(cohortDsd, "deathsWithin48", "Deaths within 48h", location, Mapped.mapStraightThrough(pihCohorts.getDiedExitFromLocationDuringPeriodSoonAfterAdmission()));
addIndicator(cohortDsd, "deathsAfter48", "Deaths after 48h", location, Mapped.mapStraightThrough(pihCohorts.getDiedExitFromLocationDuringPeriodNotSoonAfterAdmission()));
addIndicator(cohortDsd, "transfersOutOfHUM", "Transfer Outs", location, Mapped.mapStraightThrough(pihCohorts.getTransferOutOfHumExitFromLocationDuringPeriod()));
// number left without completing treatment
LastDispositionBeforeExitCohortDefinition leftWithoutCompletingTreatment = new LastDispositionBeforeExitCohortDefinition();
leftWithoutCompletingTreatment.addParameter(new Parameter("exitOnOrAfter", "Exit on or after", Date.class));
leftWithoutCompletingTreatment.addParameter(new Parameter("exitOnOrBefore", "Exit on or before", Date.class));
leftWithoutCompletingTreatment.setExitFromWard(location);
leftWithoutCompletingTreatment.setDispositionsToConsider(dispositionsToConsider);
leftWithoutCompletingTreatment.addDisposition(leftWithoutCompletionOfTreatmentDisposition);
addIndicator(cohortDsd, "leftWithoutCompletingTx", "Left Without Completing Treatment", location, Mapped.map(leftWithoutCompletingTreatment, "exitOnOrAfter=${startDate},exitOnOrBefore=${endDate}"));
LastDispositionBeforeExitCohortDefinition leftWithoutSeeingClinician = new LastDispositionBeforeExitCohortDefinition();
leftWithoutSeeingClinician.addParameter(new Parameter("exitOnOrAfter", "Exit on or after", Date.class));
leftWithoutSeeingClinician.addParameter(new Parameter("exitOnOrBefore", "Exit on or before", Date.class));
leftWithoutSeeingClinician.setExitFromWard(location);
leftWithoutSeeingClinician.setDispositionsToConsider(dispositionsToConsider);
leftWithoutSeeingClinician.addDisposition(leftWithoutSeeingClinicianDisposition);
addIndicator(cohortDsd, "leftWithoutSeeingClinician", "Left Without Seeing Clinician", location, Mapped.map(leftWithoutSeeingClinician, "exitOnOrAfter=${startDate},exitOnOrBefore=${endDate}"));
}
// number of ED check-ins
// TODO change this to count by visits or by encounters, instead of by patients
EncounterCohortDefinition edCheckIn = new EncounterCohortDefinition();
edCheckIn.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
edCheckIn.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
edCheckIn.addEncounterType(encounterService.getEncounterTypeByUuid(PihEmrConfigConstants.ENCOUNTERTYPE_CHECK_IN_UUID));
edCheckIn.addLocation(locationService.getLocationByUuid(EMERGENCY_DEPARTMENT_UUID));
edCheckIn.addLocation(locationService.getLocationByUuid(EMERGENCY_RECEPTION_UUID));
addIndicator(cohortDsd, "edcheckin", "ED Check In", Mapped.map(edCheckIn, "onOrAfter=${startDate},onOrBefore=${endDate}"));
// number of surgical op-notes entered
EncounterCohortDefinition surgicalNotes = new EncounterCohortDefinition();
surgicalNotes.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
surgicalNotes.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
surgicalNotes.addEncounterType(encounterService.getEncounterTypeByUuid(PihEmrConfigConstants.ENCOUNTERTYPE_POST_OPERATIVE_NOTE_UUID));
addIndicator(cohortDsd, "orvolume", "OR Volume", Mapped.map(surgicalNotes, "onOrAfter=${startDate},onOrBefore=${endDate}"));
// potential readmissions
AdmissionSoonAfterExitCohortDefinition readmission = new AdmissionSoonAfterExitCohortDefinition();
readmission.addParameter(new Parameter("onOrAfter", "On or after", Date.class));
readmission.addParameter(new Parameter("onOrBefore", "On or before", Date.class));
addIndicator(cohortDsd, "possiblereadmission", "Possible Readmission", Mapped.map(readmission, "onOrAfter=${startDate},onOrBefore=${endDate}"));
return cohortDsd;
}
use of org.openmrs.Concept in project openmrs-module-pihcore by PIH.
the class BaseObsDataSetManager method addObsColumn.
/**
* Adds a column containing the value of an obs in the encounter, assuming a single observation exists for the given concept
*/
protected void addObsColumn(ObsDataSetDefinition dsd, String columnName, String conceptLookup, DataConverter... converters) {
Concept concept = Metadata.getConcept(conceptLookup);
addColumn(dsd, columnName, pihObsData.getSingleObsInGroup(concept), converters);
}
use of org.openmrs.Concept in project openmrs-module-pihcore by PIH.
the class PastMedicalHistoryCheckboxTagHandlerTest method setupConcepts.
private void setupConcepts() throws Exception {
// copied from some pihcore concept setup, but tweaked to work with standardTestDataset.xml
ConceptDatatype coded = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.CODED);
ConceptDatatype text = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.TEXT);
ConceptDatatype notApplicable = MetadataUtils.existing(ConceptDatatype.class, CoreConceptMetadataBundle.ConceptDatatypes.N_A);
ConceptClass diagnosis = MetadataUtils.existing(ConceptClass.class, "938834bf-a745-4dbd-b611-f06a9a5a3060");
ConceptClass question = MetadataUtils.existing(ConceptClass.class, "a82ef63c-e4e4-48d6-988a-fdd74d7541a7");
ConceptClass misc = MetadataUtils.existing(ConceptClass.class, "ecdee8a7-d741-4fe7-8e01-f79cacbe97bc");
ConceptMapType sameAs = MetadataUtils.existing(ConceptMapType.class, CoreConceptMetadataBundle.ConceptMapTypes.SAME_AS);
ConceptSource ciel = conceptSource("CIEL", "Columbia International eHealth Laboratory concept ID", null, CoreConceptMetadataBundle.ConceptSources.CIEL);
conceptService.saveConceptSource(ciel);
// these are in standardTestDataset.xml
Concept no = conceptService.getConcept(8);
Concept unknown = conceptService.getConcept(22);
// need this to have a different UUID to match our dictionary
yes = conceptService.getConcept(7);
yes.setUuid(CommonConcepts.Concepts.YES);
conceptService.saveConcept(yes);
Concept pmhWhich = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_FINDING).datatype(coded).conceptClass(diagnosis).name("1908BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history finding", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).description("1470FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "Coded list of past medical history problems but not procedures which are coded under Past Surgical History.", Locale.ENGLISH).mapping(new ConceptMapBuilder("171868ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1628").build()).build());
Concept isSymptomPresent = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_PRESENCE).datatype(coded).conceptClass(diagnosis).name("2009BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Sign/symptom present", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).answers(yes, no, unknown).mapping(new ConceptMapBuilder("171968ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1729").build()).build());
// TODO waiting for confirmation from Andy that this is appropriate as comments
Concept pmhComment = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_COMMENT).datatype(text).conceptClass(question).name("108123BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history added (text)", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).mapping(new ConceptMapBuilder("217354ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "160221").build()).build());
Concept pmhConstruct = install(new ConceptBuilder(ClinicalConsultationConcepts.Concepts.PAST_MEDICAL_HISTORY_CONSTRUCT).datatype(notApplicable).conceptClass(misc).name("1913BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "Past medical history", Locale.ENGLISH, ConceptNameType.FULLY_SPECIFIED).name("86916BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB", "PMH", Locale.ENGLISH, ConceptNameType.SHORT).setMembers(pmhWhich, isSymptomPresent, pmhComment).mapping(new ConceptMapBuilder("171873ABBBBBBBBBBBBBBBBBBBBBBBBBBBBB").type(sameAs).ensureTerm(ciel, "1633").build()).build());
}
Aggregations