Consultation dates
When a patient comes multiple times for consultations, it is often represented as a single visit_occurrence
in the CDW. If a clear history of a patient's course is needed, it is then necessary to use proxies in order to access this information. An available proxy to get those consultation dates is to check for the existence of consultation reports and use the associated reports dates.
To this extend, two methods are available. They can be combined or used separately:
- Use the
note_datetime
field associated to each consultation report - Extract the consultation report date by using NLP
An important remark
Be careful when using the note_datetime
field as it can represent the date of modification of a document (i.e. it can be modified if the clinician adds some information in it in the future).
from eds_scikit.io import HiveData
data = HiveData(DBNAME)
from eds_scikit.event import get_consultation_dates
get_consultation_dates(
data.visit_occurrence,
note=data.note,
note_nlp=note_nlp,
algo=["nlp"],
)
The snippet above required us to generate a note_nlp
with a consultation_date
column (see below for more informations).
Consultation pipe
A consultation date pipeline exists and is particulary suited for this task. Moreover, methods are available to run an EDS-NLP pipeline on a Pandas, Spark or even Koalas DataFrame !
We can check the various exposed parameters if needed:
Extract consultation dates. See the implementation details of the algo(s) you want to use
PARAMETER | DESCRIPTION |
---|---|
vo |
TYPE:
|
note |
TYPE:
|
note_nlp |
TYPE:
|
algo |
Algorithm(s) to use to determine consultation dates. Multiple algorithms can be provided as a list. Accepted values are:
TYPE:
|
max_timedelta |
If two extracted consultations are spaced by less than
TYPE:
|
structured_config |
A dictionnary of parameters when using the
TYPE:
|
nlp_config |
A dictionnary of parameters when using the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
DataFrame
|
Event type DataFrame with the following columns:
|
Availables algorithms (values for "algo"
)
Uses consultation dates extracted a priori in consultation reports to infer true consultation dates
PARAMETER | DESCRIPTION |
---|---|
note_nlp |
A DataFrame with (at least) the following columns:
TYPE:
|
dates_to_keep |
How to handle multiple consultation dates found in the document:
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dataframe
|
With 2 added columns corresponding to the following concept:
|
Uses note_datetime
value to infer true consultation dates
PARAMETER | DESCRIPTION |
---|---|
note |
A
TYPE:
|
vo |
A visit_occurrence DataFrame to provide if
TYPE:
|
kept_note_class_source_value |
Value(s) allowed for the
TYPE:
|
kept_visit_source_value |
Value(s) allowed for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Dataframe
|
With 2 added columns corresponding to the following concept:
|