@deleted-U07EH86AAN9 hey man I haven't been able to get to it with my family. Here is the previous code we got to work and a copy of a previous version. Take the outputted data dictionary and have it use the input_xl formula to iterate and input into each proper cell. Take a crack at it in the morning, I will join in when I can in the morning.
also make sure you are running on the updated info as of Monday which I believe is what Edward gave you and we overwrote
still working on it. Edward gets in around 8 so I will touch base with him when he is in.
stage = "First 30 Days" print(stage) stagedf = casedf.copy()
for col, values in cols.items():
if col in date_col_list:
base_date = ref_date - pd.Timedelta(days=values[0])
print(f"Stage: {stage} base date is {base_date}")
stage_df = stage_df[stage_df[col] >= base_date]
else:
stage_df = stage_df[stage_df[col].isin(values)]
results_count = len(stage_df)
print(results_count)
stage_results[f"{stage}"] = {"stage_count": results_count, "stage_data": stage_df}
case_df = get_merged_case(stage_df, case_df)
stage = "No ID No Contact Post 30 Days"
print(stage)
stage_df = case_df.copy()
for col, values in cols.items():
if col in date_col_list:
base_date = ref_date - pd.Timedelta(days=values[0])
base_120_date = ref_date - pd.Timedelta(days=120)
print(f"Stage: {stage} base date is {base_date}")
stage_df = stage_df[(stage_df[col] <= base_date) & (stage_df[col] >= base_120_date)]
else:
stage_df = stage_df[stage_df[col].isin(values)]
results_count = len(stage_df)
print(results_count)
stage_results[f"{stage}"] = {"stage_count": results_count, "stage_data": stage_df}
stage = "No ID No Contact Post 120 Days"
print(stage)
stage_df = case_df.copy()
for col, values in cols.items():
if col in date_col_list:
base_date = ref_date - pd.Timedelta(days=values[0])
print(f"Stage: {stage} base date is {base_date}")
stage_df = stage_df[stage_df[col] <= base_date]
else:
stage_df = stage_df[stage_df[col].isin(values)]
results_count = len(stage_df)
print(results_count)
stage_results[f"{stage}"] = {"stage_count": results_count, "stage_data": stage_df}
noticed we didn't finish the other stages. I added some adjustments to these.
let me know if youre able to get it working. I will be in as soon as I can
running into a date time object issue when comparing the base date to ref date, think i fixed the bug, about to re run the code again
Cam and Flatirons are blowing me up. See if Dustin can help I’m on my way
going to go through with this with dustin in a sec