hubverse-org / hubverse-transform

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

Bsweger/get task id values #22

Closed bsweger closed 5 months ago

bsweger commented 5 months 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'}