You are provided with the following pandas DataFrames with the following metadata:
Dataframe project changes between current and previous baseline schedule, progress change (dfs[0]), with 1 rows and 23 columns.
Description:
df = dfs[0]
project_start_date = df['Start Date'].iloc[0]
planned_start_date = df['Baseline Start Date'].iloc[0]
project_progress = df['Current Progress %'].iloc[0]
current_progress = df['Current Progress %'].iloc[0]
progress_change_or_progress_difference = df['Progress Change %'].iloc[0]
on_track = df['Progress Change %'] >= 0
weeks_behind_from_baseline = df['Weeks Behind'].iloc[0]
changes_from baseline_compare_with_baseline = df[[c for c in df.columns if 'Change' in c]]
This is the metadata of the dataframe dfs[0]:
index,Baseline Finish Date,Current Finish Date,End Date Change Days,Critical Path Size,Critical Path Size Change,Critical Path Duration Days,Critical Path Duration Change Days,Number of Delayed Activities,Number of Delayed Activities Change,Number of Delayed Milestones,Number of Delayed Milestones Change,Current Progress %,Baseline Progress %,Progress Change %,Weeks Behind,Performance Index,Current Schedule Compression,Baseline Schedule Compression,Schedule Compression Change,Progress Date,Baseline Start Date,Start Date,Project Delay Days
Dataframe WBS data (dfs[1]), with 393 rows and 9 columns.
Description:
change from baseline, compared with baseline
for wbs late means high 'Progress % Delay'
This is the metadata of the dataframe dfs[1]:
index,Name,Parent WBS,Progress %,Start Date,End Date,Duration Days,Change Type,Progress % Delay,Progress % Change
Dataframe activities and milestones progress, change and current delay, NOT why is delayed (dfs[2]), with 3795 rows and 16 columns.
Description:
change is measured from baseline
values for category columns
'Type': 'Milestone', 'Final Milestone', 'LOE'
'Completion Status': 'Finished', 'Ongoing', 'Planned'
'Change Type': 'added', 'modified', 'removed', 'unchanged'
df = dfs[2]
progress_of_new_activities = df.loc[df['Change Type']=='added', ['Code', 'Name', 'Progress %']]
activities_finished_last_month = df.loc[(df['Completion Status'] == 'Finished') & (df['End Date'] >= pd.Timestamp.now().normalize() - pd.DateOffset(months=1))]
next_milestone = df.loc[(df['Type']=='Milestone') & (df['Completion Status'] == 'Planned')].sort_values('Start Date').iloc[0][['Code','Name']]
delayed_activities = df.loc[df['Current Delay']>0, ['Code', 'Name', 'End Date Change Days']]
This is the metadata of the dataframe dfs[2]:
index,Code,Name,Type,Parent WBS,ACS,Completion Status,Progress %,Start Date,End Date,Duration Days,Change Type,Current Delay,Start Date Change Days,End Date Change Days,Duration Change Days,Total Float Days
Dataframe project health checks, DCMA-14 checks, Performance Index (dfs[3]), with 31 rows and 3 columns.
Description:
DCMA-14_checks = dfs[3].loc[dfs[3]['DCMA-14']=='Yes'].drop(columns=['DCMA-14'])
passing_health_checks = dfs[3].loc[dfs[3]['Fail %']==0]
failing_health_checks = dfs[3].loc[dfs[3]['Fail %']>0]
worry about failing health checks
This is the metadata of the dataframe dfs[3]:
index,Health Check,Fail %,DCMA-14
Dataframe health checks data for activities (dfs[4]), with 3793 rows and 27 columns.
Description:
df = dfs[4]
activities_failing_health_checks = df.loc[(df=="Yes").any(axis=1)]
activities_passing_health_checks = df.loc[(df=="No").any(axis=1)]
activities_failing_which_test = df.loc[(df=="Yes").any(axis=1)]
This is the metadata of the dataframe dfs[4]:
index,Code,Name,Missing logic,Leads,Lags,Relationship types,Hard constraints,High float,Negative float,High duration,Invalid dates,Resources,Missed tasks,Isolated networks,High min free float,Zero duration,Cycles,Obsolete,Out of sequence,Duplicate activity id,Critical activities,Open start,Open finish,As late as possible,Riding data date,Constraints not on milestones,High duration critical
Dataframe carbon emission in Kg of CO2 for project equipments and materials (dfs[5]), with 11 rows and 3 columns.
This is the metadata of the dataframe dfs[5]:
index,Source,Type,Amount in kg of CO2
Dataframe data for critical path to TARGET or driving path of TARGET (dfs[6]), with 3794 rows and 6 columns.
Description:
#
question: how many activities are in the critical path?, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[6]
df_project = df.loc[df['in_project_critical_path', ['Code', 'Name']]
return {'type': 'text', 'value': f'There are {len(df_project)} activities.'}
#
question: what's the critical path of the project?, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[6]
df_project = df.loc[df['in_project_critical_path', ['Code', 'Name']]
return {'type': 'dataframe', 'value': df_project}
#
question: is C40S1 part of the critical path, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[6]
MEMBER = 'C40S1'
df_in_critical_path = df.loc[df['in_project_critical_path'] & ((df['Code']==MEMBER) | (df['Name']==MEMBER))]
if df_in_critical_path.empty:
return {'type': 'text', 'value': f'{MEMBER} is not in the critical path.'}
else:
return {'type': 'text', 'value': f'{MEMBER} is in the critical path.'}
#
question: what's the critical path of activity C40S1, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[6]
TARGET = 'C40S1'
COLUMN = 'activities_in_critical_path'
df_target = df.loc[(df['Name']==TARGET) | (df['Code']==TARGET)]
if df_target.empty:
return {'type': 'text', 'value': f'{TARGET} not found.'}
else:
return {'type': 'text', 'value': df_target[COLUMN].iloc[0]}
#
question: how many activities are there on the critical path to C40S1, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[6]
TARGET = 'C40S1'
COLUMN = 'number_of_activities_in_critical_path'
df_target = df.loc[(df['Name']==TARGET) | (df['Code']==TARGET)]
if df_target.empty:
return {'type': 'text', 'value': f'{TARGET} not found.'}
else:
return {'type': 'text', 'value': df_target[COLUMN].iloc[0]}
This is the metadata of the dataframe dfs[6]:
index,index,Code,Name,activities_in_critical_path,number_of_activities_in_critical_path,in_project_critical_path
Dataframe data for why activity is delayed, what drove or caused current delay (dfs[7]), with 3720 rows and 4 columns.
Description:
#
question: why X010 is delayed?, answer:
def analyze_data(dfs: list[pd.DataFrame]) -> dict:
df = dfs[7]
ACTIVITY = 'X010'
df_activity = df.loc[(df["Name"]==ACTIVITY) | (df["Code"]==ACTIVITY)]
if df_activity.empty:
return {"type": "text", "value": f"{ACTIVITY} not found or missing delay analysis."}
else:
return {"type": "text", "value": df_activity["Why is Delayed"].iloc[0]}
question: what is the most delayed activity and why has it been delayed?, answer:
ACTIVITY = dfs[2].loc[dfs[2]['Current Delay'].idxmax(), 'Code'].iloc[0]
This is the metadata of the dataframe dfs[7]:
index,Code,Name,Current Delay,Why is Delayed
Dataframe data from QSRA analysis: delay risk, predicted delays, P1,..., P100 values for delay and end dates, at the level of activities, wbs and project (dfs[8]), with 1681 rows and 583 columns.
Description:
NOT for what is driving or impacting P1,...,P100 values
choose 'type' from 'Activity', 'WBS' or 'Project'
Do not format dates
df = dfs[8]
if len(df)==0:
return {'type': 'text', 'value': Please, run QSRA analysis to have access to risk data}
project_p80 = df.loc[df['type'] == 'Project'].iloc[0]['p80_date']
activities_with_delay_risk = df.loc[(df['type']=='Activity') & (df['p80_delay_days']>0), ['Code', 'Name', 'p80_delay_days']]
top_10_p50 = df.loc[df['type']=='Activity'].sort_values(by='p50_delay_days', ascending=False).head(10)['Code', 'Name', 'p50_delay_days']
This is the metadata of the dataframe dfs[8]:
Code Name type scheduled_start_date scheduled_end_date
min max probable distribution_type risk_events
p0_date p1_date ... p99_date p100_date
p0_delay_days p1_delay_days ... p99_delay_days p100_delay_days
probability_to_delay_up_to_1_days probability_to_delay_up_to_2_days ...
probability_to_delay_up_to_364_days probability_to_delay_up_to_365_days
where min max probable distribution_type are input duration uncertainty
Dataframe data for what risk is driving or impacting the P1,...,P100 values of the project or activity (dfs[9]), with 3794 rows and 5 columns.
Description:
input parameters from question:
KEY activity or project, to be found in either column 'Name' or 'Code' (NOT both)
POSITION take values P1,...,P100
DRIVERS take values 'All', 'uncertainty', or 'events'
COLUMN = f'what is driving risk_{POSITION}{DRIVERS}'
input examples:
what's driving the p80 of the project -> KEY='project', POSITION='P80', DRIVERS='All'
risk events impacting the P90 of the project -> KEY='project', POSITION='P90', DRIVERS='events'
what is driving the risk of X010? -> KEY='X010', POSITION='P80', DRIVERS='All'
what's driving the P20 of activity C20D1 -> KEY='C20D1', POSITION='P20', DRIVERS='All'
what duration uncertainty is driving the risk -> KEY='project', POSITION='P80', DRIVERS='uncertainty'
df = dfs[9]
df_key = df.loc[(df['Code']==KEY) | (df['Name']==KEY)]
if df_key.empty:
return {'type': 'text', 'value': f'{KEY} not found.'}
if COLUMN not in df.columns:
return {'type': 'text', 'value': f'Cannot find {COLUMN} for the {KEY}'}
return {'type': 'text', 'value': df_key[COLUMN].iloc[0]}
This is the metadata of the dataframe dfs[9]:
index,Name,Code,what is driving risk_P80_All_,what is driving risk_P80_events_,what is driving risk_P80_uncertainty_
Dataframe project progress from past to future dates, NOT for difference with or change from previous baseline (dfs[10]), with 2619 rows and 2 columns.
Description:
#
question: progress, answer:
def analyze_data(dfs: list[pd.DataFrame]) ->dict: