Skip to content

Commit bb2ccc8

Browse files
committed
Add handler for null response
1 parent 8ba2de1 commit bb2ccc8

3 files changed

Lines changed: 13 additions & 2 deletions

File tree

airflow/dags/rxclass/dag_tasks.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ def load(file_path_str:str):
4848

4949
classes = []
5050
for result in results:
51+
# skip a result if it is None
52+
if result is None:
53+
continue
5154
response = result['response']
5255
if 'rxclassDrugInfoList' in response:
5356
for drug_info in response["rxclassDrugInfoList"]["rxclassDrugInfo"]:

airflow/dags/rxnorm_historical/dag_tasks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def load(file_path_str:str):
4545
# Initialize a list to store the processed data
4646
records = []
4747
for result in results:
48-
if not len(result['response']) == 0:
48+
if result is not None and not len(result['response']) == 0:
4949
response = result['response']
5050
if 'historicalNdcConcept' in response:
5151
url = result['url']
@@ -72,6 +72,7 @@ def load(file_path_str:str):
7272
# Create a single DataFrame from the list of dictionaries
7373
df = pd.DataFrame.from_records(records)
7474
print(f'Processed {len(df)} RXCUIs.')
75+
print(df.head(10))
7576

7677
# Load the final DataFrame into the database
7778
load_df_to_pg(df, "sagerx_lake", "rxnorm_historical", "replace", index=False, create_index=True, index_columns=['ndc', 'end_date'])

marimo/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ RUN pip install --no-cache-dir \
66
psycopg2-binary \
77
sqlalchemy \
88
pandas \
9-
numpy
9+
numpy \
10+
matplotlib \
11+
openai \
12+
anthropic \
13+
duckdb \
14+
sqlglot \
15+
altair \
16+
ruff
1017

1118
# Create marimo config directory
1219
RUN mkdir -p /root/.marimo

0 commit comments

Comments
 (0)