hubverse-org / hubverse-transform

Data transform functions for hubverse model-output files
MIT License
0 stars 0 forks source link

Bsweger/get task id values #22

Closed bsweger closed 1 hour ago

bsweger commented 1 week ago

Next piece of the work for #14

Here we're adding a new function that inspects a hub's tasks.json and returns a dictionary of task_ids and their possible values. This is information we'll need to determine the schema of the model_output file.

Next step: Do the same thing, except for output_type_ids, which are configured a bit differently

Here's what it looks like in action:

In [1]: from cloudpathlib import AnyPath

In [2]: from hubverse_transform.hub_config import HubConfig

In [3]: hub_path = AnyPath('s3://bsweger-flusight-forecast')

In [4]: hc = HubConfig(hub_path)

In [5]: task_id_values = hc.get_task_id_values()

In [6]: task_id_values.keys()
Out[6]: dict_keys(['reference_date', 'target', 'horizon', 'location', 'target_end_date'])

In [7]: task_id_values['horizon']
Out[7]: {-1, 0, 1, 2, 3}

In [8]: task_id_values['target']
Out[8]: {'wk flu hosp rate change', 'wk inc flu hosp'}