From 29a933918d5aa1134022a56b1c24afba2e52b4b0 Mon Sep 17 00:00:00 2001 From: Reinder Vos de Wael Date: Thu, 16 Jan 2025 16:05:26 -0500 Subject: [PATCH] feat: Add history of head injury text (#180) --- src/ctk_functions/core/config.py | 8 -------- src/ctk_functions/microservices/redcap.py | 3 ++- .../routers/intake/intake_processing/parser.py | 8 ++++++++ .../routers/intake/intake_processing/transformers.py | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ctk_functions/core/config.py b/src/ctk_functions/core/config.py index 2813e8d..0d0a1b1 100644 --- a/src/ctk_functions/core/config.py +++ b/src/ctk_functions/core/config.py @@ -18,14 +18,6 @@ class Settings(pydantic_settings.BaseSettings): "https://redcap.healthybrainnetwork.org/redcap/api/", ) - AWS_ACCESS_KEY_ID: pydantic.SecretStr - AWS_SECRET_ACCESS_KEY: pydantic.SecretStr - AWS_REGION: str = "us-west-2" - - AZURE_OPENAI_API_KEY: pydantic.SecretStr - AZURE_OPENAI_LLM_DEPLOYMENT: pydantic.SecretStr - AZURE_OPENAI_ENDPOINT: pydantic.SecretStr - LANGUAGE_TOOL_URL: str CLOAI_SERVICE_URL: str diff --git a/src/ctk_functions/microservices/redcap.py b/src/ctk_functions/microservices/redcap.py index f44bbc0..7a10cbe 100644 --- a/src/ctk_functions/microservices/redcap.py +++ b/src/ctk_functions/microservices/redcap.py @@ -1107,6 +1107,8 @@ class RedCapData(pydantic.BaseModel): encephalitis_age: str | None encephalitis_treatment: str | None encephalitis: bool + head_injuries: bool + head_injury_yes: str | None # Family psychiatric history @@ -1476,5 +1478,4 @@ def get_intake_data(mrn: str) -> RedCapData: records=[record_ids[0]], ), ) - return RedCapData.from_csv(patient_data) diff --git a/src/ctk_functions/routers/intake/intake_processing/parser.py b/src/ctk_functions/routers/intake/intake_processing/parser.py index 2d90ebe..74d3c66 100644 --- a/src/ctk_functions/routers/intake/intake_processing/parser.py +++ b/src/ctk_functions/routers/intake/intake_processing/parser.py @@ -654,6 +654,14 @@ def __init__(self, patient_data: redcap.RedCapData) -> None: ) for disease in ("seizures", "migraines", "meningitis", "encephalitis") ] + diseases.append( + redcap.PriorDisease( + name="head injury", + was_positive=patient_data.head_injuries, + age=None, + treatment=None, + ), + ) self.prior_diseases = transformers.PriorDiseases(diseases).transform() diff --git a/src/ctk_functions/routers/intake/intake_processing/transformers.py b/src/ctk_functions/routers/intake/intake_processing/transformers.py index 130c71d..b2603f3 100644 --- a/src/ctk_functions/routers/intake/intake_processing/transformers.py +++ b/src/ctk_functions/routers/intake/intake_processing/transformers.py @@ -415,9 +415,9 @@ def transform(self) -> str: )}""" else: string = f""" - {ReplacementTags.REPORTING_GUARDIAN.value} reported a history of: + {ReplacementTags.REPORTING_GUARDIAN.value} reported a history of {string_utils.join_with_oxford_comma(positive_diseases)} and denied - any history of: + any history of {string_utils.join_with_oxford_comma(negative_diseases)} """