Python interface

This document describes the design of the Python functions forming the CLI and the library layer, as well as tracking implementation status.

We use symbols to indicate the status of implementation (see table below). For planned or in-progress work, we might include signatures, docstrings, and pseudocode to clarify the design. Once the interface is implemented, these are replaced by links to the reference documentation.

A table showing the symbols used to indicate the status of interface components, along with their descriptions.
Status Description

Interface that has been implemented.

Interface that is currently being worked on.

Interface that is planned, but isn’t being worked on currently.

CLI functions

extract_metadata()

extract_metadata() has two arguments: parquet_path and output_path. The parquet_path argument is the path to a Parquet file in, e.g. the staging/ directory, and the output_path argument is the path to the Python script that will have the ResourceProperties() dataclass filled in with the extracted metadata.

flowchart
    parquet[/"Parquet data<br>[PARQUET-PATH]"/]
    read_parquet["read_parquet()"]
    output_opt["Output path<br>[--output]"]
    output[/"Python script<br>[File]"/]
    data[("DataFrame<br>(Tidy)")]
    extract_resource_metadata("extract_resource_metadata()")
    metadata[("ResourceProperties<br>(extracted)")]

    parquet --> read_parquet
    read_parquet --> data
    data --> extract_resource_metadata
    extract_resource_metadata --> metadata
    output_opt --> write_metadata["write_resource_metadata()"]
    metadata --> write_metadata
    write_metadata --> output
Figure 1: Diagram showing the flow of objects and functions to extract a resource’s metadata from data.