NOAA-OWP / DMOD

Distributed Model on Demand infrastructure for OWP's Model as a Service
Other
7 stars 15 forks source link

Implement Evaluation Configuration Variables/Expressions #313

Open christophertubbs opened 1 year ago

christophertubbs commented 1 year ago

The configuration for an element for an evaluation might look like:

"backend": {
                "backend_type": "rest",
                "data_format": "json",
                "address": "https://nwis.waterservices.usgs.gov/nwis/iv",
                "params": {
                    "format": "json",
                    "indent": "on",
                    "sites": "0214657975,0214655255",
                    "startDT": "2022-12-01T00:00%2b0000",
                    "endDT": "2022-12-31T00:00%2b0000",
                    "parameterCd": "00060"
                }
            }

It would be useful to insert variables so that the same configuration may be used multiple times as conditions and needs change. The above configuration my look like the following with variable functionality:

"backend": {
                "backend_type": "rest",
                "data_format": "json",
                "address": "https://nwis.waterservices.usgs.gov/nwis/iv",
                "params": {
                    "format": "json",
                    "indent": "on",
                    "sites": "0214657975,0214655255",
                    "startDT": "{{ NOW - timedelta(hours=48) }}",
                    "endDT": "{{ NOW }}",
                    "parameterCd": "00060"
                }
            }

Another example could be:

"backend": {
                "backend_type": "file",
                "data_format": "rdb",
                "address": "{{ THRESHOLD_DIRECTORY }}/nwis_stat_thresholds.rdb"
            }

instead of

"backend": {
                "backend_type": "file",
                "data_format": "rdb",
                "address": "path/to/nwis_stat_thresholds.rdb"
            }

Steps:

This may be considered as done when a configuration may include strings such as "{{ NOW }} " or " {{ CONSTANT }}/path/to/whatever" may be used, are fully documented, and are have a good deal of unit tests.

robertbartel commented 6 months ago

Marking as Blocked to flag the issue, as I think this may have been completed.

robertbartel commented 2 months ago

FYI @christophertubbs, with this now being broken down nicely into subtasks, I've added the epic tag. That will keep it from being visible where it was previously in the project board, but you can still find it in the BL Multi-Task Issues view.