From 58f3d7d9ef970a207e0e1bca3ab3e7b23293bcd4 Mon Sep 17 00:00:00 2001 From: Pritimay Sarkar Date: Thu, 7 Sep 2023 18:04:46 +0530 Subject: [PATCH] merge denovix result and hemocube data --- README.md | 3 +++ scripts/combine_hemocube_denovix.py | 10 +++++----- scripts/test_collection.py | 2 +- scripts/user_collection.py | 3 +-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fc252ca..c60c749 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,6 @@ Repo for all data related work. https://asia-south1-hpos-af3cc.cloudfunctions.net/registerUser +### deploy specific function + + firebase deploy --only functions:consolidation \ No newline at end of file diff --git a/scripts/combine_hemocube_denovix.py b/scripts/combine_hemocube_denovix.py index e67d5e8..f7c1e64 100644 --- a/scripts/combine_hemocube_denovix.py +++ b/scripts/combine_hemocube_denovix.py @@ -3,8 +3,8 @@ import os curdir = os.getcwd() path_delim = '/' -df1 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet1") -df2 = pd.read_excel(curdir + path_delim + "homecare-center-03sep-final.xlsx", sheet_name="Sheet3") +df1 = pd.read_excel(curdir + path_delim + "data/6septemberGMC-classified.xlsx", sheet_name="Sheet2") +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") df = df1.merge(df2, on="_id") @@ -12,15 +12,15 @@ df = df1.merge(df2, on="_id") df['Age'] = 2023 - df['birthYear'] 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) # 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) 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) writer.close() \ No newline at end of file diff --git a/scripts/test_collection.py b/scripts/test_collection.py index 6354ca5..7cac5cc 100644 --- a/scripts/test_collection.py +++ b/scripts/test_collection.py @@ -10,7 +10,7 @@ import os # 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(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) # Get a reference to the Firestore database diff --git a/scripts/user_collection.py b/scripts/user_collection.py index 9702bc9..4d054f2 100644 --- a/scripts/user_collection.py +++ b/scripts/user_collection.py @@ -9,7 +9,7 @@ import sys # 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'/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) # Get a reference to the Firestore database @@ -27,7 +27,6 @@ patient_docs = query.stream() # Prepare data to store in CSV data = [] for patient_doc in patient_docs: - print(patient_doc) patient_data = patient_doc.to_dict() # patient_id = patient_data["_id"]