Skip to content

Commit 7a2e2ce

Browse files
Documentation and publishing updates (#52)
* Use poetry for build distribution and version bumping * Update dependencies and meta data * Added API reference and example usage * Fixed Discord link and added logo * Use github action to install poetry * Update assets location and update use case documentation * Update README and logo * Export data classes in init * rename docs license page * Rename doc license further * Use permalink for logo
1 parent 3d661a3 commit 7a2e2ce

31 files changed

+1453
-680
lines changed

.github/workflows/publish.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,12 @@ jobs:
1616
uses: actions/setup-python@v5
1717
with:
1818
python-version: "3.x"
19-
- name: Install pypa/build
20-
run: >-
21-
python3 -m
22-
pip install
23-
build
24-
--user
19+
- name: Install Poetry
20+
uses: snok/install-poetry@v1
21+
- name: Bump version
22+
run: poetry version $(git describe --tags --abbrev=0)
2523
- name: Build a binary wheel and a source tarball
26-
run: python3 -m build
24+
run: poetry build
2725
- name: Store the distribution packages
2826
uses: actions/upload-artifact@v3
2927
with:
@@ -50,6 +48,3 @@ jobs:
5048
path: dist/
5149
- name: Publish distribution 📦 to PyPI
5250
uses: pypa/gh-action-pypi-publish@release/v1
53-
54-
55-

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,5 @@ cython_debug/
160160
#.idea/
161161

162162
output/
163+
.DS_Store
164+
.vscode/

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ repos:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
10+
exclude: ^mkdocs.yml$
1011
- id: check-added-large-files
1112
- repo: https://github.com/astral-sh/ruff-pre-commit
1213
# Ruff version.

CONTRIBUTING.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Contributing
2-
> If you're reading this, you're early! We're still finalising our guidelines as this is an early release so please [drop us a message](https://discord.gg/jG4UWCUh) instead!
3-
>
42

53
First of all, thank you for being interested in contributing to HealthChain, we welcome contributions of all kinds! Listed below are some of the ways you can get involved.
64

@@ -28,17 +26,19 @@ If you're a developer, there are many ways you can contribute code:
2826

2927
## Join Our Discord
3028

31-
Are you a domain expert with valuable insights? We encourage you to join our [Discord community](https://discord.gg/jG4UWCUh) and share your wisdom. Your expertise can help shape the future of the project and guide us in making informed decisions.
29+
Are you a domain expert with valuable insights? We encourage you to join our [Discord community](https://discord.gg/4v6XgGBZ) and share your wisdom. Your expertise can help shape the future of the project and guide us in making informed decisions.
3230

3331
We believe that every contribution, big or small, makes a difference. Thank you for being a part of our community!
3432

3533
## How to Contribute Code
3634

35+
This project uses `poetry` for dependency management. For more information see the [poetry documentation](https://python-poetry.org/docs/).
36+
3737
1. Fork the repository to your own GitHub account. For more details check out [github documentation](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo).
3838

3939
2. Clone the forked repository to your local machine.
4040

41-
3. Run `poetry install` to install all the necessary dependencies.
41+
3. Run `poetry install --with dev` to install all the necessary development dependencies.
4242

4343
4. Try running `poetry run pytest` to check that all is working as expected.
4444

@@ -68,6 +68,25 @@ We believe that every contribution, big or small, makes a difference. Thank you
6868
6969
9. Open a pull request on the original repository.
7070
71+
### Contributing to Documentation
72+
73+
We use `Mkdocs` for our documentation site. To download the dependencies for documentation, run:
74+
```shell
75+
poetry install --with docs
76+
```
77+
78+
To preview the docs page in development:
79+
```shell
80+
poetry run mkdocs serve
81+
```
82+
#### Writing Clear Documentation
83+
84+
- **Be Concise**: Use clear and concise language to explain concepts and instructions.
85+
- **Use Headings**: Organize content with headings and subheadings to improve readability.
86+
- **Code Examples**: Include code examples to illustrate usage and functionality.
87+
- **Consistent Style**: Follow a consistent style and format throughout the documentation.
88+
- **Active Voice**: Write in the active voice to make instructions direct and easy to follow.
89+
- **Bullet Points**: Use bullet points or numbered lists for steps and key points.
7190
7291
## Testing
7392

README.md

Lines changed: 63 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
1+
<div align="center" style="margin-bottom: 1em;">
2+
3+
# HealthChain 💫 🏥
4+
5+
<img src="https://raw.githubusercontent.com/dotimplement/HealthChain/main/docs/assets/images/healthchain_logo.png" alt="HealthChain Logo" width=300></img>
6+
17
![GitHub License](https://img.shields.io/github/license/dotimplement/HealthChain)
8+
![PyPI Version](https://img.shields.io/pypi/v/healthchain) ![Python Versions](https://img.shields.io/pypi/pyversions/healthchain)
9+
![Downloads](https://img.shields.io/pypi/dm/healthchain)
210

3-
# HealthChain
11+
</div>
412

5-
Simplify prototyping and testing AI/NLP applications in a healthcare context 💫 🏥.
13+
Simplify testing and evaluating AI and NLP applications in a healthcare context 💫 🏥.
614

715
Building applications that integrate in healthcare systems is complex, and so is designing reliable, reactive algorithms involving unstructured data. Let's try to change that.
816

917
```bash
1018
pip install healthchain
1119
```
20+
First time here? Check out our [Docs](dotimplement.github.io/HealthChain/) page!
1221

1322
## Features
1423
- [x] 🍱 Create sandbox servers and clients that comply with real EHRs API and data standards.
@@ -39,8 +48,11 @@ pip install healthchain
3948
import healthchain as hc
4049

4150
from healthchain.use_cases import ClinicalDecisionSupport
51+
from healthchain.models import Card, CdsFhirData, CDSRequest
4252
from healthchain.data_generator import DataGenerator
4353

54+
from typing import List
55+
4456
# Decorate class with sandbox and pass in use case
4557
@hc.sandbox
4658
class myCDS(ClinicalDecisionSupport):
@@ -49,13 +61,13 @@ class myCDS(ClinicalDecisionSupport):
4961

5062
# Sets up an instance of a mock EHR client of the specified workflow
5163
@hc.ehr(workflow="patient-view")
52-
def ehr_database_client(self):
64+
def ehr_database_client(self) -> CdsFhirData:
5365
self.data_generator.generate()
5466
return self.data_generator.data
5567

5668
# Define your application logic here
5769
@hc.api
58-
def llm_server(self, request: str):
70+
def my_service(self, request: CdsRequest) -> List[Card]:
5971
result = "Hello " + request["patient_name"]
6072
return result
6173

@@ -70,6 +82,51 @@ healthchain run mycds.py
7082
```
7183
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 `./output` by default.
7284

85+
## Clinical Documentation
86+
87+
The ClinicalDocumentation use case implements a real-time Clinical Documentation Improvement (CDI) service. It helps convert free-text medical documentation into coded information that can be used for billing, quality reporting, and clinical decision support.
88+
89+
**When is this used?** Triggered when a clinician opts in to a CDI functionality (e.g. Epic NoteReader) and signs or pends a note after writing it.
90+
91+
**What information is sent**: A [CDA (Clinical Document Architecture)](https://www.hl7.org/implement/standards/product_brief.cfm?product_id=7) document which contains continuity of care data and free-text data, e.g. a patient's problem list and the progress note that the clinician has entered in the EHR.
92+
93+
**What information is returned**: A CDA document which contains additional structured data extracted and returned by your CDI service.
94+
95+
```python
96+
import healthchain as hc
97+
98+
from healthchain.use_cases import ClinicalDocumentation
99+
from healthchain.models import CcdData, ProblemConcept, Quantity,
100+
101+
@hc.sandbox
102+
class NotereaderSandbox(ClinicalDocumentation):
103+
def __init__(self):
104+
self.cda_path = "./resources/uclh_cda.xml"
105+
106+
# Load an existing CDA file
107+
@hc.ehr(workflow="sign-note-inpatient")
108+
def load_data_in_client(self) -> CcdData:
109+
with open(self.cda_path, "r") as file:
110+
xml_string = file.read()
111+
112+
return CcdData(cda_xml=xml_string)
113+
114+
# Define application logic
115+
@hc.api
116+
def my_service(self, ccd_data: CcdData) -> CcdData:
117+
# Apply method from ccd_data.note and access existing entries from ccd.problems
118+
119+
new_problem = ProblemConcept(
120+
code="38341003",
121+
code_system="2.16.840.1.113883.6.96",
122+
code_system_name="SNOMED CT",
123+
display_name="Hypertension",
124+
)
125+
ccd_data.problems.append(new_problem)
126+
return ccd_data
127+
```
128+
129+
73130
### Streamlit dashboard
74131
Note this is currently not meant to be a frontend to the EHR client, so you will have to run it separately from the sandbox application.
75132

@@ -79,7 +136,7 @@ streamlit streamlit-demo/app.py
79136
```
80137

81138
## Road Map
82-
- [ ] 📝 Adding Clinical Documentation use case
139+
- [x] 📝 Adding Clinical Documentation use case
83140
- [ ] 🎛️ Version and test different EHR backend configurations
84141
- [ ] 🤖 Integrations with popular LLM and NLP libraries
85142
- [ ] ❓ Evaluation framework for pipelines and use cases
@@ -89,7 +146,7 @@ streamlit streamlit-demo/app.py
89146

90147
## Contribute
91148
We are always eager to hear feedback and suggestions, especially if you are a developer or researcher working with healthcare systems!
92-
- 💡 Let's chat! [Discord](https://discord.gg/jG4UWCUh)
149+
- 💡 Let's chat! [Discord](https://discord.gg/4v6XgGBZ)
93150
- 🛠️ [Contribution Guidelines](CONTRIBUTING.md)
94151

95152
## Acknowledgement

docs/api/cda_parser.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CDA Parser
2+
3+
::: healthchain.cda_parser.cdaannotator

docs/api/cds_hooks.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# CDS Hooks
2+
3+
::: healthchain.models.hooks.encounterdischarge
4+
::: healthchain.models.hooks.orderselect
5+
::: healthchain.models.hooks.ordersign
6+
::: healthchain.models.hooks.patientview
7+
::: healthchain.models.hooks.sign-note-inpatient
8+
::: healthchain.models.hooks.sign-note-outpatient
9+
::: healthchain.models.responses.cdsdiscovery
10+
::: healthchain.models.responses.cdsfeedback

docs/api/clients.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Clients
2+
3+
::: healthchain.clients.ehrclient

docs/api/data_generators.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Data Generators
2+
3+
::: healthchain.data_generators.cdsdatagenerator
4+
::: healthchain.data_generators.encountergenerators

docs/api/data_models.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Data Models
2+
3+
::: healthchain.models.data.ccddata
4+
::: healthchain.models.data.cdsfhirdata
5+
::: healthchain.models.data.concept

docs/api/service.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Service
2+
3+
::: healthchain.service.service

docs/api/use_cases.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Use Cases
2+
3+
::: healthchain.use_cases.cds
4+
::: healthchain.models.requests.cdsrequest
5+
::: healthchain.models.responses.cdsresponse
6+
7+
::: healthchain.use_cases.clindoc
8+
::: healthchain.models.requests.cdarequest
9+
::: healthchain.models.responses.cdaresponse

docs/assets/healthchain_logo.png

-303 KB
Binary file not shown.
364 KB
Loading

docs/license-page.md renamed to docs/distribution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Licence
1+
# Licence and citations
22

33
HealthChain is licensed under Apache 2.0. To comply with the licence you need to add the following notice at the top every file that uses part of HealthChain code:
44

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
HealthChain💫🏥 is an open-source Python package that provides a framework for testing and validating AI/NLP applications in a healthcare context.
44

5-
[ :fontawesome-brands-discord: Join our Discord](https://discord.gg/jG4UWCUh){ .md-button .md-button--primary }
5+
[ :fontawesome-brands-discord: Join our Discord](https://discord.gg/4v6XgGBZ){ .md-button .md-button--primary }
66

77
<div class="grid cards" markdown>
88

docs/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ The aim of the data generator is not to generate realistic data suitable for use
7777
For this reason the data generator is opiniated by use case and workflow. See [Use Cases](usecases.md) for more information.
7878

7979
!!! note
80-
We're aware we may not cover everyone's use cases, so if you have strong opinions about this, please [reach out](https://discord.gg/jG4UWCUh)!
80+
We're aware we may not cover everyone's use cases, so if you have strong opinions about this, please [reach out](https://discord.gg/4v6XgGBZ)!
8181

8282
On the synthetic data spectrum defined by [this UK ONS methodology working paper](https://www.ons.gov.uk/methodology/methodologicalpublications/generalmethodology/onsworkingpaperseries/onsmethodologyworkingpaperseriesnumber16syntheticdatapilot#:~:text=Synthetic%20data%20at%20ONS&text=Synthetic%20data%20is%20created%20by,that%20provided%20the%20original%20data.%E2%80%9D), HealthChain generates level 1: synthetic structural data.
8383

84-
![Synthetic data](assets/synthetic_data_ons.png)
84+
![Synthetic data](assets/images/synthetic_data_ons.png)
8585

8686
You can use the data generator within a client function or on its own. The `.generate()` is dependent on workflow. For CDS use cases, it will return a `CdsFhirData` model with the `prefetch` field populated with a [Bundle](https://www.hl7.org/fhir/bundle.html) of generated structural synthetic FHIR data.
8787

docs/stylesheets/extra.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
margin-bottom: 2rem;
7070
}
7171

72-
.language-python {
72+
/* .language-python {
7373
background: #FFFFFF ! important
74-
}
74+
} */
7575

7676
.language-bash {
7777
background: #FFFFFF ! important

0 commit comments

Comments
 (0)