reichlab / forecast-repository

Codebase for Zoltar forecast repository
https://zoltardata.com/
GNU General Public License v3.0
6 stars 3 forks source link

Uploading a forecast version from API gets "A forecast already exists for time_zero" error #289

Closed matthewcornell closed 3 years ago

matthewcornell commented 3 years ago

Instead, the code should check the Forecast model key ('forecast_model', 'time_zero', 'issue_date') and fail only if there's a conflict. A complication: This check must be done in the database instead of the web worker due to possible timing issues. (The database determines the issue_date upon creation, which may be different from what might be calculated in the web worker. Consider the midnight problem, for example.) Thus, we must first try to create the candidate Forecast in the web worker and, if successful, pass the new forecast's ID to the worker.