Merck / Line-of-Therapy-Algorithm

This is the Line of Therapy Algorithm, as described in the paper "Temporal phenotyping by mining healthcare data to derive lines of therapy for cancer" pending submission in the Journal of Biomedical Informatics.
GNU General Public License v3.0
26 stars 16 forks source link

switch maintenance drugs #3

Open jwu19 opened 5 months ago

jwu19 commented 5 months ago

according to the definition of switch maintenence drug in rwToT_LoT_functions.py

def is_eligible_switch_maintenance(regimen, cases_maintenance, line_number): regimen = [x.upper() for x in regimen]
cases_maintenance = pd.DataFrame(data = cases_maintenance) cases_maintenance = cases_maintenance[cases_maintenance['maintenance_type'] == 'SWITCH'] return all(drug in regimen for drug in cases_maintenance['drug_name']) and (line_number == 1)

My understand to the above code is that to define it as a switch maintenance drug, all the switch maintenenance drugs in the cases_maintenance.csv must be in the regimen of the current line and the line number must be 1. If I understand it correctly, this function can never return True when there are more than one switch maintenance drug in cases_maintenance.csv.

Weilin37 commented 5 months ago

That is probably correct. This algorithm was developed some time ago around NSCLC where we assumed maintenance drugs only happened after the first line of treatment. I think this was the standard at the time.

I am happy to merge code that allows for flexibility for all the lines. Perhaps you can open up a branch and make a pull request once you're done?

jwu19 commented 5 months ago

Thank you for your reply. To understand switch maintenance drug better, I used an example in NSCLC as below

patient_id = 4444 takes two drugs, pembrolizumab and pemetrexed(listed as switch maintenance drug in the cases_maintenance.csv). pembrolizumab started on 1/1/2020 and ended on 2/1/2020. Then he started pemetrexed on 3/2/2020 and ended on 5/8/2020.

So, both drugs are in L1, and IS_MAINTENANCE flag for pemetrexed is True for pembrolizumab is False. Not sure if it is correct or not?