diff --git a/scripts/allow_retest_backdated.py b/scripts/allow_retest_backdated.py index f9e649d..359d59b 100644 --- a/scripts/allow_retest_backdated.py +++ b/scripts/allow_retest_backdated.py @@ -17,7 +17,7 @@ db = firestore.client() patient_collection = db.collection("patientData") test_collection = db.collection("testData") -query = patient_collection.where(filter=FieldFilter("createdAt", ">=", "2023-12-13")).where(filter=FieldFilter("createdAt", "<", "2023-12-14")) +query = patient_collection.where(filter=FieldFilter("createdAt", ">=", "2023-12-27")).where(filter=FieldFilter("createdAt", "<", "2023-12-28")) #.where(filter=FieldFilter("registrationCenterName", "==", "SCS high school")) patient_docs = query.stream() @@ -27,12 +27,12 @@ data = [] for patient_doc in patient_docs: patient_data = patient_doc.to_dict() data.append(patient_data) - if "sar" in patient_data['_id']: + if "HIN" in patient_data['_id']: print(patient_data['_id']) doc_ref = db.collection("patientData").document(patient_doc.id) delete_field_name = 'incubationTime' - batch.update(doc_ref, {"_idSearch": '20231214' + patient_data['_id'], delete_field_name: firestore.DELETE_FIELD, "allowFreshTest": True, "testStatus": False}) + batch.update(doc_ref, {"_idSearch": '20231228' + patient_data['_id'], delete_field_name: firestore.DELETE_FIELD, "allowFreshTest": True, "testStatus": False}) batch.commit() diff --git a/scripts/allow_retest_backdated_ids.py b/scripts/allow_retest_backdated_ids.py index 9b910ed..0798b81 100644 --- a/scripts/allow_retest_backdated_ids.py +++ b/scripts/allow_retest_backdated_ids.py @@ -19,7 +19,7 @@ test_collection = db.collection("testData") query = patient_collection.where(filter = FieldFilter("_id", "in", [ - 'xyx','xyz' + '957539044830HEMSAN','336694457928TRUSAN','952345130951PRIKES','867067867252SAMKES','833204928565KHUKES','621177486591TANKES','644852777735SAKKES','962439786909TANKES','735707478715MANKES','200338449939SIMKES','687100580009VAIKES','285966149202RUSKES','967578334682RAKKES','921021476789PIYKES' ])) #.where(filter=FieldFilter("registrationCenterName", "==", "SCS high school")) patient_docs = query.stream() @@ -35,10 +35,10 @@ for patient_doc in patient_docs: delete_field_name = 'incubationTime' - # batch.update(doc_ref, { - # "_idSearch": '20231209' + patient_data['_id'], - # # delete_field_name: firestore.DELETE_FIELD, - # "allowFreshTest": True, - # "testStatus": False}) + batch.update(doc_ref, { + "_idSearch": '20231221' + patient_data['_id'], + delete_field_name: firestore.DELETE_FIELD, + "allowFreshTest": True, + "testStatus": False}) batch.commit() diff --git a/scripts/create_user.sh b/scripts/create_user.sh index 50184bd..de215b8 100644 --- a/scripts/create_user.sh +++ b/scripts/create_user.sh @@ -1,5 +1,5 @@ -curl --location --request POST 'https://asia-south1-hpos-qa.cloudfunctions.net/registerUser' --header 'Content-Type: application/json' --header 'x-client: e16a1bd15af2ee640f5a7a18c8d8333f5f01f7c66e003bbc21ee52870f1bce27' --data-raw '{ - "_id": "202311180000SMIBLR", +curl --location --request POST 'https://asia-south1-hpos-af3cc.cloudfunctions.net/registerUser' --header 'Content-Type: application/json' --header 'x-client: e16a1bd15af2ee640f5a7a18c8d8333f5f01f7c66e003bbc21ee52870f1bce27' --data-raw '{ + "_id": "202401030005SMIBLR", "aadharId": "876795956467", "abhaId": "12434949797979", "birthYear": "2000", diff --git a/scripts/open_incubation.py b/scripts/open_incubation.py index 90081b4..71887ac 100644 --- a/scripts/open_incubation.py +++ b/scripts/open_incubation.py @@ -4,12 +4,12 @@ import os from google.cloud.firestore_v1.base_query import FieldFilter from datetime import datetime, timedelta -key_path = os.getcwd() + '/keys/hpos-prod-firebase-adminsdk.json' +key_path = os.getcwd() + '/keys/hpos-af3cc-firebase-adminsdk.json' cred = credentials.Certificate(key_path) firebase_admin.initialize_app(cred) def update_incubation(source_collection): db = firestore.client() - docs = db.collection(source_collection).where(filter = FieldFilter("_id", "in", ['798951069466PRABMB','450645088078SUJBHI'])).stream() + docs = db.collection(source_collection).where(filter = FieldFilter("_id", "in", ['202401030005SMIBLR'])).stream() for doc in docs: doc_id = doc.id #doc.to_dict()["_id"] diff --git a/scripts/parse_retest_pdf.py b/scripts/parse_retest_pdf.py new file mode 100644 index 0000000..5217997 --- /dev/null +++ b/scripts/parse_retest_pdf.py @@ -0,0 +1,68 @@ +s = """1 +276199643589NISKES +Nisha Ramesh Karsarpe +O+ve +2 +652355228200CHAKES +Chanda Thakare +A+ve +3 +952345130951PRIKES +Priya Premdas Devgune +O+ve +4 +867067867252SAMKES +Samiksha Dilip Apurkar +A+ve +5 +833204928565KHUKES +Khushi Rajahans Pantawne +A+ve +6 +621177486591TANKES +Tanuja Chandrashekhar Amgaonk +aOr+ve +7 +644852777735SAKKES +Sakshi Hemraj Khadase +AB+ve +8 +962439786909TANKES +Tanushree Pralad Khandarkar +O+ve +9 +735707478715MANKES +Manisha Ramesh Jangale +A+ve +10 +200338449939SIMKES +Simran Vijay Mahajan +A+ve +11 +687100580009VAIKES +Vaishnavi Prabhakar Sontakke +B+ve +12 +285966149202RUSKES +Rushi Dilip Sonkusare +B+ve +13 +967578334682RAKKES +Rakesh Rajesh Patil +A+ve +14 +921021476789PIYKES +Piyush Duryodhan Thakre +B+ve +""" + +ids = s.split('\n') +# print(ids) + +selected_lines = [ids[i] for i in range(1, len(ids), 4)] + +result = "" + +for line in selected_lines: + # if 'SAN' in line: + print(line) \ No newline at end of file diff --git a/scripts/plot_led_adc.py b/scripts/plot_led_adc.py new file mode 100644 index 0000000..db89409 --- /dev/null +++ b/scripts/plot_led_adc.py @@ -0,0 +1,20 @@ +import pandas as pd +import matplotlib.pyplot as plt + +df = pd.read_excel("data_dev7_6.xlsx", sheet_name="removed") + +# print(df) + +print(df.describe()) + +# Plot all lines on the same graph +# df["led1Buffer"].plot(label="LED 1") +# df["led2Buffer"].plot(label="LED 2") +df["led3Buffer"].plot(label="LED 3") +# df["led4Buffer"].plot(label="LED 4") + +# Add legend to the plot +plt.legend() + +# Display the plot +plt.show() diff --git a/scripts/test_collection.py b/scripts/test_collection.py index 642e391..95152dd 100644 --- a/scripts/test_collection.py +++ b/scripts/test_collection.py @@ -30,12 +30,11 @@ df = pd.DataFrame(data) print(df) print(df.size) -# 4 abs -#df = df[["_id", "batteryLevel", "batteryVoltage", "classificationResult", "prdClassification", "predictedDenovixRatio", "calculatedRatio", "deviceRatio", "kitSerial", "abs1", "led1Average", "led1Buffer", "led1Sample", "abs2", "led2Average", "led2Buffer", "led2Sample", "abs3", "led3Average", "led3Buffer", "led3Sample", "abs4", "led4Average", "led4Buffer", "led4Sample", "deviceId", "deviceSerialNumber", "name", "testTime"]] -# 2 abs -#df = df[["_id", "finalResult", "classificationResult", "calculatedRatio", "deviceRatio", "kitSerial", "led1Average", "led1Buffer", "led1Sample", "led2Average", "led2Buffer", "led2Sample", "deviceId", "deviceSerialNumber", "name", "testTime"]] -df = df[["_id", "classificationResult", "calculatedRatio", "deviceRatio", "kitSerial", "led1Average", "led1Buffer", "led1Sample", "led2Average", "led2Buffer", "led2Sample", "deviceId", "deviceSerialNumber", "name", "testTime"]] +column_names = ["_id", "name", "classificationResult", "prdClassification", "slopeRatioClass", "predictedDenovixRatio", "slopeRatio", "calculatedRatio", "deviceRatio", "kitSerial", "led1Gain1", "led1Gain2", "led1Gain4", "abs1", "led1Average", "led1Buffer", "led1Sample", "led2Gain1", "led2Gain2", "led2Gain4", "abs2", "led2Average", "led2Buffer", "led2Sample", "led3Gain1", "led3Gain2", "led3Gain4", "hb3", "abs3", "led3Average", "led3Buffer", "led3Sample", "led4Gain1", "led4Gain2", "led4Gain4", "hb4", "abs4", "led4Average", "led4Average", "led4Buffer", "led4Sample", "batteryLevel", "batteryVoltage", "deviceId", "deviceSerialNumber", "appVersion", "testTime"] +common_columns = [col for col in column_names if col in df.columns] +df = df[common_columns] + print("duplicates", len(df['_id']) - len(df['_id'].drop_duplicates())) @@ -63,7 +62,8 @@ downloads_dir = os.path.join(os.path.expanduser("~"), "Downloads") output_path = os.path.join(downloads_dir, output_filename) writer = pd.ExcelWriter(output_path, engine = 'openpyxl') df.to_excel(writer, sheet_name = 'data', index=False) -df_count.to_excel(writer, sheet_name = "count") +df_count.to_excel(writer, sheet_name = "hc_count") +df.groupby(["result"]).describe()["resultRatio"]["count"].to_excel(writer, sheet_name = "tr_count") df.groupby(["deviceId"]).describe().to_excel(writer, sheet_name = "stats") df.groupby(["kitSerial"]).describe()["calculatedRatio"]["count"].to_excel(writer, sheet_name = "kit_count") df.groupby(["kitSerial", "classificationResult"]).describe()["calculatedRatio"]["count"].to_excel(writer, sheet_name = "kit_class")