Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
97548c7
Refactor sandbox to separate module
jenniferjiangkells Apr 30, 2025
b17b55d
Fix tests
jenniferjiangkells Apr 30, 2025
e1a4d57
Gateway module WIP
jenniferjiangkells May 1, 2025
f5b6f57
Update poetry.lock
jenniferjiangkells May 2, 2025
278f86d
Add fhirclient, bump python min to 3.9, update poetry
jenniferjiangkells May 6, 2025
3365436
Update module structure
jenniferjiangkells May 6, 2025
40451ee
Use consistent pydantic models to silence serialization warning
jenniferjiangkells May 7, 2025
85f5866
Fix bugs in configs
jenniferjiangkells May 7, 2025
bd56d6d
Fix code snippet in docs
jenniferjiangkells May 7, 2025
cb9ece0
Migrating service module to gateway/services
jenniferjiangkells May 7, 2025
454096b
Implement cdshooks and notereader services plus clean up on base and …
jenniferjiangkells May 9, 2025
433c2ef
Remove async from cdshooks
jenniferjiangkells May 9, 2025
c140d00
Update relatesTo access
jenniferjiangkells May 9, 2025
1b19026
Add fields to CdsRequest
jenniferjiangkells May 9, 2025
b5ee97a
Update sandbox usage and tests
jenniferjiangkells May 9, 2025
946a1d6
Update tests for gateway module
jenniferjiangkells May 9, 2025
6a715af
Remove scrap
jenniferjiangkells May 9, 2025
40ba249
Add HealthChainAPI class and FhirRouter placeholder
jenniferjiangkells May 12, 2025
ba32959
Update poetry.lock
jenniferjiangkells May 12, 2025
9c7a0bb
Update CI python version
jenniferjiangkells May 12, 2025
601c7f3
Fix typo
jenniferjiangkells May 12, 2025
bf72ff0
Pass test
jenniferjiangkells May 12, 2025
b2beda7
Fix namespace conflict
jenniferjiangkells May 13, 2025
697d2db
Fix patching issue in tests for python 3.10
jenniferjiangkells May 13, 2025
ef4bb6a
Fix pydantic to <2.11
jenniferjiangkells May 13, 2025
017cce5
Tidy up structure
jenniferjiangkells May 13, 2025
49877f6
Added event dispatch and unified everything to gateways
jenniferjiangkells May 14, 2025
d233c16
Update dependencies
jenniferjiangkells May 14, 2025
7aee31e
Added dependency injection and protocol with tests
jenniferjiangkells May 15, 2025
b2bda89
Deprecate Service module
jenniferjiangkells May 15, 2025
186936d
Fix tests
jenniferjiangkells May 15, 2025
7c89d34
Merge branch 'main' of https://github.com/dotimplement/HealthChain in…
jenniferjiangkells May 19, 2025
681095e
Address comments and removed WIP modules
jenniferjiangkells Jun 5, 2025
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
test:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
python-version: ["3.9", "3.10", "3.11"]
poetry-version: [1.8.2]
runs-on: ubuntu-latest
steps:
Expand Down
44 changes: 0 additions & 44 deletions .github/workflows/test-publish.yml

This file was deleted.

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Sandboxes provide a staging environment for testing and validating your pipeline
import healthchain as hc

from healthchain.pipeline import SummarizationPipeline
from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import Card, Prefetch, CDSRequest
from healthchain.data_generator import CdsDataGenerator
from typing import List
Expand Down Expand Up @@ -192,7 +192,7 @@ The `ClinicalDocumentation` use case implements a real-time Clinical Documentati
import healthchain as hc

from healthchain.pipeline import MedicalCodingPipeline
from healthchain.use_cases import ClinicalDocumentation
from healthchain.sandbox.use_cases import ClinicalDocumentation
from healthchain.models import CdaRequest, CdaResponse
from fhir.resources.documentreference import DocumentReference

Expand Down Expand Up @@ -227,7 +227,7 @@ Ensure you run the following commands in your `mycds.py` file:

```python
cds = MyCDS()
cds.run_sandbox()
cds.start_sandbox()
```
This will populate your EHR client with the data generation method you have defined, send requests to your server for processing, and save the data in the `./output` directory.

Expand Down
3 changes: 2 additions & 1 deletion configs/interop/cda/sections/allergies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ template:

