Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding possibility to select cim10 and atc in eds.cim10 and eds.drugs #314

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

- Numbers are now only detected without trying to remove the pollution in between digits, ie `55 @ 77777` could be detected as a full number before, but not anymore.

### Changed

- Rename `eds.measurements` to `eds.quantities`

## v0.13.0

### Added
Expand Down
4 changes: 2 additions & 2 deletions demo/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"Drugs": "drugs",
"CIM10": "cim10",
"Dates": "dates",
"Measurements": "measurements",
"Quantities": "quantities",
"Charlson": "charlson",
"SOFA": "sofa",
"Elston & Ellis": "elston_ellis",
Expand Down Expand Up @@ -220,7 +220,7 @@ def load_model(custom_regex: str, **enabled):

doc = nlp(text)
doc.ents = filter_spans(
(*doc.ents, *doc.spans.get("dates", []), *doc.spans.get("measurements", []))
(*doc.ents, *doc.spans.get("dates", []), *doc.spans.get("quantities", []))
)

st.header("Visualisation")
Expand Down
2 changes: 1 addition & 1 deletion docs/pipes/misc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For instance, the date detection and normalisation pipeline falls in this catego
|--------------------------|---------------------------------------------|
| `eds.dates` | Date extraction and normalisation |
| `eds.consultation_dates` | Identify consultation dates |
| `eds.measurements` | Measure extraction and normalisation |
| `eds.quantities` | Quantity extraction and normalisation |
| `eds.sections` | Section detection |
| `eds.reason` | Rule-based hospitalisation reason detection |
| `eds.tables` | Tables detection |
Expand Down
8 changes: 0 additions & 8 deletions docs/pipes/misc/measurements.md

This file was deleted.

8 changes: 8 additions & 0 deletions docs/pipes/misc/quantities.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Quantities {: #edsnlp.pipes.misc.quantities.factory.create_component }

::: edsnlp.pipes.misc.quantities.factory.create_component
options:
heading_level: 2
show_bases: false
show_source: false
only_class_level: true
2 changes: 1 addition & 1 deletion docs/pipes/ner/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

We provide several Named Entity Recognition (NER) components.
Named Entity Recognition is the task of identifying short relevant spans of text, named entities, and classifying them into pre-defined categories.
In the case of clinical documents, these entities can be scores, disorders, behaviors, codes, dates, measurements, etc.
In the case of clinical documents, these entities can be scores, disorders, behaviors, codes, dates, quantities, etc.

## Span setters: where are stored extracted entities ? {: #edsnlp.pipes.base.SpanSetterArg }

Expand Down
2 changes: 1 addition & 1 deletion edsnlp/pipes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .core.terminology.factory import create_component as terminology
from .misc.consultation_dates.factory import create_component as consultation_dates
from .misc.dates.factory import create_component as dates
from .misc.measurements.factory import create_component as measurements
from .misc.quantities.factory import create_component as quantities
from .misc.reason.factory import create_component as reason
from .misc.sections.factory import create_component as sections
from .misc.tables.factory import create_component as tables
Expand Down
4 changes: 0 additions & 4 deletions edsnlp/pipes/misc/measurements/__init__.py

This file was deleted.

4 changes: 4 additions & 0 deletions edsnlp/pipes/misc/quantities/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from edsnlp.pipes.misc.quantities.quantities import QuantitiesMatcher
from edsnlp.pipes.misc.quantities.patterns import *

from . import factory
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from edsnlp.core import registry

from . import patterns
from .measurements import MeasurementsMatcher
from .quantities import QuantitiesMatcher

DEFAULT_CONFIG = dict(
measurements=list(patterns.common_measurements.keys()), # noqa: E501
quantities=list(patterns.common_quantities.keys()), # noqa: E501
units_config=patterns.units_config,
number_terms=patterns.number_terms,
number_regex=patterns.number_regex,
Expand All @@ -24,7 +24,7 @@
)

create_component = registry.factory.register(
"eds.measurements",
"eds.quantities",
assigns=["doc.spans", "doc.ents"],
deprecated=["eds.measures"],
)(MeasurementsMatcher)
deprecated=["eds.measures", "eds.measurements"],
)(QuantitiesMatcher)
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
)?"""


common_measurements = {
common_quantities = {
"weight": {
"unit": "kg",
"unitless_patterns": [
Expand Down
Loading
Loading