Analyse both files and give a detailed output as seen in word file but without any error
~/
~/attachments/677603c2-95c7-4095-8af4-a20405672ddf
python3 - <<'PY' from docx import Document p='/tmp/workspace/attachments/677603c2-95c7-4095-8af4-a20405672ddf/MCH_Variables_Family_Adoption_Programme_Updated.docx' d=Document(p) print('PARAGRAPHS') for i,x in enumerate(d.paragraphs): if x.text.strip(): print(f'P{i} [{x.style.name}]: {x.text}') print('\nTABLES',len(d.tables)) for ti,t in enumerate(d.tables): print(f'--- TABLE {ti}: {len(t.rows)} rows x {len(t.columns)} cols ---') for r in t.rows: print(' | '.join(c.text.replace('\n',' / ') for c in r.cells)) PY
python3 - <<'PY' import openpyxl, json, os p='/tmp/workspace/attachments/677603c2-95c7-4095-8af4-a20405672ddf/FAP DATA SHEET 2023 BATCH-6.xlsx' wbv=openpyxl.load_workbook(p, data_only=False) print('SHEETS', wbv.sheetnames) for ws in wbv.worksheets: print('\nSHEET',ws.title,'dim',ws.max_row,ws.max_column) print('merged', [str(x) for x in list(ws.merged_cells.ranges)[:15]]) for row in ws.iter_rows(min_row=1,max_row=min(15,ws.max_row),values_only=False): print(' | '.join('' if c.value is None else str(c.value) for c in row[:min(25,ws.max_column)])) PY
Family Adoption Programme medical college guidelines India community health variables monitoring
python3 - <<'PY' import openpyxl, collections, json p='/tmp/workspace/attachments/677603c2-95c7-4095-8af4-a20405672ddf/FAP DATA SHEET 2023 BATCH-6.xlsx' wb=openpyxl.load_workbook(p,data_only=True) for ws in wb.worksheets: headers=[str(c.value).strip() if c.value is not None else '' for c in ws[1]] print('\n###',ws.title, 'cols',len(headers)) for i,h in enumerate(headers,1): print(i,repr(h)) print('Rows with Unique ID',sum(1 for r in range(2,ws.max_row+1) if ws.cell(r,3).value not in (None,''))) PY
python3 - <<'PY' import pandas as pd, numpy as np p='/tmp/workspace/attachments/677603c2-95c7-4095-8af4-a20405672ddf/FAP DATA SHEET 2023 BATCH-6.xlsx' for sheet in ['FAMILY DATA','INDIVIDUAL DATA']: d=pd.read_excel(p,sheet_name=sheet) d.columns=[str(c).strip() for c in d.columns] d['Unique ID']=d['Unique ID'].ffill() print('\n###',sheet,'raw',len(d),'IDs',d['Unique ID'].nunique(),'duplicates IDs',d['Unique ID'].duplicated().sum()) cols=(['Number of eligible couple','Pregnent women','Number of ANC','Gestational age(weeks)','TT dose','Taking IFA','Age of the mother','Type of delivery','Place of delivery','Number of births','Sex of baby','Post-natal visit','Birth weight'] if sheet=='FAMILY DATA' else ['Age','Gender','Marital status','Exclusive breast feeding','Breast fed upto','Growth Monitoring','Status']) for c in cols: print('\n',c,':') print(d[c].replace(r'^\s*$',np.nan,regex=True).value_counts(dropna=False).head(30).to_string()) PY
maternal child health India systematic review
python3 - <<'PY' import pandas as pd,numpy as np,re p='/tmp/workspace/attachments/677603c2-95c7-4095-8af4-a20405672ddf/FAP DATA SHEET 2023 BATCH-6.xlsx' f=pd.read_excel(p,sheet_name='FAMILY DATA'); f.columns=[str(c).strip() for c in f.columns] i=pd.read_excel(p,sheet_name='INDIVIDUAL DATA'); i.columns=[str(c).strip() for c in i.columns] def norm(x): if pd.isna(x): return None return str(x).strip().lower() for c in ['Family planing measures adopted','Type of planning method','Number of eligible couple','Pregnent women','TT dose','Taking IFA']: print('\n',c);print(f[c].map(norm).value_counts(dropna=False).to_string()) # family outome derived numeric date source print('\nANC validity'); print(f.loc[f['Pregnent women'].map(norm).eq('yes'), ['Unique ID','Number of ANC','Gestational age(weeks)','TT dose','Taking IFA','Age of the mother']].to_string(index=False)) # Birth rows print('\nBirth delivery');print(f.loc[f['Type of delivery'].notna(),['Unique ID','Type of delivery','Place of delivery','Birth weight','Age of the mother','Number of births','Post-natal visit']].to_string(index=False)) # indiv ages status normalized i['age_num']=pd.to_numeric(i['Age'],errors='coerce') print('\nIndiv n age valid',i.age_num.notna().sum(),'sex'); print(i['Gender'].map(norm).value_counts().to_string()) print('age <5 status'); print(i.loc[i.age_num<5,'Status'].map(norm).value_counts(dropna=False).to_string()) print('age <=5 status');print(i.loc[i.age_num<=5,'Status'].map(norm).value_counts(dropna=False).to_string()) # immunization status by age values a=i.loc[i['Status'].notna(),['age_num','Status']].copy();a['status']=a.Status.map(norm); print(a.groupby('status').age_num.agg(['count','min','max',lambda x:(x<5).sum()]).to_string()) # unique family data IDs rendering dup print('duplicate FAMILY UIDs', f[f['Unique ID'].duplicated(False)].loc[:,['Unique ID','House No.','Ward No.','Address (House name)']].to_string(index=False)) PY