Skip to content

Emergency Units

eds-scikit provides a function to tag care sites as being medical emergency units. It also provides a higher-level function to directly tag visits.

from eds_scikit.io import HiveData
data = HiveData(DBNAME)

Tagging care sites

Tagging is done using the tag_emergency_care_site function:

from eds_scikit.emergency import tag_emergency_care_site

Tag care sites that correspond to medical emergency units.

The tagging is done by adding a "IS_EMERGENCY" column to the provided DataFrame.

Some algos can add an additional "EMERGENCY_TYPE" column to the provided DataFrame, providing a more detailled classification.

PARAMETER DESCRIPTION
care_site

TYPE: DataFrame

algo

Possible values are:

  • "from_mapping" relies on a list of care_site_source_value extracted by Judith LEBLANC, Ariel COHEN and validated by an ER doctor. The emergency care sites are here further labelled to distinguish the different types of emergency
  • "from_regex_on_care_site_description": relies on a specific list of RegEx applied on the description (= simplified care site name) of each care site.
  • "from_regex_on_parent_UF": relies on a specific list of regular expressions applied on the description (= simplified care site name) of each UF (Unité Fonctionnelle). The obtained tag is then propagated to every UF's children.

TYPE: str DEFAULT: 'from_mapping'

RETURNS DESCRIPTION
care_site

Dataframe with 1 to 2 added columns corresponding to the following concepts:

  • "IS_EMERGENCY"
  • "EMERGENCY_TYPE" (if using algo "from_mapping")

TYPE: DataFrame

Simply call the function by providing the necessary data (see below) and by picking the algo

care_site = tag_emergency_care_site(
    care_site=data.care_site,
    algo="from_mapping",
)

Availables algorithms (values for "algo")

This algo uses a labelled list of 201 emergency care sites.

Those care sites were extracted and verified by Ariel COHEN, Judith LEBLANC, and an ER doctor validated them.

Those emergency care sites are further divised into different categories, as defined in the concept 'EMERGENCY_TYPE'. The different categories are:

  • Urgences spécialisées
  • UHCD + Post-urgences
  • Urgences pédiatriques
  • Urgences générales adulte
  • Consultation urgences
  • SAMU / SMUR

See the dataset here

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_source_value column

TYPE: DataFrame

version

Optional version string for the mapping

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
care_site

Dataframe with 2 added columns corresponding to the following concepts:

  • "IS_EMERGENCY"
  • "EMERGENCY_TYPE"

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

Use regular expressions on parent UF (Unité Fonctionnelle) to classify emergency care site.

This relies on this function. The regular expression used to detect emergency status is r"URG|SAU|UHCD|ZHTCD"

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_name column

TYPE: DataFrame

RETURNS DESCRIPTION
care_site

Dataframe with 1 added column corresponding to the following concept:

  • 'IS_EMERGENCY'

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

Use regular expressions on care_site_name to decide if it an emergency care site.

This relies on this function. The regular expression used to detect emergency status is r"URG|SAU|UHCDb|ZHTCD"

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_name column

TYPE: DataFrame

RETURNS DESCRIPTION
care_site

Dataframe with 1 added column corresponding to the following concept:

  • "IS_EMERGENCY"

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

Tagging visits

Tagging is done using the tag_emergency_visit function:

from eds_scikit.emergency import tag_emergency_visit

Tag visits that correspond to medical emergency units.

The tagging is done by adding a "IS_EMERGENCY" column to the provided DataFrame.

Some algos can add an additional "EMERGENCY_TYPE" column to the provided DataFrame, providing a more detailled classification.

It works by either tagging each visit detail's care site, or by using the visit_occurrence's "visit_source_value".

PARAMETER DESCRIPTION
visit_detail

TYPE: DataFrame

care_site

Isn't necessary if the algo "from_vo_visit_source_value" is used

TYPE: Optional[DataFrame] DEFAULT: None

visit_occurrence

