Skip to content

Commit 145a54b

Browse files
authored
Merge pull request #416 from smart-on-fhir/mikix/simplify-upload-no-nlp
feat(upload-notes): disable NLP by default
2 parents 4310606 + 221f2ea commit 145a54b

File tree

3 files changed

+32
-23
lines changed

3 files changed

+32
-23
lines changed

cumulus_etl/upload_notes/cli.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,15 @@ def define_upload_notes_parser(parser: argparse.ArgumentParser) -> None:
407407
default=ctakesclient.filesystem.covid_symptoms_path(),
408408
)
409409
group.add_argument(
410-
"--no-nlp", action="store_false", dest="nlp", default=True, help="Don’t run NLP on notes"
410+
"--nlp",
411+
action=argparse.BooleanOptionalAction,
412+
default=False,
413+
help="whether to run NLP on notes (disabled by default)",
411414
)
412415

413416
group = parser.add_argument_group("Label Studio")
414417
group.add_argument(
415-
"--ls-token", metavar="PATH", help="Token file for Label Studio access", required=True
418+
"--ls-token", metavar="PATH", help="token file for Label Studio access", required=True
416419
)
417420
group.add_argument(
418421
"--ls-project",
@@ -422,7 +425,7 @@ def define_upload_notes_parser(parser: argparse.ArgumentParser) -> None:
422425
required=True,
423426
)
424427
group.add_argument(
425-
"--overwrite", action="store_true", help="Whether to overwrite an existing task for a note"
428+
"--overwrite", action="store_true", help="whether to overwrite an existing task for a note"
426429
)
427430

428431
cli_utils.add_debugging(parser)

docs/chart-review.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,11 @@ If you haven't set that up yet, go do that and come back.
3131
The Cumulus team can help you with setting it up if you come talk to us,
3232
but the rest of this guide will mostly deal with the `upload-notes` mode itself.
3333

34-
### Dependent Services
35-
36-
Some features of upload mode need external services (like cTAKES to run NLP).
37-
Launch those before you begin:
38-
39-
```shell
40-
export UMLS_API_KEY=your-umls-api-key
41-
docker compose --profile upload-notes up --wait
42-
```
43-
44-
Or if you have access to a GPU,
45-
you can speed up the NLP by launching the GPU profile instead with `--profile upload-notes-gpu`.
46-
4734
## Basic Operation
4835

4936
At its core, upload mode is just another ETL (extract, transform, load) operation.
5037
1. It extracts DiagnosticReport and/or DocumentReference resources from your EHR.
51-
2. It transforms the contained notes via NLP & `philter`.
38+
2. It transforms the contained notes via `philter` (and optionally NLP).
5239
3. It loads the results into Label Studio.
5340

5441
### Minimal Command Line
@@ -188,7 +175,24 @@ Pass in an argument like `--export-to /in/export` to save the NDJSON for the sel
188175
in the given folder. (Note this does not save the clinical note text unless it is already inline
189176
-- this is just saving the DocumentReference resources).
190177

191-
## Custom NLP Dictionaries
178+
## NLP
179+
180+
To enable NLP tagging via cTAKES, pass `--nlp`.
181+
This will tag mentions of symptoms it finds, to make chart review easier.
182+
183+
### Dependent Services
184+
185+
NLP needs cTAKES to be available, so you'll need to launch it before you begin:
186+
187+
```shell
188+
export UMLS_API_KEY=your-umls-api-key
189+
docker compose --profile upload-notes up --wait
190+
```
191+
192+
Or if you have access to a GPU,
193+
you can speed up the NLP by launching the GPU profile instead with `--profile upload-notes-gpu`.
194+
195+
### Custom Dictionaries
192196

193197
If you would like to customize the dictionary terms that are marked up and sent to Label Studio,
194198
simply pass in a new dictionary like so: `--symptoms-bsv /in/my-symptoms.bsv`.
@@ -232,10 +236,12 @@ But any phrases that cTAKES tags as CUI `C0011991` will be labelled as `Diarrhea
232236
cTAKES has an internal dictionary and knows some phrases already.
233237
But you may get better results by adding extra terms and variations in your symptoms file.
234238

235-
## Disabling Features
239+
## Philter
240+
241+
You may not need `philter` processing.
242+
Simply pass `--philter=disable` and it will be skipped.
236243

237-
You may not need NLP or `philter` processing.
238-
Simply pass `--no-nlp` or `--philter=disable` and those steps will be skipped.
244+
Or alternatively, pass `--philter=label` to highlight rather than redact detected PHI.
239245

240246
## Label Studio
241247

tests/upload_notes/test_upload_cli.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ async def run_upload_notes(
102102
args += ["--anon-docrefs", anon_docrefs]
103103
if docrefs:
104104
args += ["--docrefs", docrefs]
105-
if not nlp:
106-
args += ["--no-nlp"]
105+
if nlp:
106+
args += ["--nlp"]
107107
if philter:
108108
args += ["--philter", philter]
109109
if no_philter:

0 commit comments

Comments
 (0)