adapted report files
parent
f21a32791a
commit
27fc4e4f34
|
|
@ -133,3 +133,5 @@ dmypy.json
|
||||||
crash.log
|
crash.log
|
||||||
*.tfvars
|
*.tfvars
|
||||||
|
|
||||||
|
#excel reports
|
||||||
|
*.xlsx
|
||||||
|
|
@ -90,7 +90,8 @@
|
||||||
try {
|
try {
|
||||||
emailext subject: env.JOB_NAME,
|
emailext subject: env.JOB_NAME,
|
||||||
body: 'Please find the output of the weekly QM-Report attached',
|
body: 'Please find the output of the weekly QM-Report attached',
|
||||||
to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
|
to: 'rene.forstner@nttdata.com',
|
||||||
|
//to: 'rene.forstner@nttdata.com, stephan.oertelt@bmw.de, Mohammed.Abadel@bmw.de, OOC-Support@bmwgroup.com, Sonja.Yildizoglu@bmw.de, Andreas.DA.Danzer@partner.bmw.de',
|
||||||
replyTo: 'coco-apm@bmw.de',
|
replyTo: 'coco-apm@bmw.de',
|
||||||
attachmentsPattern: '*.xlsx'
|
attachmentsPattern: '*.xlsx'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,6 +173,9 @@ def main():
|
||||||
with open('./environment.yaml') as file:
|
with open('./environment.yaml') as file:
|
||||||
doc = yaml.safe_load(file)
|
doc = yaml.safe_load(file)
|
||||||
|
|
||||||
|
dailyall = pd.DataFrame()
|
||||||
|
totalall = pd.DataFrame()
|
||||||
|
|
||||||
for item, doc in doc.items():
|
for item, doc in doc.items():
|
||||||
token = dict(doc[2])
|
token = dict(doc[2])
|
||||||
url = dict(doc[1])
|
url = dict(doc[1])
|
||||||
|
|
@ -189,36 +192,44 @@ def main():
|
||||||
for index, row in days.iterrows():
|
for index, row in days.iterrows():
|
||||||
temp_df = getSLO(DTTOKEN,DTURL,row['startTime'],row['endTime'])
|
temp_df = getSLO(DTTOKEN,DTURL,row['startTime'],row['endTime'])
|
||||||
temp_df['Date'] = row['Date']
|
temp_df['Date'] = row['Date']
|
||||||
|
temp_df['HUB'] = item
|
||||||
df = pd.concat([df,temp_df],ignore_index=True)
|
df = pd.concat([df,temp_df],ignore_index=True)
|
||||||
|
|
||||||
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
|
#sort columns in a try block - if API is returning columns which are non exist, this will not fail the script
|
||||||
|
|
||||||
|
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
|
||||||
try:
|
try:
|
||||||
df = df[['Date', 'id', 'enabled', 'name', 'description', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
df = df[['Date', 'HUB', 'id', 'enabled', 'name', 'description', 'Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not rearrange columns: " + str(e))
|
print("Could not rearrange columns: " + str(e))
|
||||||
|
dailyall = pd.concat([dailyall,df],ignore_index=True)
|
||||||
|
|
||||||
writer = pd.ExcelWriter("./"+ item +'_daily.xlsx')
|
|
||||||
df.to_excel(writer, sheet_name=str(item).split(" ")[0])
|
|
||||||
writer.save()
|
|
||||||
|
|
||||||
|
|
||||||
###Calc Overall SLO
|
###Calc Overall SLO
|
||||||
df = getSLO(DTTOKEN,DTURL,days['startTime'].min(),days['endTime'].max())
|
df = getSLO(DTTOKEN,DTURL,days['startTime'].min(),days['endTime'].max())
|
||||||
df['StartDate'] = fromDate
|
df['CW'] = fromDate.isocalendar()[1]
|
||||||
df['EndDate'] = toDate
|
df['HUB'] = item
|
||||||
|
df[['description','Touchpoint']] = df['description'].str.split('_',expand=True)
|
||||||
try:
|
try:
|
||||||
df = df[['StartDate', 'EndDate', 'id', 'enabled', 'name', 'description', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
df = df[['CW', 'HUB', 'id', 'enabled', 'name', 'description','Touchpoint', 'evaluatedPercentage', 'errorBudget', 'status', 'error', 'target','warning', 'evaluationType', 'timeframe', 'metricExpression', 'filter']]
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("Could not rearrange columns: " + str(e))
|
print("Could not rearrange columns: " + str(e))
|
||||||
|
|
||||||
writer = pd.ExcelWriter("./"+ item +'_total.xlsx')
|
totalall = pd.concat([totalall,df],ignore_index=True)
|
||||||
df.to_excel(writer, sheet_name=str(item).split(" ")[0])
|
|
||||||
writer.save()
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("token not found, skipping " + item)
|
print("token not found, skipping " + item)
|
||||||
|
|
||||||
|
touchpoints = ['Vehicle' , 'Mobile']
|
||||||
|
dailyall = dailyall[dailyall['Touchpoint'].isin(touchpoints)]
|
||||||
|
totalall = totalall[totalall['Touchpoint'].isin(touchpoints)]
|
||||||
|
|
||||||
|
writer = pd.ExcelWriter("./QM_Report.xlsx")
|
||||||
|
totalall.to_excel(writer, sheet_name='total')
|
||||||
|
dailyall.to_excel(writer, sheet_name='daily')
|
||||||
|
writer.save()
|
||||||
|
writer.close()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Loading…
Reference in New Issue