Skip to content

Utils

This module contains some minor utility functions.

Overview

This module contains some very minimal utility functions.

setup()

Setup the data directory.

Source code in src/opendata_pipeline/utils.py
11
12
13
14
def setup():
    """Setup the data directory."""
    console.log("Setting up data directory...")
    Path("data").mkdir(exist_ok=True)

teardown()

Remove the data directory and all of its files. Remove extracted drugs file.

Source code in src/opendata_pipeline/utils.py
17
18
19
20
21
22
def teardown():
    """Remove the data directory and all of its files. Remove extracted drugs file."""
    console.log("Tearing down data directory...")
    p = Path("data")
    shutil.rmtree(p)
    Path("extracted_drugs.jsonl").unlink()