neerajkalyank commited on
Commit
787094b
1 Parent(s): 425deb7

Update test_selection.py

Browse files
Files changed (1) hide show
  1. test_selection.py +58 -10
test_selection.py CHANGED
@@ -1,19 +1,67 @@
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}"
 
1
  # Define costs for tests in each category
2
  TEST_PRICES = {
3
+ "Haematology": {
4
+ "Haemoglobin estimation": 50,
5
+ "RBC count": 80,
6
+ "Platelet count": 60,
7
+ "ESR": 40
8
+ },
9
+ "Clinical Pathology": {
10
+ "Urine albumin and sugar test": 70,
11
+ "Urine microscopy": 50,
12
+ "Pap smear": 200
13
+ },
14
+ "Biochemistry": {
15
+ "Blood Sugar (Random)": 40,
16
+ "Serum Creatinine": 100,
17
+ "Total Cholesterol": 150,
18
+ "SGPT (ALT)": 120
19
+ },
20
+ "Microbiology": {
21
+ "Throat swab for Diphtheria": 150,
22
+ "Urine culture and sensitivity": 300,
23
+ "Smear examination for Leprosy": 80
24
+ },
25
+ "Specific Diseases": {
26
+ "Malaria antigen test": 100,
27
+ "Dengue NS1 antigen test": 500,
28
+ "Tuberculosis sputum test": 200
29
+ },
30
+ "Serology": {
31
+ "Rheumatoid Factor (RF) quantitative": 150,
32
+ "Anti-Streptolysin O (ASO) titre": 200
33
+ },
34
+ "Radiology": {
35
+ "Chest X-ray": 500,
36
+ "ECG": 300
37
+ },
38
+ "Other Diagnostic Tests": {
39
+ "Visual Inspection with Acetic Acid (VIA)": 50,
40
+ "Water quality testing (for H2S)": 100
41
+ }
42
  }
43
 
44
+ def get_tests_by_category(categories):
45
+ available_tests = []
46
+ for category in categories:
47
+ if category in TEST_PRICES:
48
+ for test, cost in TEST_PRICES[category].items():
49
+ available_tests.append(f"{test} - ₹{cost}")
50
+ return available_tests
51
+
52
+ def select_tests(patient_id, selected_tests, data):
53
  if patient_id not in data:
54
  return "Invalid Patient ID. Please register the patient first."
55
 
56
  total_cost = 0
57
+ tests_selected = []
58
+ for item in selected_tests:
59
+ test_name = item.split(" - ")[0] # Extract the test name
60
+ for category, tests in TEST_PRICES.items():
61
+ if test_name in tests:
62
+ total_cost += tests[test_name]
63
+ tests_selected.append(test_name)
64
+
65
+ data[patient_id]["tests"] = tests_selected
66
  data[patient_id]["total_cost"] = total_cost
67
+ return f"Tests Selected: {', '.join(tests_selected)}. Total Cost: {total_cost}"