lims / test_selection.py
neerajkalyank's picture
Update test_selection.py
f633e04 verified
TEST_PRICES = {
"Haematology": {
"Haemoglobin estimation": 50,
"RBC count": 80,
"Platelet count": 60,
"ESR": 40
},
"Clinical Pathology": {
"Urine albumin and sugar test": 70,
"Urine microscopy": 50,
"Pap smear": 200
},
"Biochemistry": {
"Blood Sugar (Random)": 40,
"Serum Creatinine": 100,
"Total Cholesterol": 150,
"SGPT (ALT)": 120
},
"Microbiology": {
"Throat swab for Diphtheria": 150,
"Urine culture and sensitivity": 300,
"Smear examination for Leprosy": 80
},
"Specific Diseases": {
"Malaria antigen test": 100,
"Dengue NS1 antigen test": 500,
"Tuberculosis sputum test": 200
},
"Serology": {
"Rheumatoid Factor (RF) quantitative": 150,
"Anti-Streptolysin O (ASO) titre": 200
},
"Radiology": {
"Chest X-ray": 500,
"ECG": 300
},
"Other Diagnostic Tests": {
"Visual Inspection with Acetic Acid (VIA)": 50,
"Water quality testing (for H2S)": 100
}
}
def get_tests_by_category(categories):
if not categories:
return []
available_tests = []
for category in categories:
if category in TEST_PRICES:
for test, cost in TEST_PRICES[category].items():
available_tests.append(f"{test} - ₹{cost}")
return available_tests
def select_tests(patient_id, selected_tests, data):
if patient_id not in data:
return "Invalid Patient ID. Please register the patient first."
total_cost = 0
tests_selected = []
for item in selected_tests:
test_name = item.split(" - ")[0]
for category, tests in TEST_PRICES.items():
if test_name in tests:
total_cost += tests[test_name]
tests_selected.append(test_name)
data[patient_id]["tests"] = tests_selected
data[patient_id]["total_cost"] = total_cost
return f"Tests Selected: {', '.join(tests_selected)}. Total Cost: ₹{total_cost}"