0

This is just a theoretical example without real data. The goal is to quickly prescribe patients medication in a given time. For that, I've got a nested dictionary with medication class A and medication no. 1, no. 2, and so on. Each medication has a name assigned as well as a half-life duration. Otherwise, I've got a tuple that displays with which medication I have to start, e.g. first_try = ("A", "ii") means I have to start with medication ii of class A. Then the patient is given the medication in the order of the dictionaries given, here: A - i, A - ii, B - i, B - ii, but starting from the tuple first_try. They just get medication as long as the maximum_time is not reached yet.

For a better understanding the main variables:

medication = {
"A": {
    "i": {"paracetamol":"against headache","half-life":23},
    "ii": {"metamezol":"against pain","half-life":55}
},
"B": {
    "i": {"midazolam":"benzodiazepine mediaction","half-life":280},
    "ii": {"diazepam":"anxiolytic","half-life":600}
}
}

first_try = ("A", "ii")
maximum_time = 560

For now, I just need some hints on how to check and compare the values in the tuple with the key so that I know where to start and iterate each key of each medication class key. I am searching the internet for hours but I can't find anything necessary. I am pretty sure how to code the loop later and anything but I am really lost because I don't know how to even start.

To keep it short: I am just looking for some hints on how to check if the content of the tuple corresponds to the keys.

Thank you so much for your help!

**edit: I am very sorry for the bad formatting. I think something got messed up.

nobody
  • 31
  • 4

0 Answers0