|
a |
|
b/README.md |
|
|
1 |
# ClearMatch |
|
|
2 |
|
|
|
3 |
A Python tool for the structured analysis of clinical trial eligibility criteria by extracting and organizing atomic criteria into logical structures. |
|
|
4 |
|
|
|
5 |
## π Overview |
|
|
6 |
|
|
|
7 |
ClearMatch processes clinical trial data from **ClinicalTrials.gov**, extracting structured information about eligibility criteria. It performs three key steps: |
|
|
8 |
|
|
|
9 |
1. **Identification** β Extracts atomic criteria from raw text. |
|
|
10 |
2. **Logical Structuring** β Organizes these criteria using logical relationships (`AND`, `OR`, `NOT`, `XOR`, `CONDITIONAL`). |
|
|
11 |
3. **Matching Patients to Oncological Clinical Trials** β _(Planned but not yet implemented)._ |
|
|
12 |
|
|
|
13 |
### **β
Features** |
|
|
14 |
- β
Fetches clinical trial data from the **ClinicalTrials.gov API**. |
|
|
15 |
- β
Extracts and structures **eligibility criteria** into logical expressions. |
|
|
16 |
- β
Persists processed data as **JSON files** for further analysis. |
|
|
17 |
- π§ **Upcoming:** Automated patient matching system. |
|
|
18 |
- π§ **Upcoming:** UI. |
|
|
19 |
|
|
|
20 |
--- |
|
|
21 |
|
|
|
22 |
## **π Requirements** |
|
|
23 |
- **Python 3.13+** |
|
|
24 |
- **OpenAI API key** (for GPT-4o access) |
|
|
25 |
π **Get your API key here:** [OpenAI API Keys](https://platform.openai.com/api-keys) |
|
|
26 |
|
|
|
27 |
--- |
|
|
28 |
|
|
|
29 |
## **πΎ Installation** |
|
|
30 |
|
|
|
31 |
1οΈβ£ **Clone the repository** |
|
|
32 |
```sh |
|
|
33 |
gh repo clone judacas/Clinical-Trial-Prompts |
|
|
34 |
``` |
|
|
35 |
|
|
|
36 |
_This uses [GitHub CLI](https://cli.github.com/). If you donβt have it, use:_ |
|
|
37 |
|
|
|
38 |
```sh |
|
|
39 |
git clone https://github.com/judacas/Clinical-Trial-Prompts.git |
|
|
40 |
``` |
|
|
41 |
make sure to then cd into the root directory |
|
|
42 |
```sh |
|
|
43 |
cd Clinical-Trial-Prompts |
|
|
44 |
``` |
|
|
45 |
|
|
|
46 |
2οΈβ£ **Set up a virtual environment _(Optional but Recommended)_ ** |
|
|
47 |
```sh |
|
|
48 |
python -m venv .venv |
|
|
49 |
source .venv/bin/activate # macOS/Linux |
|
|
50 |
.venv\Scripts\activate # Windows |
|
|
51 |
``` |
|
|
52 |
|
|
|
53 |
3οΈβ£ **Install dependencies** |
|
|
54 |
```sh |
|
|
55 |
pip install -r requirements.txt |
|
|
56 |
``` |
|
|
57 |
|
|
|
58 |
4οΈβ£ **Set up environment variables** |
|
|
59 |
Copy the example [`sample.env`](src/sample.env) file and rename it to proper `.env` naming convention: |
|
|
60 |
```sh |
|
|
61 |
cp src/sample.env src/.env # macOS/Linux |
|
|
62 |
copy src\sample.env src\.env # Windows |
|
|
63 |
``` |
|
|
64 |
|
|
|
65 |
To edit the `.env` file in the terminal, use: |
|
|
66 |
```sh |
|
|
67 |
nano src/.env # Linux/macOS |
|
|
68 |
notepad src\.env # Windows |
|
|
69 |
``` |
|
|
70 |
Then, add your OpenAI API key: |
|
|
71 |
```sh |
|
|
72 |
OPENAI_API_KEY="your-api-key-here" |
|
|
73 |
``` |
|
|
74 |
|
|
|
75 |
π **Note:** The `.env` file is ignored by Git to prevent accidental key exposure. |
|
|
76 |
|
|
|
77 |
--- |
|
|
78 |
|
|
|
79 |
## **π Usage** |
|
|
80 |
Run ClearMatch using: |
|
|
81 |
```sh |
|
|
82 |
python -m src.main |
|
|
83 |
``` |
|
|
84 |
Follow the command-line instructions to process and structure clinical trial data. |
|
|
85 |
|
|
|
86 |
--- |
|
|
87 |
|
|
|
88 |
## **π Data Flow** |
|
|
89 |
1. **Fetch raw trial data** from **ClinicalTrials.gov**. |
|
|
90 |
2. [**Identify**](src/services/identifier.py) the atomic eligibility criteria in the selected trials. |
|
|
91 |
3. [**Structure criteria**](src/services/logical_structurizer.py) using logical operators (`AND`, `OR`, etc.). |
|
|
92 |
4. **Store results** as structured **JSON files** in [`output/`](output/) subdirectory for further use. |
|
|
93 |
|
|
|
94 |
--- |
|
|
95 |
|
|
|
96 |
## **π‘ Future Plans** |
|
|
97 |
- πΉ Add **automated patient-trial matching**. |
|
|
98 |
- πΉ Implement **an API** to allow external applications to query structured trial data. |
|
|
99 |
- πΉ Optimize **logical structuring** for better accuracy. |
|
|
100 |
|
|
|
101 |
--- |
|
|
102 |
|
|
|
103 |
## **π€ Contributions** |
|
|
104 |
Contributions are welcome! Please open an issue or submit a pull request. |
|
|
105 |
|
|
|
106 |
--- |
|
|
107 |
|
|
|
108 |
## **π License** |
|
|
109 |
This project is licensed under the **MIT License**. |
|
|
110 |
|
|
|
111 |
--- |