@@ -48,7 +48,7 @@ def post(self, *args):
4848 requests to this endpoint without a trailing slash will
4949 result in a redirect response.
5050 requestBody:
51- desctiption: JSON representation of an observation .
51+ desctiption: JSON representation of a forecast .
5252 required: True
5353 content:
5454 application/json:
@@ -150,9 +150,7 @@ def get(self, forecast_id, *args):
150150 content:
151151 applciation/json:
152152 schema:
153- type: array
154- items:
155- $ref: '#/components/schemas/ForecastValue'
153+ $ref: '#/components/schemas/ForecastValues'
156154 text/csv:
157155 schema:
158156 type: string
@@ -218,7 +216,7 @@ def post(self, forecast_id, *args):
218216 content:
219217 application/json:
220218 schema:
221- $ref: '#/components/schemas/ForecastValues '
219+ $ref: '#/components/schemas/ForecastValuesPost '
222220 text/csv:
223221 schema:
224222 type: string
@@ -231,9 +229,9 @@ def post(self, forecast_id, *args):
231229 quality_flag may be 0 or 1 (indicating the value is not
232230 to be trusted).
233231 example: |-
234- timestamp,value,quality_flag
235- 2018-10-29T12:00:00Z,32.93,0
236- 2018-10-29T13:00:00Z,25.17,0
232+ timestamp,value
233+ 2018-10-29T12:00:00Z,32.93
234+ 2018-10-29T13:00:00Z,25.17
237235 responses:
238236 201:
239237 $ref: '#/components/responses/201-Created'
@@ -328,6 +326,183 @@ def get(self, forecast_id, *args):
328326 return jsonify (ForecastSchema ().dump (forecast ))
329327
330328
329+ class AllCDFForecastGroupsView (MethodView ):
330+ def get (self , args ):
331+ """
332+ ---
333+ summary: List Probabilistic Forecasts groups.
334+ description: List all probabilistic forecasts a user has access to.
335+ tags:
336+ - Probabilistic Forecasts
337+ responses:
338+ 200:
339+ description: A list of probabilistic forecasts
340+ content:
341+ application/json:
342+ schema:
343+ type: array
344+ items:
345+ $ref: '#/components/schemas/CDFForecastGroupMetadata'
346+ 401:
347+ $ref: '#/components/responses/401-Unauthorized'
348+ 404:
349+ $ref: '#/components/responses/404-NotFound'
350+ """
351+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
352+
353+ def post (self , * args ):
354+ """
355+ ---
356+ summary: Create Probabilistic Forecast group.
357+ tags:
358+ - Probabilistic Forecasts
359+ description: >-
360+ Create a new Probabilistic Forecast by posting metadata.
361+ Note that POST requests to this endpoint without a trailing
362+ slash will result in a redirect response.
363+ requestBody:
364+ desctiption: JSON representation of a probabilistic forecast.
365+ required: True
366+ content:
367+ application/json:
368+ schema:
369+ $ref: '#/components/schemas/CDFForecastGroupDefinition'
370+ responses:
371+ 201:
372+ description: Probabilistic forecast created successfully
373+ content:
374+ application/json:
375+ schema:
376+ $ref: '#/components/schemas/CDFForecastGroupMetadata'
377+ 400:
378+ $ref: '#/components/responses/400-BadRequest'
379+ 401:
380+ $ref: '#/components/responses/401-Unauthorized'
381+
382+ """
383+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
384+
385+
386+ class CDFForecastGroupMetadataView (MethodView ):
387+ def get (self , forecast_id , * args ):
388+ """
389+ ---
390+ summary: Get Probabilistic Forecast group Metadata.
391+ tags:
392+ - Probabilistic Forecasts
393+ parameters:
394+ - $ref: '#/components/parameters/forecast_id'
395+ responses:
396+ 200:
397+ description: Successfully retrieved Forecasts.
398+ content:
399+ application/json:
400+ schema:
401+ type: array
402+ items:
403+ $ref: '#/components/schemas/CDFForecastGroupMetadata'
404+ 401:
405+ $ref: '#/components/responses/401-Unauthorized'
406+ 404:
407+ $ref: '#/components/responses/404-NotFound'
408+ """
409+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
410+
411+
412+ class CDFForecastMetadata (MethodView ):
413+ def get (self , forecast_id ):
414+ """
415+ ---
416+ summary: Get Metadata for one Probabilistic Forecast constant value.
417+ tags:
418+ - Probabilistic Forecasts
419+ parameters:
420+ - $ref: '#/components/parameters/forecast_id'
421+ responses:
422+ 200:
423+ description: Successfully retrieved Forecast CDF metadata.
424+ content:
425+ application/json:
426+ schema:
427+ type: array
428+ items:
429+ $ref: '#/components/schemas/CDFForecastMetadata'
430+ 401:
431+ $ref: '#/components/responses/401-Unauthorized'
432+ 404:
433+ $ref: '#/components/responses/404-NotFound'
434+ """
435+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
436+
437+
438+ class CDFForecastValues (MethodView ):
439+ def get (self , forecast_id ):
440+ """
441+ ---
442+ summary: Get Probabilistic Forecast data for one constant value.
443+ tags:
444+ - Probabilistic Forecasts
445+ responses:
446+ 200:
447+ content:
448+ applciation/json:
449+ schema:
450+ items:
451+ $ref: '#/components/schemas/ForecastValues'
452+ text/csv:
453+ schema:
454+ type: string
455+ example: |-
456+ timestamp,value
457+ 2018-10-29T12:00:00Z,32.93
458+ 2018-10-29T13:00:00Z,25.17
459+ 401:
460+ $ref: '#/components/responses/401-Unauthorized'
461+ 404:
462+ $ref: '#/components/responses/404-NotFound'
463+ """
464+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
465+
466+ def post (self , forecast_id ):
467+ """
468+ ---
469+ summary: Add Probabilistic Forecast data for one constant value.
470+ description: >-
471+ Add timeseries values to a Probabilistic Forecast constant value.
472+ tags:
473+ - Probabilistic Forecasts
474+ parameters:
475+ - $ref: '#/components/parameters/forecast_id'
476+ requestBody:
477+ required: True
478+ content:
479+ application/json:
480+ schema:
481+ $ref: '#/components/schemas/ForecastValuesPost'
482+ text/csv:
483+ schema:
484+ type: string
485+ description: |
486+ Text file with fields separated by ',' and
487+ lines separated by '\\ n'. The first line must
488+ be a header with the following fields: timestamp,
489+ value. Timestamp must be an ISO 8601 datetime and
490+ value may be an integer or floatquality_flag.
491+ example: |-
492+ timestamp,value
493+ 2018-10-29T12:00:00Z,32.93
494+ 2018-10-29T13:00:00Z,25.17
495+ responses:
496+ 201:
497+ $ref: '#/components/responses/201-Created'
498+ 401:
499+ $ref: '#/components/responses/401-Unauthorized'
500+ 404:
501+ $ref: '#/components/responses/404-NotFound'
502+ """
503+ return jsonify ({'errors' : {'error' : ['Not Implemented' ]}})
504+
505+
331506spec .components .parameter (
332507 'forecast_id' , 'path' ,
333508 {
@@ -342,10 +517,28 @@ def get(self, forecast_id, *args):
342517forecast_blp = Blueprint (
343518 'forecasts' , 'forecasts' , url_prefix = "/forecasts" ,
344519)
345- forecast_blp .add_url_rule ('/' , view_func = AllForecastsView .as_view ('all' ))
346- forecast_blp .add_url_rule ('/<forecast_id>' ,
347- view_func = ForecastView .as_view ('single' ))
348- forecast_blp .add_url_rule ('/<forecast_id>/values' ,
349- view_func = ForecastValuesView .as_view ('values' ))
350- forecast_blp .add_url_rule ('/<forecast_id>/metadata' ,
351- view_func = ForecastMetadataView .as_view ('metadata' ))
520+ forecast_blp .add_url_rule (
521+ '/single/' ,
522+ view_func = AllForecastsView .as_view ('all' ))
523+ forecast_blp .add_url_rule (
524+ '/single/<forecast_id>' ,
525+ view_func = ForecastView .as_view ('single' ))
526+ forecast_blp .add_url_rule (
527+ '/single/<forecast_id>/values' ,
528+ view_func = ForecastValuesView .as_view ('values' ))
529+ forecast_blp .add_url_rule (
530+ '/single/<forecast_id>/metadata' ,
531+ view_func = ForecastMetadataView .as_view ('metadata' ))
532+
533+ forecast_blp .add_url_rule (
534+ '/cdf/' ,
535+ view_func = AllCDFForecastGroupsView .as_view ('all_cdf_groups' ))
536+ forecast_blp .add_url_rule (
537+ '/cdf/<forecast_id>' ,
538+ view_func = CDFForecastGroupMetadataView .as_view ('single_cdf_group' ))
539+ forecast_blp .add_url_rule (
540+ '/cdf/single/<forecast_id>' ,
541+ view_func = CDFForecastMetadata .as_view ('single_cdf_metadata' ))
542+ forecast_blp .add_url_rule (
543+ '/cdf/single/<forecast_id>/values' ,
544+ view_func = CDFForecastValues .as_view ('single_cdf_value' ))
0 commit comments