Is mandatory if the algo "from_vo_visit_source_value" is used

TYPE: Optional[DataFrame] DEFAULT: None

algo

Possible values are:

  • "from_mapping" relies on a list of care_site_source_value extracted by Judith LEBLANC, Ariel COHEN and validated by an ER doctor. The emergency care sites are here further labelled to distinguish the different types of emergency
  • "from_regex_on_care_site_description": relies on a specific list of RegEx applied on the description (= simplified care site name) of each care site.
  • "from_regex_on_parent_UF": relies on a specific list of regular expressions applied on the description (= simplified care site name) of each UF (Unité Fonctionnelle). The obtained tag is then propagated to every UF's children.
  • "from_vo_visit_source_value": relies on the parent visit occurrence of each visit detail: A visit detail will be tagged as emergency if it belongs to a visit occurrence where visit_occurrence.visit_source_value=='urgence'.

TYPE: str DEFAULT: 'from_mapping'

RETURNS DESCRIPTION
care_site

Dataframe with 1 to 2 added columns corresponding to the following concepts:

  • "IS_EMERGENCY"
  • "EMERGENCY_TYPE" (if using algo "from_mapping")

TYPE: DataFrame

Simply call the function by providing the necessary data (see below) and by picking the algo

visit_detail = tag_emergency_visit(
    visit_detail=data.visit_detail,
    algo="from_mapping",
)

Availables algorithms (values for "algo")

This algo uses a labelled list of 201 emergency care sites.

Those care sites were extracted and verified by Ariel COHEN, Judith LEBLANC, and an ER doctor validated them.

Those emergency care sites are further divised into different categories, as defined in the concept 'EMERGENCY_TYPE'. The different categories are:

  • Urgences spécialisées
  • UHCD + Post-urgences
  • Urgences pédiatriques
  • Urgences générales adulte
  • Consultation urgences
  • SAMU / SMUR

See the dataset here

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_source_value column

TYPE: DataFrame

version

Optional version string for the mapping

TYPE: Optional[str] DEFAULT: None

RETURNS DESCRIPTION
care_site

Dataframe with 2 added columns corresponding to the following concepts:

  • "IS_EMERGENCY"
  • "EMERGENCY_TYPE"

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

Use regular expressions on parent UF (Unité Fonctionnelle) to classify emergency care site.

This relies on this function. The regular expression used to detect emergency status is r"URG|SAU|UHCD|ZHTCD"

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_name column

TYPE: DataFrame

RETURNS DESCRIPTION
care_site

Dataframe with 1 added column corresponding to the following concept:

  • 'IS_EMERGENCY'

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

Use regular expressions on care_site_name to decide if it an emergency care site.

This relies on this function. The regular expression used to detect emergency status is r"URG|SAU|UHCDb|ZHTCD"

PARAMETER DESCRIPTION
care_site

Should at least contains the care_site_name column

TYPE: DataFrame

RETURNS DESCRIPTION
care_site

Dataframe with 1 added column corresponding to the following concept:

  • "IS_EMERGENCY"

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_care_site.py

This algo uses the "Type de dossier" of each visit detail's parent visit occurrence. Thus, a visit_detail will be tagged with IS_EMERGENCY=True iff the visit occurrence it belongs to is an emergency-type visit (meaning that visit_occurrence.visit_source_value=='urgence')

Admission through ICU

At AP-HP, when a patient is hospitalized after coming to the ICU, its visit_source_value is set from "urgence" to "hospitalisation complète". So you should keep in mind that this method doesn't tag those visits as ICU.

PARAMETER DESCRIPTION
visit_detail

TYPE: DataFrame

visit_occurrence

TYPE: DataFrame

RETURNS DESCRIPTION
visit_detail

Dataframe with added columns corresponding to the following conceps:

  • "IS_EMERGENCY"

TYPE: DataFrame

Source code in eds_scikit/emergency/emergency_visit.py
Back to top