-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added connector modules * Fix typo * Added processing of io connectors in pipelines * Refactored CDA related processing in use case to connectors * Added tests * Added CdsFhirConnector * Updated use case functions and tests * WIP connector usage in pipelines and components * Fix model import name in docs * Update Bundle validator method to dynamically import nested resource types * Update CdsFhirConnector input method validations * Add create method to CdsFhirData * Fixed CdsResponse should return list of actions * Added tests * Added pipeline tests * Changed .add() -> .add_node() to make more explicit and use convention of BaseObject and base.py in modules * Update documentation to reflect changes in this PR
- Loading branch information
1 parent
3efcb92
commit 378e6b2
Showing
56 changed files
with
1,975 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Component | ||
|
||
::: healthchain.pipeline.components.basecomponent | ||
::: healthchain.pipeline.components.base | ||
::: healthchain.pipeline.components.preprocessors | ||
::: healthchain.pipeline.components.models | ||
::: healthchain.pipeline.components.model | ||
::: healthchain.pipeline.components.postprocessors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Connectors | ||
|
||
::: healthchain.io.base | ||
::: healthchain.io.cdaconnector | ||
::: healthchain.io.cdsfhirconnector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Pipeline | ||
|
||
::: healthchain.pipeline.basepipeline | ||
::: healthchain.pipeline.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# CDA Connector | ||
|
||
The `CdaConnector` handles Clinical Document Architecture (CDA) documents, serving as both an input and output connector in the pipeline. It parses CDA documents, extracting free-text notes and relevant structured clinical data into a `Document` object, and can return an annotated CDA document as output. | ||
|
||
This connector is particularly useful for clinical documentation improvement (CDI) workflows where CDA documents need to be processed and updated with additional structured data. | ||
|
||
[(Full Documentation on Clinical Documentation)](../../sandbox/use_cases/clindoc.md) | ||
|
||
## Usage | ||
|
||
```python | ||
from healthchain.io import CdaConnector, Document | ||
from healthchain.models import CdaRequest | ||
from healthchain.pipeline import Pipeline | ||
|
||
# Create a pipeline with CdaConnector | ||
pipeline = Pipeline() | ||
|
||
cda_connector = CdaConnector() | ||
pipeline.add_input(cda_connector) | ||
pipeline.add_output(cda_connector) | ||
|
||
# Example CDA request | ||
cda_request = CdaRequest(document="<CDA XML content>") | ||
|
||
# Example 1: Simple pipeline execution | ||
pipe = pipeline.build() | ||
cda_response = pipe(cda_request) | ||
print(cda_response) | ||
# Output: CdaResponse(document='<Annotated CDA XML content>') | ||
|
||
# Example 2: Accessing CDA data inside a pipeline node | ||
@pipeline.add_node | ||
def example_pipeline_node(document: Document) -> Document: | ||
print(document.ccd_data) | ||
return document | ||
|
||
pipe = pipeline.build() | ||
cda_response = pipe(cda_request) | ||
# Output: CcdData object... | ||
``` | ||
|
||
## Accessing data inside your pipeline | ||
|
||
Data parsed from the CDA document is stored in the `Document.ccd_data` attribute as a `CcdData` object, as shown in the example above. | ||
|
||
[(CcdData Reference)](../../../api/data_models.md#healthchain.models.data.ccddata.CcdData) | ||
|
||
## Configuration | ||
|
||
The `overwrite` parameter in the `CdaConnector` constructor determines whether existing data in the document should be overwritten. This can be useful for readability with very long CDA documents when the receiving system does not require the full document. | ||
|
||
```python | ||
cda_connector = CdaConnector(overwrite=True) | ||
``` |
Oops, something went wrong.