from test_selection import TEST_PRICES # Make sure TEST_PRICES is accessible def fetch_billing(patient_id, data): if patient_id not in data: return "Invalid Patient ID. Please check the ID." patient_data = data[patient_id] tests_with_prices = [] # Loop through the tests and get their prices from TEST_PRICES for category, tests in TEST_PRICES.items(): for test in patient_data["tests"]: if test in tests: price = tests[test] tests_with_prices.append(f"- {test}: ₹{price}") test_list = "\n".join(tests_with_prices) # Join all tests into a list format total_cost = patient_data["total_cost"] billing_info = ( f"Patient ID: {patient_id}\n" f"Patient: {patient_data['name']}\n" f"Phone Number: {patient_data['phone']}\n" f"Tests:\n{test_list}\n" f"Total Bill: ₹{total_cost}" ) return billing_info