create a code on python that will sort out patients into setsWatch this thread
I am trying to create a code on python that will allow me to sort my list of information into sets. For example I have 3 patient. Patient x has treatment 1,2,3 patient y has treatment 3 and 4 and patient z has treatment 1 and 2. I want to code it so that my output is the list of patients that need treatment 1, list of patients that need treatment 2, list of patients that need treatment 3 and list of patients that need treatment 4.
I have a list of patient treatment plans and I am trying to group the patients to what procedures the patients need.
There are 7 procedures so there will be 7 groups, p1, p2,p3,p4,p5,p6,p7
the treatment plans will look like
just an example,
I want to group these such that my output will be
Does that make more sense?
Heres a sc of the example treatment plan I have so the Direct Restoration is p1, Complex Perio is p2, prevention is p3,
patientA = ['p1', 'p3', 'p4']
procOne =  procTwo =  ect......
def sortPatients(patientArray): if 'p1' in patientArray: procOne.Append(patientA) if 'p2' in patientArray: procTwo.Append(patientA) // And so on and on.....