Update multiprocessing_in_date_ingestion.py
Browse files
multiprocessing_in_date_ingestion.py
CHANGED
|
@@ -77,12 +77,12 @@ def process_biomarker_detail(args):
|
|
| 77 |
for attribute in attributes:
|
| 78 |
attribute_details = attribute['attribute_details']
|
| 79 |
attribute['attribute_details'], logging_df = report_date_insertion(attribute_details, df_list, logging_df)
|
| 80 |
-
return biomarker_detail
|
| 81 |
|
| 82 |
def json_report_date_insertion(json_data, df_list, logging_df):
|
| 83 |
biomarker_details = json_data['patient_level']['biomarkers']['details']
|
| 84 |
with Pool() as pool:
|
| 85 |
-
|
|
|
|
| 86 |
json_data['patient_level']['biomarkers']['details'] = updated_biomarker_details
|
| 87 |
-
return json_data,
|
| 88 |
-
|
|
|
|
| 77 |
for attribute in attributes:
|
| 78 |
attribute_details = attribute['attribute_details']
|
| 79 |
attribute['attribute_details'], logging_df = report_date_insertion(attribute_details, df_list, logging_df)
|
| 80 |
+
return biomarker_detail, logging_df
|
| 81 |
|
| 82 |
def json_report_date_insertion(json_data, df_list, logging_df):
|
| 83 |
biomarker_details = json_data['patient_level']['biomarkers']['details']
|
| 84 |
with Pool() as pool:
|
| 85 |
+
results = pool.map(process_biomarker_detail, [(biomarker_detail, df_list, logging_df) for biomarker_detail in biomarker_details])
|
| 86 |
+
updated_biomarker_details, updated_logging_df = zip(*results)
|
| 87 |
json_data['patient_level']['biomarkers']['details'] = updated_biomarker_details
|
| 88 |
+
return json_data, updated_logging_df
|
|
|