In the exercice i´m developing bellow, i´m applying the chain of responsibility pattern. The pattern works correctly but i don´t think it's the best approach. I think the rule design pattern should be a better fit but there´s no much good examples about it using python.
My questions for you are:
The exercice is the following:
Supose you have Patients with health conditions such as:
In this exercice drugs are provided to all patients. It is not possible to target a specific patient. This is the list of available drugs:
Drugs can change patients’ states. They can cure, cause side effects or even kill a patient if not properly prescribed. Drugs effects are described by the following rules:
List of patients' health status codes, separated by a comma. e.g. “D,F,F” means we have 3 patients, one with diabetes and two with fever.
List of drugs codes, separated by a comma, e.g. “As,I” means patients will be treated with Aspirin and Insulin.
The result should be sent to stdout. It should be a comma separated string with number of patients with a given state, following the format: F:NP,H:NP,D:NP,T:NP,X:NP (NP:number of people)