# Clinical status observation configuration
clinical_status_obs:
template_id: "2.16.840.1.113883.10.20.1.39"
template_id:
- "2.16.840.1.113883.10.20.1.39"
code: "33999-4"
code_system: "2.16.840.1.113883.6.1"
code_system_name: "LOINC"
Expand Down
2 changes: 1 addition & 1 deletion configs/templates/fhir_cda/note_entry.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@value": "{{ resource.date | format_date: 'cda' }}"
},
{% endif %}
"text": "{{ resource.content[0].attachment.data | from_base64 }}"
"text": {{ resource.content[0].attachment.data | from_base64 | json }}
}
}
}
12 changes: 7 additions & 5 deletions configs/templates/fhir_cda/problem_entry.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@
},
"statusCode": {"@code": "{{ config.template.problem_obs.status_code }}"},
"effectiveTime": {
{% if resource.onsetDateTime %}
"low": {"@value": "{{ resource.onsetDateTime }}"}
{% endif %}
{% if resource.abatementDateTime %}
"high": {"@value": "{{ resource.abatementDateTime }}"}
{% if resource.onsetDateTime and resource.abatementDateTime %}
"low": {"@value": "{{ resource.onsetDateTime }}"},
"high": {"@value": "{{ resource.abatementDateTime }}"}
{% elsif resource.onsetDateTime %}
"low": {"@value": "{{ resource.onsetDateTime }}"}
{% elsif resource.abatementDateTime %}
"high": {"@value": "{{ resource.abatementDateTime }}"}
{% endif %}
},
"value": {
Expand Down
2 changes: 1 addition & 1 deletion cookbook/cds_discharge_summarizer_hf_chat.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import healthchain as hc

from healthchain.pipeline import SummarizationPipeline
from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.models import CDSRequest, CDSResponse, Prefetch
from healthchain.data_generators import CdsDataGenerator
from healthchain.sandbox.use_cases import ClinicalDecisionSupport

from langchain_huggingface.llms import HuggingFaceEndpoint
from langchain_huggingface import ChatHuggingFace
Expand Down
2 changes: 1 addition & 1 deletion cookbook/cds_discharge_summarizer_hf_trf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import healthchain as hc

from healthchain.pipeline import SummarizationPipeline
from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import Prefetch, CDSRequest, CDSResponse
from healthchain.data_generators import CdsDataGenerator

Expand Down
2 changes: 1 addition & 1 deletion docs/api/clients.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Clients

::: healthchain.clients.ehrclient
::: healthchain.sandbox.clients.ehr.EHRClient
4 changes: 2 additions & 2 deletions docs/api/use_cases.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Use Cases

::: healthchain.use_cases.cds
::: healthchain.sandbox.use_cases.cds
::: healthchain.models.requests.cdsrequest
::: healthchain.models.responses.cdsresponse

::: healthchain.use_cases.clindoc
::: healthchain.sandbox.use_cases.clindoc
::: healthchain.models.requests.cdarequest
::: healthchain.models.responses.cdaresponse
4 changes: 2 additions & 2 deletions docs/cookbook/cds_sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ We'll also need to implement the service method, which will process the request
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import CDSRequest, CDSResponse

@hc.sandbox
Expand Down Expand Up @@ -136,7 +136,7 @@ To finish our sandbox, we'll define a client function that loads the data genera
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import CDSRequest, CDSResponse, Prefetch

@hc.sandbox
Expand Down
5 changes: 3 additions & 2 deletions docs/cookbook/notereader_sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ Full example coming soon!
import healthchain as hc

from healthchain.io import Document
from healthchain.models.requests.cda import CdaRequest, CdaResponse
from healthchain.models.requests import CdaRequest
from healthchain.models.responses import CdaResponse
from healthchain.pipeline.medicalcodingpipeline import MedicalCodingPipeline
from healthchain.use_cases.clindoc import ClinicalDocumentation
from healthchain.sandbox.use_cases import ClinicalDocumentation
from healthchain.fhir import create_document_reference

from spacy.tokens import Span
Expand Down
6 changes: 3 additions & 3 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Every sandbox also requires a **client** function marked by `@hc.ehr` and a **se
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDocumentation
from healthchain.sandbox.use_cases import ClinicalDocumentation
from healthchain.pipeline import MedicalCodingPipeline
from healthchain.models import CdaRequest, CdaResponse
from healthchain.fhir import create_document_reference
Expand Down Expand Up @@ -245,7 +245,7 @@ The `.generate_prefetch()` method is dependent on use case and workflow. For exa
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import Prefetch
from healthchain.data_generators import CdsDataGenerator

Expand All @@ -268,7 +268,7 @@ The `.generate_prefetch()` method is dependent on use case and workflow. For exa
=== "On its own"
```python
from healthchain.data_generators import CdsDataGenerator
from healthchain.workflows import Workflow
from healthchain.sandbox.workflows import Workflow

# Initialize data generator
data_generator = CdsDataGenerator()
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/sandbox/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ You can optionally specify the number of requests to generate with the `num` par
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDocumentation
from healthchain.sandbox.use_cases import ClinicalDocumentation
from healthchain.fhir import create_document_reference

from fhir.resources.documentreference import DocumentReference
Expand All @@ -32,7 +32,7 @@ You can optionally specify the number of requests to generate with the `num` par
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import Prefetch

from fhir.resources.patient import Patient
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/sandbox/sandbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Every sandbox also requires a [**Client**](./client.md) function marked by `@hc.
import healthchain as hc

from healthchain.pipeline import SummarizationPipeline
from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.data_generators import CdsDataGenerator
from healthchain.models import CDSRequest, Prefetch, CDSResponse

Expand Down
4 changes: 2 additions & 2 deletions docs/reference/sandbox/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Here are minimal examples for each use case:
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDocumentation
from healthchain.sandbox.use_cases import ClinicalDocumentation
from healthchain.pipeline import MedicalCodingPipeline
from healthchain.models import CdaRequest, CdaResponse
from healthchain.fhir import create_document_reference
Expand Down Expand Up @@ -42,7 +42,7 @@ Here are minimal examples for each use case:
```python
import healthchain as hc

from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.pipeline import SummarizationPipeline
from healthchain.models import CDSRequest, CDSResponse, Prefetch
from fhir.resources.patient import Patient
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/utilities/data_generator.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ You can use the data generator within a client function or on its own.
=== "Within client"
```python
import healthchain as hc
from healthchain.use_cases import ClinicalDecisionSupport
from healthchain.sandbox.use_cases import ClinicalDecisionSupport
from healthchain.models import Prefetch
from healthchain.data_generators import CdsDataGenerator

Expand All @@ -58,7 +58,7 @@ You can use the data generator within a client function or on its own.
=== "On its own"
```python
from healthchain.data_generators import CdsDataGenerator
from healthchain.workflows import Workflow
from healthchain.sandbox.workflows import Workflow

# Initialize data generator
data_generator = CdsDataGenerator()
Expand Down
13 changes: 9 additions & 4 deletions healthchain/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import logging
from .utils.logger import add_handlers
import warnings

from .decorators import api, sandbox
from .clients import ehr
from .utils.logger import add_handlers
from .config.base import ConfigManager, ValidationLevel

from .sandbox.decorator import sandbox, api, ehr

# Enable deprecation warnings
warnings.filterwarnings("always", category=DeprecationWarning, module="healthchain")

logger = logging.getLogger(__name__)

add_handlers(logger)
logger.setLevel(logging.INFO)

# Export them at the top level
__all__ = ["ehr", "api", "sandbox", "ConfigManager", "ValidationLevel"]
__all__ = ["ConfigManager", "ValidationLevel", "api", "ehr", "sandbox"]
7 changes: 0 additions & 7 deletions healthchain/apimethod.py

This file was deleted.

3 changes: 0 additions & 3 deletions healthchain/clients/__init__.py

This file was deleted.

3 changes: 1 addition & 2 deletions healthchain/data_generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .proceduregenerators import ProcedureGenerator
from .medicationadministrationgenerators import MedicationAdministrationGenerator
from .medicationrequestgenerators import MedicationRequestGenerator
from .cdsdatagenerator import CdsDataGenerator, Workflow
from .cdsdatagenerator import CdsDataGenerator

__all__ = [
"EncounterGenerator",
Expand All @@ -16,5 +16,4 @@
"MedicationAdministrationGenerator",
"MedicationRequestGenerator",
"CdsDataGenerator",
"Workflow",
]
4 changes: 3 additions & 1 deletion healthchain/data_generators/cdsdatagenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
from typing import Callable, Dict, Optional, List
from pathlib import Path

from healthchain.base import Workflow
from fhir.resources.resource import Resource

from healthchain.data_generators.basegenerators import generator_registry
from healthchain.models import Prefetch
from healthchain.fhir import create_document_reference
from healthchain.sandbox.workflows import Workflow


logger = logging.getLogger(__name__)

Expand Down
Loading