Skip to content

eds_scikit.datasets.synthetic.visit_merging

load_visit_merging

load_visit_merging()

Create a minimalistic dataset for the visit_merging function.

RETURNS DESCRIPTION
visit_dataset

TYPE: VisitDataset, a dataclass comprised of

visit_occurence.
Source code in eds_scikit/datasets/synthetic/visit_merging.py
11
12
13
14
15
16
17
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
def load_visit_merging():
    """
    Create a minimalistic dataset for the `visit_merging` function.

    Returns
    -------
    visit_dataset : VisitDataset, a dataclass comprised of
    visit_occurence.
    """
    visit_occurrence = pd.DataFrame(
        {
            "visit_occurrence_id": ["A", "B", "C", "D", "E", "F", "G"],
            "person_id": ["999"] * 7,
            "visit_start_datetime": [
                "2021-01-01",
                "2021-01-04",
                "2021-01-12",
                "2021-01-13",
                "2021-01-19",
                "2021-01-25",
                "2017-01-01",
            ],
            "visit_end_datetime": [
                "2021-01-05",
                "2021-01-08",
                "2021-01-18",
                "2021-01-14",
                "2021-01-21",
                "2021-01-27",
                None,
            ],
            "visit_source_value": [
                "hospitalisés",
                "hospitalisés",
                "hospitalisés",
                "urgence",
                "hospitalisés",
                "hospitalisés",
                "hospitalisés",
            ],
            "row_status_source_value": [
                "supprimé",
                "courant",
                "courant",
                "courant",
                "courant",
                "courant",
                "courant",
            ],
            "care_site_id": ["1", "1", "1", "1", "2", "1", "1"],
        }
    )

    for col in ["visit_start_datetime", "visit_end_datetime"]:
        visit_occurrence[col] = pd.to_datetime(visit_occurrence[col])

    return VisitDataset(visit_occurrence=visit_occurrence)
Back to top