Spaces:
Running
Running
neerajkalyank
commited on
Commit
•
494486d
1
Parent(s):
61f0279
Create test_selection.py
Browse files- test_selection.py +19 -0
test_selection.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Define costs for tests in each category
|
2 |
+
TEST_PRICES = {
|
3 |
+
"Hematology": {"CBC": 200, "ESR": 100},
|
4 |
+
"Biochemistry": {"LFT": 300, "KFT": 400}
|
5 |
+
}
|
6 |
+
|
7 |
+
def select_tests(patient_id, categories, selected_tests, data):
|
8 |
+
if patient_id not in data:
|
9 |
+
return "Invalid Patient ID. Please register the patient first."
|
10 |
+
|
11 |
+
total_cost = 0
|
12 |
+
for category in categories:
|
13 |
+
for test in selected_tests:
|
14 |
+
if test in TEST_PRICES.get(category, {}):
|
15 |
+
total_cost += TEST_PRICES[category][test]
|
16 |
+
data[patient_id]["tests"].append(test)
|
17 |
+
|
18 |
+
data[patient_id]["total_cost"] = total_cost
|
19 |
+
return f"Tests Selected: {', '.join(selected_tests)}. Total Cost: {total_cost}"
|