Skip to content

process_aki_stages

pyaki CLI tool to process AKI stages from time series data.

main(path, urineoutput_file='urineoutput.csv', creatinine_file='creatinine.csv', rrt_file='rrt.csv', demographics_file='demographics.csv')

CLI tool to process AKI stages from time series data.

CLI tool to process AKI stages from time series data. The tool expects the following files to be present in the given path: urineoutput.csv, creatinine.csv, rrt.csv, demographics.csv.

Parameters:

Name Type Description Default
path str

Path to the folder containing the data files.

required
urineoutput_file str

Name of the file containing urine output data.

"urineoutput.csv"
creatinine_file str

name of the file containing creatinine data.

"creatinine.csv"
rrt_file str

Name of the file containing rrt data.

"rrt.csv"
demographics_file str

Name of the file containing demographic data of the patient like the patients weight.

"demographics.csv"
Source code in pyaki/bin/process_aki_stages.py
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
def main(
    path: str,
    urineoutput_file: str = "urineoutput.csv",
    creatinine_file: str = "creatinine.csv",
    rrt_file: str = "rrt.csv",
    demographics_file: str = "demographics.csv",
) -> None:
    """
    CLI tool to process AKI stages from time series data.

    CLI tool to process AKI stages from time series data. The tool expects
    the following files to be present in the given path: urineoutput.csv, creatinine.csv, rrt.csv, demographics.csv.

    Parameters
    ----------
    path : str
        Path to the folder containing the data files.
    urineoutput_file : str, default: "urineoutput.csv"
        Name of the file containing urine output data.
    creatinine_file : str, default: "creatinine.csv"
        name of the file containing creatinine data.
    rrt_file : str, default: "rrt.csv"
        Name of the file containing rrt data.
    demographics_file : str, default: "demographics.csv"
        Name of the file containing demographic data of the patient like the patients weight.
    """
    root_dir = Path(path)
    datasets = []

    if (ou_file := root_dir / urineoutput_file).is_file():
        datasets.append(Dataset(DatasetType.URINEOUTPUT, pd.read_csv(ou_file)))

    if (scr_file := root_dir / creatinine_file).is_file():
        datasets.append(Dataset(DatasetType.CREATININE, pd.read_csv(scr_file)))

    if (_rrt_file := root_dir / rrt_file).is_file():
        datasets.append(Dataset(DatasetType.RRT, pd.read_csv(_rrt_file)))

    if (demo_file := root_dir / demographics_file).is_file():
        datasets.append(Dataset(DatasetType.DEMOGRAPHICS, pd.read_csv(demo_file)))

    ana: Analyser = Analyser(datasets)
    ana.process_stays().to_csv(root_dir / "aki.csv")

run()

Run the CLI tool

Source code in pyaki/bin/process_aki_stages.py
58
59
60
def run() -> None:
    """Run the CLI tool"""
    typer.run(main)