Skip to content

Conversation

@mikix
Copy link
Contributor

@mikix mikix commented Aug 20, 2025

This commit adds support for dual-resource tasks and then adds DiagnosticReport to the NLP base task class.

This required some vocabulary alignment, as we used "docref" a lot in places that now can take a docref or a dxreport.

  • "note" or "note resource": a DocRef or DxReport resource (dict)
  • "note text" or "text": the clinical text inside the note

Checklist

  • Consider if documentation (like in docs/) needs to be updated
  • Consider if tests should be added

@mikix mikix force-pushed the mikix/nlp-dxreports branch from 7a26b11 to fa22902 Compare August 20, 2025 16:33
docker compose run --rm \
--volume $DATADIR:/in \
cumulus-etl \
nlp \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fact that this change was needed here but not before, tells me we are regression testing the public release instead of the current branch. We have code to build the branch's docker image... not sure why it's not being used here. I can dig into it later, but just an FYI - it's on my todo list.

@github-actions
Copy link

github-actions bot commented Aug 20, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
4138 4096 99% 98% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
cumulus_etl/etl/nlp/cli.py 100% 🟢
cumulus_etl/etl/pipeline.py 100% 🟢
cumulus_etl/etl/studies/covid_symptom/covid_ctakes.py 100% 🟢
cumulus_etl/etl/studies/covid_symptom/covid_tasks.py 100% 🟢
cumulus_etl/etl/tasks/base.py 100% 🟢
cumulus_etl/etl/tasks/nlp_task.py 100% 🟢
cumulus_etl/export/cli.py 100% 🟢
cumulus_etl/nlp/init.py 100% 🟢
cumulus_etl/nlp/utils.py 100% 🟢
TOTAL 100% 🟢

updated for commit: 5160616 by action🐍

@mikix mikix force-pushed the mikix/nlp-dxreports branch from fa22902 to ddec0bc Compare August 20, 2025 17:34
@mikix mikix marked this pull request as ready for review August 20, 2025 18:10
@mikix mikix force-pushed the mikix/nlp-dxreports branch from ddec0bc to a261f10 Compare August 20, 2025 18:22
f"Could not process answer from NLP server for DocRef {orig_docref['id']}: {exc}"
)
self.add_error(orig_docref)
except Exception as exc:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised ruff didn't flag this - do you have the generic exception rule turned off? I think it's fine, i was just expecting a manual comment to disable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think our ruff config flags generic exceptions - I just confirmed it will flag bare excepts though (except:). I like that balance - I personally feel like generic exceptions have a undeserved reputation as a problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ok - yeah i guess i buy that as 'I am explicitly stating my intent here'.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bare excepts also have the problem of catching BaseExceptions like SystemExit and KeyboardInterrupt, which usually you don't want to intercept.

But often linting tools don't like the generic version either for some programming purity reasons like "you should know what you're catching". But in the real world, you so often just want to say "hey I don't care what happened, I want to handle it and log it".

This commit adds support for dual-resource tasks and then adds
DiagnosticReport to the NLP base task class.

This required some vocabulary alignment, as we used "docref" a lot
in places that now can take a docref or a dxreport.
- "note" or "note resource": a DocRef or DxReport resource (dict)
- "note text" or "text": the clinical text inside the note
@mikix mikix force-pushed the mikix/nlp-dxreports branch from a261f10 to 5160616 Compare August 20, 2025 18:43
@mikix mikix merged commit 03929c6 into main Aug 20, 2025
3 checks passed
@mikix mikix deleted the mikix/nlp-dxreports branch August 20, 2025 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants