Hi,
I am trying to get to work the Radiology(X-Ray) Count report in Bahmni. I have been using this snipset from Bahmni:
"radiologyCount": {
"name": "Radiology(X-Ray) Count",
"type": "ObsCountByConceptClass",
"config": {
"conceptClassNames": ["Radiology"]
}
}
And I want to achieve something like this result (also taken in bahmni):
This is my reports.json file:
{
"visitReport10": {
"name": "Visit Report",
"type": "visits",
"requiredPrivilege": "app:reports",
"config": {
"forDataAnalysis": true,
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"visitAttributes": [
"Visit Status",
"Admission Status"
],
"patientAddresses": [
"address3",
"city_village"
],
"applyDateRangeFor": "visitStopDate",
"visitTypesToFilter": [
"PHARMACY VISIT",
"OPD"
]
}
},
"testReport": {
"name": "Test Observation Report",
"type": "observations",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"patientAddresses": [
"address3",
"city_village"
],
"visitAttributes": [
"Visit Status",
"Admission Status"
],
"showVisitInfo": true,
"showProvider": true,
"conceptNamesToFilter": [
],
"conceptNameDisplayFormat": "shortNamePreferred",
"conceptValuesToFilter": ["0..20","100..","True"],
"conceptClassesToFilter": [],
"locationTagsToFilter": [],
"programsToFilter": [],
"applyDateRangeFor": "obsDate",
"encounterPerRow": true,
"forDataAnalysis": true,
"visitTypesToFilter": [
"PHARMACY VISIT",
"OPD"
]
}
},
"testFormReport":{
"name": "Test Forms Report",
"type": "forms",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"patientAddresses": [
"address3",
"city_village"
],
"visitAttributes": [
"Visit Status",
"Admission Status"
],
"showVisitInfo": true,
"showProvider": true,
"formNamesToFilter": ["Vitals"],
"conceptNameDisplayFormat": "shortNamePreferred",
"locationTagsToFilter": [],
"programsToFilter": [],
"applyDateRangeFor": "obsDate",
"visitTypesToFilter": []
}
},
"formBuilderReport":{
"name": "Form builder form Report",
"type": "formBuilder",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"caste",
"class",
"education",
"occupation"
],
"patientAddresses": [
"address3",
"city_village"
],
"visitAttributes": [
"Visit Status"
],
"showVisitInfo": true,
"showProvider": true,
"formNamesToFilter": [ "Test Form"],
"conceptNameDisplayFormat": "shortNamePreferred",
"locationTagsToFilter": [],
"programsToFilter": [],
"applyDateRangeFor": "obsDate",
"visitTypesToFilter": []
}
},
"chiefComplaintReport": {
"name": "Chief Complaint Report",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Chief Complaint"
],
"countOnlyClosedVisits": "false",
"visitTypes": [
"IPD",
"OPD"
]
}
},
"inpatientMorbidity": {
"name": "Inpatient Morbidity",
"type": "diagnosisCount",
"requiredPrivilege": "app:reports",
"config": {
"visitTypes": [
"IPD"
]
}
},
"outpatientMorbidity": {
"name": "Outpatient Morbidity",
"type": "diagnosisCount",
"requiredPrivilege": "app:reports",
"config": {
"visitTypes": [
"OPD"
]
}
},
"laboratoryServices": {
"name": "Laboratory Services",
"type": "TestCount",
"requiredPrivilege": "app:reports"
},
"genericLaboratoryServices": {
"name": "Generic Laboratory Services",
"type": "ElisGeneric",
"requiredPrivilege": "app:reports",
"config": {
"sqlPath": "/var/www/bahmni_config/openmrs/apps/reports/sql/testCount.sql"
}
},
"bloodPressure": {
"name": "Blood Pressure",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Systolic",
"Diastolic"
],
"countOnlyClosedVisits": "false",
"countOncePerPatient": "false",
"visitTypes": [
"OPD",
"IPD"
]
}
},
"smokingHistoryReport": {
"name": "Smoking History Report",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Smoking History"
],
"countOnlyClosedVisits": "false",
"countOncePerPatient": "true"
}
},
"vitalsTemplateReport": {
"name": "Vitals Template Report",
"type": "obsTemplate",
"requiredPrivilege": "app:reports",
"config": {
"templateName": "Vitals",
"patientAttributes": [
"caste",
"education"
],
"applyDateRangeFor": "encounterCreateDate"
}
},
"tuberculosisIntakeTemplateReport": {
"name": "Tuberculosis Intake Template Report",
"type": "obsTemplate",
"requiredPrivilege": "app:reports",
"config": {
"templateName": "Tuberculosis Intake Template"
}
},
"diabetes": {
"name": "Diabetes",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Diabetes Intake"
],
"visitTypes": [
"OPD",
"IPD"
]
}
},
"codedValueRangeBasedReport": {
"name": "Coded Value Range Based Report",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Diabetes, Cormorbidities"
],
"countOncePerPatient": "true"
}
},
"OPD/IPDVisitCount": {
"name": "OPD/IPD Visit Count",
"type": "IpdOpdVisitCount",
"requiredPrivilege": "app:reports"
},
"haemoglobinRangeBasedReport": {
"name": "Haemoglobin Range Based Report",
"type": "NumericConceptValuesCount",
"requiredPrivilege": "app:reports",
"config": {
"rangeGroupName": "Haemoglobin",
"ageGroupName": "Haemoglobin",
"conceptNames": [
"Haemoglobin"
],
"countOncePerPatient": "false"
}
},
"radiology(X-Ray)Count": {
"name": "Radiology(X-Ray) Count",
"type": "ObsCountByConceptClass",
"config": {
"conceptClassNames": [
"Radiology"
]
}
},
"obsValuesCountsForAlbuminMCHOperationDateAndPosture(bloodPressure)": {
"name": "Obs Values Counts for Albumin, MCH, Operation Date and Posture(blood pressure)",
"type": "ObsValueCount",
"requiredPrivilege": "app:reports",
"config": {
"conceptNames": [
"Albumin",
"MCH",
"Date of Operation",
"Posture"
]
}
},
"tuberculosisTreatmentCompletionDates": {
"name": "Tuberculosis Treatment Completion dates",
"type": "DateConceptValuesPatientsList",
"requiredPrivilege": "app:reports",
"config": {
"conceptNames": [
"Tuberculosis, Treatment Completion Date"
],
"templateName": "Tuberculosis Outcome Template"
}
},
"patientsListWithAlbuminMCHAndHIVELISA(Blood)TestsResults": {
"name": "Patients list with Albumin, MCH and HIV ELISA (Blood) tests results",
"type": "PatientsWithLabtestResults",
"requiredPrivilege": "app:reports",
"config": {
"conceptNames": [
"HIV ELISA (Blood)",
"Albumin",
"MCH"
],
"testOutcome": [
"abnormal",
"normal"
]
}
},
"IPDPatientsReport": {
"name": "IPD Patients Report",
"type": "ipdPatients",
"requiredPrivilege": "app:reports",
"config": {
"addressAttributes": [
"address1",
"city_village"
],
"patientAttributes": [
"caste",
"education"
],
"conceptNames": [
"Height",
"Weight"
],
"filterBy": "Date of Discharge"
}
},
"nutritionProgramNutritionalStatusOfRegisteredChildren": {
"name": "Nutrition Program - Nutritional status of registered children",
"type": "obsCount",
"requiredPrivilege": "app:reports",
"config": {
"ageGroupName": "All Ages",
"conceptNames": [
"Nutrition, Nutritional Status"
],
"countOncePerPatient": "true",
"countOnlyClosedVisits": "false"
}
},
"patientsProgramStateCountReport": {
"name": "Patients Program State Count Report",
"type": "programStateCount",
"requiredPrivilege": "app:reports",
"config": {
"programName": "Malaria Program"
}
},
"programPatientStateReport": {
"name": "Program Patient State Report",
"type": "PatientProgramReport",
"requiredPrivilege": "app:reports",
"config": {
"programName": "Malaria Program"
}
},
"programStateTransitionReport": {
"name": "Program State Transition Report",
"type": "programStateTransitionReport",
"requiredPrivilege": "app:reports",
"config": {
"programName": "Malaria Program"
}
},
"OrderFulfillmentReport": {
"name": "Order Fulfillment Report",
"type": "OrderFulfillmentReport",
"requiredPrivilege": "app:reports",
"config": {
"type": "OrderFulfillmentReport",
"orderTypes": [
"Order",
"Drug Order"
]
}
},
"visitReport": {
"name": "Visit Report",
"type": "visitReport",
"requiredPrivilege": "app:reports",
"config": {
"personAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"visitAttributes": [
"Visit Status"
]
}
},
"patientReport": {
"name": "Patient Information",
"type": "PatientReport",
"requiredPrivilege": "app:reports"
},
"obsCannedReport": {
"name": "Obs Canned Report",
"type": "obsCannedReport",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"caste",
"education"
],
"applyDateRangeFor": "ObsRecording",
"addressAttributes": [
"postal_code",
"city_village"
],
"conceptNames": [
"Pulse",
"WEIGHT",
"Vitals, Systolic",
"Temperature"
],
"visitIndependentConcept": [
"HEIGHT",
"Temperature"
],
"enrolledProgram": "HIV Program",
"showObsOnlyForProgramDuration": false
}
},
"drugOrderReport": {
"name": "Drug Order report",
"type": "DrugOrder",
"requiredPrivilege": "app:reports"
},
"SampleGenericProgramReport": {
"name": "Generic program sample report",
"type": "programs",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"education",
"primaryContact",
"secondaryContact",
"class",
"cluster"
],
"patientAddresses": [
"city_village",
"address3"
],
"programAttributes": [],
"forDataAnalysis": true,
"showAllStates": true,
"programNamesToFilter": [
"HIV Program"
]
}
},
"pivotReport": {
"name": "Blood Pressure",
"type": "aggregation",
"requiredPrivilege": "app:reports",
"config": {
"report":{
"type": "observations",
"config": {
"conceptNamesToFilter":["Diastolic Data", "Systolic Data"],
"showVisitInfo" : true,
"forDataAnalysis": true,
"visitAttributes": ["Visit Status", "Admission Status"],
"visitTypesToFilter": ["IPD"]
}
},
"rowGroups": [
"Gender"
],
"columnGroups": [
"Concept Name", "value"
],
"distinctGroups": [
"Patient Identifier"
]
}
},
"pivotReportOfVisits": {
"name": "Aggregation report for visits",
"type": "aggregation",
"requiredPrivilege": "app:reports",
"config": {
"report":{
"type": "visits",
"config": {
"forDataAnalysis": true,
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"visitAttributes": [
"Visit Status",
"Admission Status"
],
"patientAddresses": [
"address3",
"city_village"
],
"applyDateRangeFor": "visitStopDate",
"visitTypesToFilter": [
"PHARMACY VISIT",
"OPD"
]
}
},
"rowGroups": [
"Gender"
],
"columnGroups": [
"Visit Status"
],
"distinctGroups": [
"Patient Identifier"
]
}
},
"pivotReportForPrograms": {
"name": "HIV Program Pivot Report",
"type": "aggregation",
"requiredPrivilege": "app:reports",
"config": {
"report": {
"type": "programs",
"config": {
"patientAttributes": [
],
"patientAddresses": [
"city_village",
"address3"
],
"programAttributes": [],
"forDataAnalysis": true,
"showAllStates": true,
"programNamesToFilter": [
"TB Program",
"HIV Program"
]
}
},
"columnGroups": [
"Program name"
],
"rowGroups": [
"Gender"
],
"distinctGroups": [
"Patient Identifier"
],
"showTotalRow":true,
"showTotalColumn":true
}
},
"concatenatedReport": {
"name": "ConcatenatedReport",
"type": "concatenated",
"requiredPrivilege": "app:reports",
"config": {
"reports": [
{
"name": "Visit Report",
"type": "visits",
"config": {
"forDataAnalysis": true,
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"visitAttributes": [
"Visit Status",
"Admission Status"
],
"patientAddresses": [
"address3",
"city_village"
],
"applyDateRangeFor": "visitStopDate",
"visitTypesToFilter": [
"PHARMACY VISIT",
"OPD"
]
}
},
{
"name": "Obs Canned Report",
"type": "obsCannedReport",
"config": {
"patientAttributes": [
"caste",
"education"
],
"applyDateRangeFor": "ObsRecording",
"addressAttributes": [
"postal_code",
"city_village"
],
"conceptNames": [
"Pulse",
"WEIGHT",
"Vitals, Systolic",
"Temperature"
],
"visitIndependentConcept": [
"HEIGHT",
"Temperature"
],
"enrolledProgram": "HIV Program",
"showObsOnlyForProgramDuration": false
}
}
]
}
},
"GenericLabOrderReport": {
"name": "Lab Order Results",
"type": "labOrders",
"requiredPrivilege": "app:reports",
"config": {
"patientAttributes": [
"caste",
"class",
"education",
"occupation",
"primaryContact"
],
"patientAddresses": [
"address3",
"city_village"
],
"visitAttributes": [
"Visit Status"
],
"showVisitInfo": true,
"showProvider": true,
"programsToFilter": [],
"showReferredOutTests": true,
"conceptNamesToFilter": [
"Haemoglobin (Blood)"
],
"conceptValuesToFilter": [
"10..100"
],
"forDataAnalysis": true,
"excludeColumns": [
"address3"
],
"showOrderDateTime": true
}
},
"GenericLabOrderReportAggregation": {
"name": "Test Name vs Gender",
"type": "aggregation",
"requiredPrivilege": "app:reports",
"config": {
"report": {
"type": "labOrders",
"config": {
"forDataAnalysis": true,
"showVisitInfo": true
}
},
"rowGroups": [
"Test Name"
],
"columnGroups": [
"Gender"
],
"distinctGroups": [
"Patient Identifier"
]
}
}
}
And this is my SQL file (numericConceptValuesCount.sql) in /opt/bahmni-reports/bahmni-reports/WEB-INF/classes/sql
select base.numeric_value_range, base.report_age_group,
ifnull(sum(IF(base.gender = 'F', 1, 0)),0) AS female,
ifnull(sum(IF(base.gender = 'M', 1, 0)),0) AS male,
ifnull(sum(IF(base.gender = 'O', 1, 0)),0) AS other,
ifnull(sum(IF(base.gender in ('F','M','O'), 1, 0)),0) AS total
from
(select p.person_id as person_id, rcr.name as numeric_value_range, cn.concept_id, rcr.sort_order as rcr_sort_order, rag.sort_order as rag_sort_order, o.value_numeric, rag.name as report_age_group, p.birthdate, if(#countOncePerPatient#, max(o.obs_datetime), o.obs_datetime) as obs_date, p.gender from obs o
inner join concept_name cn on o.concept_id=cn.concept_id
inner join person p on p.person_id = o.person_id
inner join reporting_concept_range rcr on (rcr.low_value <= o.value_numeric and o.value_numeric < rcr.high_value)
and rcr.concept_name = '#rangeGroupName#'
inner join reporting_age_group rag ON DATE(o.obs_datetime) BETWEEN (DATE_ADD(DATE_ADD(birthdate, INTERVAL rag.min_years YEAR), INTERVAL rag.min_days DAY))
AND (DATE_ADD(DATE_ADD(birthdate, INTERVAL rag.max_years YEAR), INTERVAL rag.max_days DAY))
and rag.report_group_name = '#ageGroupName#'
where cn.name in (#conceptNames#) and cn.concept_name_type="FULLY_SPECIFIED" and o.value_numeric is not null
and o.voided = 0
and date(o.obs_datetime) between '#startDate#' and '#endDate#'
group by if(#countOncePerPatient#, o.person_id, concat(o.person_id, o.obs_datetime))) base
group by base.report_age_group, base.numeric_value_range
order by base.rag_sort_order, base.rcr_sort_order;
Even though I am triggering Radiology orders from Orders tab in Consultation, the report it is not being populated at all. Can someone suggest a solution or maybe another SQL that would fetch the Radiology orders (even if it is generic).