-
Notifications
You must be signed in to change notification settings - Fork 0
/
flow-forecast.openapi.yml
167 lines (164 loc) · 6.01 KB
/
flow-forecast.openapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
openapi: 3.0.0
info:
title: Flow Forecast API
description: A web service that provides forecasted flow rates for USGS gauge sites.
version: 1.0.0
servers:
- url: http://127.0.0.1:8000 # change port to 3000 if running in Docker container
description: Local development server
# - url: https://my-qa-server.com
# description: QA/Staging server
# - url: https://my-production-server.com
# description: Production server
paths:
/usgs/forecast:
get:
summary: Get flow forecast data for a specific site
description: Retrieve past values and forecasted flow data for a site specified by the `site_id`.
parameters:
- name: site_id
in: query
required: true
description: The ID of the site to retrieve flow forecast data for.
schema:
type: string
example: "09359500"
- name: reading_parameter
in: query
required: false
description: The parameter code for the reading type. `00060` is discharge in cubic feet per second, `00065` is gauge height in feet, and `00010` is temperature in degrees Celsius. Defaults to `00060`. Note, gauge stations may not have all reading parameters available.
schema:
$ref: '#/components/schemas/ReadingParameter'
example: "00060"
- name: start_date
in: query
required: false
description: The start date for the forecast data in the format `YYYY-MM-DD`.
schema:
type: string
format: date
example: "2015-08-24"
- name: end_date
in: query
required: false
description: The end date for the forecast data in the format `YYYY-MM-DD`.
schema:
type: string
format: date
example: "2026-08-31"
responses:
'200':
description: A JSON array containing past values and forecasted data.
content:
application/json:
schema:
$ref: '#/components/schemas/ForecastResult'
example:
- index: "8/24"
past_value: 882.0
forecast: 197.0
lower_error_bound: -103.0
upper_error_bound: 510.0
- index: "8/25"
past_value: 197.0
forecast: 510.0
lower_error_bound: -103.0
upper_error_bound: 510.0
'400':
description: Bad request. The `site_id` is missing or invalid.
'500':
description: Internal server error.
/forecast:
get:
deprecated: true
summary: Get flow forecast data for a specific site
description: Retrieve past values and forecasted flow data for a site specified by the `site_id`.
parameters:
- name: site_id
in: query
required: true
description: The ID of the site to retrieve flow forecast data for.
schema:
type: string
example: "09359500"
- name: reading_parameter
in: query
required: false
description: The parameter code for the reading type. `00060` is discharge in cubic feet per second, `00065` is gauge height in feet, and `00010` is temperature in degrees Celsius. Defaults to `00060`. Note, gauge stations may not have all reading parameters available.
schema:
$ref: '#/components/schemas/ReadingParameter'
example: "00060"
- name: start_date
in: query
required: false
description: The start date for the forecast data in the format `YYYY-MM-DD`.
schema:
type: string
format: date
example: "2015-08-24"
- name: end_date
in: query
required: false
description: The end date for the forecast data in the format `YYYY-MM-DD`.
schema:
type: string
format: date
example: "2026-08-31"
responses:
'200':
description: A JSON array containing past values and forecasted data.
content:
application/json:
schema:
$ref: '#/components/schemas/ForecastResult'
example:
- index: "8/24"
past_value: 882.0
forecast: 197.0
lower_error_bound: -103.0
upper_error_bound: 510.0
- index: "8/25"
past_value: 197.0
forecast: 510.0
lower_error_bound: -103.0
upper_error_bound: 510.0
'400':
description: Bad request. The `site_id` is missing or invalid.
'500':
description: Internal server error.
components:
schemas:
ReadingParameter:
type: string
enum: [ "00060", "00065", "00010" ]
description: The parameter code for the reading type. `00060` is discharge in cubic feet per second, `00065` is gauge height in feet, and `00010` is temperature in degrees Celsius.
example: "00060"
ForecastResult:
type: array
items:
type: object
properties:
index:
type: string
description: The date or index of the data point.
example: "8/24"
past_value:
type: number
nullable: true
description: The past flow value for the given index.
example: 882.0
forecast:
type: number
nullable: true
description: The forecasted flow value for the given index.
example: 197.0
lower_error_bound:
type: number
nullable: true
description: The lower error bound of the forecast.
example: -103.0
upper_error_bound:
type: number
nullable: true
description: The upper error bound of the forecast.
example: 510.0