Skip to content

eds_scikit.datasets.generation_scripts.care_site_hierarchy

generate_care_site_hierarchy

generate_care_site_hierarchy(care_site: framework.DataFrame, fact_relationship: framework.DataFrame, care_site_categories: List[str]) -> None

Generate the care site hierarchy dataset.

PARAMETER DESCRIPTION
care_site

The care_site DataFrame

TYPE: framework.DataFrame

fact_relationship

The fact_relationship DataFrame

TYPE: framework.DataFrame

care_site_categories

A list of care_site_type_source_value to use as categories

TYPE: List[str]

Source code in eds_scikit/datasets/generation_scripts/care_site_hierarchy.py
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def generate_care_site_hierarchy(
    care_site: framework.DataFrame,
    fact_relationship: framework.DataFrame,
    care_site_categories: List[str],
) -> None:  # pragma: no cover
    """
    Generate the care site hierarchy dataset.

    Parameters
    ----------
    care_site : framework.DataFrame
        The `care_site` DataFrame
    fact_relationship : framework.DataFrame
        The `fact_relationship` DataFrame
    care_site_categories : List[str]
        A list of `care_site_type_source_value` to use as categories
    """

    care_site = _load_care_site_categories(care_site, care_site_categories)
    relationships = _load_care_site_relationships(fact_relationship)

    care_site = _simplify_care_site_categories(care_site, relationships)
    care_site_hierarchy = hierarchy.build_hierarchy(care_site, relationships)
    care_site_hierarchy = _simplify_care_site_hierarchy(care_site_hierarchy)
    _save_care_site_hierarchy(care_site_hierarchy, DATASET_FOLDER)
Back to top