45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
@concept_checker(concepts=["IS_ICU"])
def from_authorisation_type(care_site: DataFrame) -> DataFrame:
    """This algo uses the `care_site.place_of_service_source_value` columns
    to retrieve Intensive Care Units.

    The following values are used to tag a care site as ICU:

    - `"REA PED"`
    - `"REA"`
    - `"REA ADULTE"`
    - `"REA NEONAT"`
    - `"USI"`
    - `"USI ADULTE"`
    - `"USI NEONAT"`
    - `"SC PED"`
    - `"SC"`
    - `"SC ADULTE"`

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

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

        - `"IS_ICU"`

    """

    icu_units = set(
        [
            "REA PED",
            "USI",
            "SC PED",
            "SC",
            "REA",
            "SC ADULTE",
            "USI ADULTE",
            "REA ADULTE",
            "USI NEONAT",
            "REA NEONAT",
        ]
    )

    care_site["IS_ICU"] = care_site["place_of_service_source_value"].isin(icu_units)

    return care_site