Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flows/Load_DICOM_Vocab.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
"id": "13660611-484f-48ab-80fb-ba90dc8b68aa",
"data": {
"name": "TransformConceptRelationshipDf",
"description": "Describe the task of node python_node_1",
"description": "Transform concept relationship vocabulary data into the OMOP-compatible column structure.",
"python_code": "import pickle\nimport numpy as np\n\nfrom pathlib import Path\nfrom typing import Any, Dict\n\ndef exec(myinput: Dict[str, Any]) -> pd.DataFrame:\n \"\"\"\n Combine multiple DICOM concept relationship dataframes into a single staging dataframe.\n \n This function processes three sources of DICOM data:\n 1. Cs_values_maps_to_value (Code String values mapped to values)\n 2. Cs_values_maps_to (Code String values mappings)\n 3. Part3_to_part16_relationship_via_CID (from pickle file in storage)\n \n The function downloads a pickle file containing concept relationships, converts\n date columns to datetime format, assigns default date ranges to the other datasets,\n and combines all three into a single dataframe.\n \n Args:\n myinput: Dictionary containing workflow data with the following expected keys:\n - \"UploadAttributes-CodeStringValues\": Result containing cs_values_maps_to_value DataFrame\n - \"UploadCs_values_maps_to\": Result containing cs_values_maps_to DataFrame\n - \"UploadAttributes-CID-ValueSets\": Result containing node_id and filename for pickle file\n \n Returns:\n pd.DataFrame: Combined dataframe with all concept relationships, including properly\n formatted valid_start_date and valid_end_date columns.\n \"\"\"\n cs_values_maps_to_value_df: pd.DataFrame = myinput.get(\"UploadAttributes-CodeStringValues\").result\n cs_values_maps_to_df: pd.DataFrame = myinput.get(\"UploadCs_values_maps_to\").result\n \n node_id: str = myinput.get(\"UploadAttributes-CID-ValueSets\").result.get(\"node_id\")\n filename: str = myinput.get(\"UploadAttributes-CID-ValueSets\").result.get(\"filename\")\n \n # Download the pickle file from remote storage\n download_file_from_storage(node_id, filename)\n\n filepath: Path = Path(DOWNLOADS_DIR) / filename\n\n concept_relationship_staging: pd.DataFrame = pd.read_pickle(filepath)\n\n # Convert date columns from integer (YYYYMMDD) to datetime using vectorized operations\n concept_relationship_staging['valid_start_date'] = pd.to_datetime(\n concept_relationship_staging['valid_start_date'], \n format='%Y%m%d', \n errors='coerce'\n )\n\n concept_relationship_staging['valid_end_date'] = pd.to_datetime(\n concept_relationship_staging['valid_end_date'], \n format='%Y%m%d', \n errors='coerce'\n )\n\n # Assign constant dates to all rows (vectorized - no loops needed)\n cs_values_maps_to_value_df['valid_start_date'] = pd.to_datetime('1993-01-01')\n cs_values_maps_to_value_df['valid_end_date'] = pd.to_datetime('2099-12-31')\n\n cs_values_maps_to_df['valid_start_date'] = pd.to_datetime('1993-01-01')\n cs_values_maps_to_df['valid_end_date'] = pd.to_datetime('2099-12-31')\n\n # Combine the three dataframes into one\n combined_df: pd.DataFrame = pd.concat([concept_relationship_staging, cs_values_maps_to_value_df, cs_values_maps_to_df], ignore_index=True)\n\n return combined_df\n\n\ndef download_file_from_storage(node_id: str, filename: str) -> Path:\n \"\"\"\n Download a file from Supabase storage to the downloads directory.\n \n Args:\n node_id: The storage node identifier where the file is located.\n filename: The name of the file to download.\n \n Returns:\n Path: The path to the downloaded file.\n \"\"\"\n storage_api = SupabaseStorageAPI()\n return storage_api.download_file_to_path(node_id, filename, Path(DOWNLOADS_DIR))"
},
"type": "python_node",
Expand Down
2 changes: 1 addition & 1 deletion flows/artemis.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"positionAbsolute": { "x": -420, "y": 80 },
"data": {
"name": "README",
"description": "Describe the ARTEMIS flow and supported conditions.",
"description": "Explain the ARTEMIS flow, its configurable inputs, and supported conditions.",
"python_code": "def exec(myinput):\n \"\"\"\n ARTEMIS provides an interface for utilizing a modified Temporal Smith-Waterman (TSW) algorithm \n that is capable of analysing conditions in the following list\n [1] \"ER Breast cancer\" \n [2] \"Prostate cancer\" \n [3] \"undefined\" \n [4] \"Mantle cell lymphoma\" \n [5] \"Acute myeloid leukemia\" \n [6] \"KRAS Colorectal cancer\" \n [7] \"Non-small cell lung cancer\" \n [8] \"Non-small cell lung cancer squamous\" \n [9] \"Kaposi sarcoma\" \n [10] \"Acute promyelocytic leukemia\" \n [11] \"Immune thrombocytopenia\" \n [12] \"Acute myeloid leukemia pediatric\" \n [13] \"Castleman disease\" \n [14] \"Endometrial cancer\" \n [15] \"Myelodysplastic syndrome\" \n [16] \"Hepatocellular carcinoma\" \n [17] \"Thyroid cancer differentiated\" \n [18] \"Chronic myeloid leukemia\" \n [19] \"T-cell acute lymphoblastic leukemia pediatric\" \n [20] \"Extranodal NK- and T-cell lymphoma nasal type\" \n [21] \"Antiphospholipid antibody syndrome\" \n [22] \"Venous thromboembolism\" \n [23] \"Systemic mastocytosis\" \n [24] \"Clear cell renal cell carcinoma\" \n [25] \"Thyroid cancer medullary\" \n [26] \"IDH Acute myeloid leukemia\" \n [27] \"Graft versus host disease\" \n [28] \"VHL Renal cell carcinoma\" \n [29] \"Chronic lymphocytic leukemia\" \n [30] \"Transformed lymphoma\" \n [31] \"Renal cell carcinoma\" \n [32] \"Ovarian cancer\" \n [33] \"Cutaneous T-cell lymphoma\" \n [34] \"NRAS Melanoma\" \n [35] \"Testicular cancer\" \n [36] \"HIV-associated lymphoma\" \n [37] \"BCR::ABL1 B-cell acute lymphoblastic leukemia\" \n [38] \"Multiple myeloma\" \n [39] \"Waldenstroem macroglobulinemia\" \n [40] \"Chronic myeloid leukemia pediatric\" \n [41] \"Gastric cancer\" \n [42] \"Colorectal cancer\" \n [43] \"Pancreatic cancer\" \n [44] \"ERBB2 Breast cancer\" \n [45] \"Rectal cancer\" \n [46] \"TNBC Breast cancer\" \n [47] \"Small cell lung cancer\" \n [48] \"Glioblastoma\" \n [49] \"Peripheral T-cell lymphoma\" \n [50] \"CNS lymphoma\" \n [51] \"Head and neck cancer\" \n [52] \"ROS1 Non-small cell lung cancer\" \n [53] \"Diffuse large B-cell lymphoma\" \n [54] \"Breast cancer\" \n [55] \"Classical Hodgkin lymphoma\" \n [56] \"Osteosarcoma\" \n [57] \"Cutaneous squamous cell carcinoma\" \n [58] \"Adrenocortical carcinoma\" \n [59] \"B-cell acute lymphoblastic leukemia pediatric\" \n [60] \"Melanoma\" \n [61] \"Light-chain (AL) amyloidosis\" \n [62] \"B-cell acute lymphoblastic leukemia\" \n [63] \"Rhabdomyosarcoma\" \n [64] \"BCR::ABL1 B-cell acute lymphoblastic leukemia pediatric\" \n [65] \"Non-Hodgkin lymphoma pediatric\" \n [66] \"FLT3 Acute myeloid leukemia\" \n [67] \"NPM1 Acute myeloid leukemia\" \n [68] \"Thyroid cancer\" \n [69] \"Indolent lymphoma\" \n [70] \"Neuroblastoma\" \n [71] \"Papillary renal cell carcinoma\" \n [72] \"Pancreatic NET\" \n [73] \"Myelofibrosis\" \n [74] \"Penile cancer\" \n [75] \"Cholangiocarcinoma\" \n [76] \"Non-small cell lung cancer nonsquamous\" \n [77] \"Sickle cell anemia\" \n [78] \"Marginal zone lymphoma\" \n [79] \"T-cell prolymphocytic leukemia\" \n [80] \"Uveal melanoma\" \n [81] \"Neuroendocrine tumor\" \n [82] \"ER|ERBB2 Breast cancer\" \n [83] \"Malignant solid neoplasm NTRK-mutated\" \n [84] \"Low-grade serous ovarian cancer\" \n [85] \"Gastrointestinal stromal tumor\" \n [86] \"WHIM syndrome\" \n [87] \"Plasma cell leukemia\" \n [88] \"Gestational trophoblastic neoplasia\" \n [89] \"Langerhans cell histiocytosis\" \n [90] \"Malignant solid neoplasm ERBB3-mutated\" \n [91] \"Desmoid tumor\" \n [92] \"Thymoma\" \n [93] \"MALT lymphoma\" \n [94] \"Warm autoimmune hemolytic anemia\" \n [95] \"Burkitt lymphoma\" \n [96] \"Soft tissue sarcoma\" \n [97] \"Polycythemia vera\" \n [98] \"Cutaneous basal cell carcinoma\" \n [99] \"Follicular lymphoma\" \n [100] \"Smoldering multiple myeloma\" \n [101] \"Adult T-cell leukemia-lymphoma\" \n [102] \"Malignant solid neoplasm SMO-mutated or PTCH-1-mutated (Hedgehog)\"\n [103] \"Low-grade glioma\" \n [104] \"Post-transplant lymphoproliferative disorder\" \n [105] \"Primary mediastinal B-cell lymphoma\" \n [106] \"Ewing sarcoma\" \n [107] \"RAS Colorectal cancer\" \n [108] \"Urothelial carcinoma\" \n [109] \"NK- and T-cell lymphoma\" \n [110] \"Hairy cell leukemia\" \n [111] \"Gallbladder cancer\" \n [112] \"Hodgkin lymphoma nodular lymphocyte-predominant\" \n [113] \"Classical Hodgkin lymphoma pediatric\" \n [114] \"Nasopharyngeal carcinoma\" \n [115] \"Esophageal squamous cell carcinoma\" \n [116] \"Wilms tumor\" \n [117] \"Esophageal cancer\" \n [118] \"Sarcomatoid renal cell carcinoma\" \n [119] \"Anaplastic large cell lymphoma pediatric\" \n [120] \"Carcinoma of unknown primary\" \n [121] \"Hepatoblastoma\" \n [122] \"Bladder cancer\" \n [123] \"Vulvar cancer\" \n [124] \"Paroxysmal nocturnal hemoglobinuria\" \n [125] \"Mismatch repair deficient malignancy\" \n [126] \"PEComa\" \n [127] \"High-grade B-cell lymphoma\" \n [128] \"Blastic plasmacytoid dendritic cell neoplasm\" \n [129] \"Cervical cancer\" \n [130] \"Medulloblastoma\" \n [131] \"Osteosarcoma pediatric\" \n [132] \"Pheochromocytoma\" \n [133] \"RET Non-small cell lung cancer\" \n [134] \"Low-grade glioma pediatric\" \n [135] \"Malignant pleural mesothelioma\" \n [136] \"Leiomyosarcoma\" \n [137] \"Colon cancer\" \n [138] \"Hypereosinophilic syndrome\" \n [139] \"Malignant solid neoplasm ERBB2-mutated\" \n [140] \"KMT2A Acute lymphoblastic leukemia infant\" \n [141] \"PIK3CA Breast cancer\" \n [142] \"Essential thrombocythemia\" \n [143] \"Merkel cell carcinoma\" \n [144] \"T-cell acute lymphoblastic leukemia\" \n [145] \"Rosai-Dorfman-Destombes disease\" \n \"\"\" \n\n"
}
},
Expand Down
Loading