148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
@concept_checker(concepts=["IS_EMERGENCY"])
def from_regex_on_parent_UF(care_site: DataFrame) -> DataFrame:
    """Use regular expressions on parent UF (Unité Fonctionnelle) to classify emergency care site.

    This relies on [this function][eds_scikit.structures.attributes.get_parent_attributes].
    The regular expression used to detect emergency status is `r"\bURG|\bSAU\b|\bUHCD\b|\bZHTCD\b"`

    Parameters
    ----------
    care_site: DataFrame
        Should at least contains the `care_site_name` column

    Returns
    -------
    care_site: DataFrame
        Dataframe with 1 added column corresponding to the following concept:

        - 'IS_EMERGENCY'
    """
    return attributes.get_parent_attributes(
        care_site,
        only_attributes=["IS_EMERGENCY"],
        parent_type="Unité Fonctionnelle (UF)",
    )