merge denovix result and hemocube data

This commit is contained in:
Pritimay Sarkar
2023-09-07 18:04:46 +05:30
parent df114e5d8b
commit 58f3d7d9ef
4 changed files with 10 additions and 8 deletions

View File

@@ -17,3 +17,6 @@ Repo for all data related work.
https://asia-south1-hpos-af3cc.cloudfunctions.net/registerUser https://asia-south1-hpos-af3cc.cloudfunctions.net/registerUser
### deploy specific function
firebase deploy --only functions:consolidation

View File

@@ -3,8 +3,8 @@ import os
curdir = os.getcwd() curdir = os.getcwd()
path_delim = '/' path_delim = '/'
df1 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet1") df1 = pd.read_excel(curdir + path_delim + "data/6septemberGMC-classified.xlsx", sheet_name="Sheet2")
df2 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet3") df2 = pd.read_excel(curdir + path_delim + "data/6septemberGMC-classified.xlsx", sheet_name="Sheet3")
# df4 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet4") # df4 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet4")
df = df1.merge(df2, on="_id") df = df1.merge(df2, on="_id")
@@ -12,15 +12,15 @@ df = df1.merge(df2, on="_id")
df['Age'] = 2023 - df['birthYear'] df['Age'] = 2023 - df['birthYear']
print(df) print(df)
df = df[["_id", "name", "abhaId", "aadharId", "Age", "gender", "category", "maritalStatus", "house", "district", "state", "pinCode", "phoneNumber", "Test Result", "bloodGroup"]] df = df[["_id", "name", "abhaId", "aadharId", "Age", "gender", "category", "maritalStatus", "house", "district", "state", "pinCode", "phoneNumber", "Classification", "bloodGroup"]]
print(df) print(df)
# df = df.sort_values(by=['testTime'], ascending=True) # df = df.sort_values(by=['testTime'], ascending=True)
df.rename(columns={'_id': "Sample ID", "name": "Name", "abhaId": "ABHA ID", "aadharId": "Aadhaar ID", "gender": "Gender", "category": "Category", "maritalStatus": "Marital Status", "house": "Address", "district": "District", "state": "State", "pinCode": "Pincode", "phoneNumber": "Mobile Number", "Result": "Test Result", "bloodGroup": "Blood Group"}, inplace = True) df.rename(columns={'_id': "Sample ID", "name": "Name", "abhaId": "ABHA ID", "aadharId": "Aadhaar ID", "gender": "Gender", "category": "Category", "maritalStatus": "Marital Status", "house": "Address", "district": "District", "state": "State", "pinCode": "Pincode", "phoneNumber": "Mobile Number", "Classification": "Test Result", "bloodGroup": "Blood Group"}, inplace = True)
df = df.reindex(["Sample ID", "Name", "ABHA ID", "Aadhaar ID", "Age", "Gender", "Category", "Marital Status", "Address", "District", "State", "Pincode", "Mobile Number", "Test Result", "Blood Group"], axis=1) df = df.reindex(["Sample ID", "Name", "ABHA ID", "Aadhaar ID", "Age", "Gender", "Category", "Marital Status", "Address", "District", "State", "Pincode", "Mobile Number", "Test Result", "Blood Group"], axis=1)
print(df) print(df)
writer = pd.ExcelWriter(curdir + path_delim + "homecare-center-03sep-final-result.xlsx", engine = 'openpyxl') writer = pd.ExcelWriter(curdir + path_delim + "data/6septemberGMC - classified-combined.xlsx", engine = 'openpyxl')
df.to_excel(writer, sheet_name = 'op', index=False) df.to_excel(writer, sheet_name = 'op', index=False)
writer.close() writer.close()

View File

@@ -10,7 +10,7 @@ import os
# Initialize Firebase Admin SDK # Initialize Firebase Admin SDK
# cred = credentials.Certificate(r'C:\Users\smila\PycharmProjects\pythonProject\hpos-af3cc-firebase-adminsdk-n261k-2bfd463ec0.json') # Replace with your own service account key path # cred = credentials.Certificate(r'C:\Users\smila\PycharmProjects\pythonProject\hpos-af3cc-firebase-adminsdk-n261k-2bfd463ec0.json') # Replace with your own service account key path
cred = credentials.Certificate(os.getcwd() + '/' + 'keys/hpos-prod-firebase-adminsdk-bionp-7af43fc5d6.json') # Replace with your own service account key path cred = credentials.Certificate(os.getcwd() + '/' + 'keys/hpos-prod-firebase-adminsdk-bionp-3c041b2300.json') # Replace with your own service account key path
firebase_admin.initialize_app(cred) firebase_admin.initialize_app(cred)
# Get a reference to the Firestore database # Get a reference to the Firestore database

View File

@@ -9,7 +9,7 @@ import sys
# Initialize Firebase Admin SDK # Initialize Firebase Admin SDK
# cred = credentials.Certificate(r'C:\Users\smila\PycharmProjects\pythonProject\hpos-af3cc-firebase-adminsdk-n261k-2bfd463ec0.json') # Replace with your own service account key path # cred = credentials.Certificate(r'C:\Users\smila\PycharmProjects\pythonProject\hpos-af3cc-firebase-adminsdk-n261k-2bfd463ec0.json') # Replace with your own service account key path
cred = credentials.Certificate(r'/Users/apple/Downloads/work/pythonProject-master/hpos-prod-firebase-adminsdk-bionp-3c041b2300.json') # Replace with your own service account key path cred = credentials.Certificate(os.getcwd() + '/keys/hpos-prod-firebase-adminsdk-bionp-3c041b2300.json') # Replace with your own service account key path
firebase_admin.initialize_app(cred) firebase_admin.initialize_app(cred)
# Get a reference to the Firestore database # Get a reference to the Firestore database
@@ -27,7 +27,6 @@ patient_docs = query.stream()
# Prepare data to store in CSV # Prepare data to store in CSV
data = [] data = []
for patient_doc in patient_docs: for patient_doc in patient_docs:
print(patient_doc)
patient_data = patient_doc.to_dict() patient_data = patient_doc.to_dict()
# patient_id = patient_data["_id"] # patient_id = patient_data["_id"]