Commit 312f37e7 authored by Jerome Touvier's avatar Jerome Touvier
Browse files

update

parent 3130409c
Pipeline #61040 passed with stage
in 50 seconds
STRING_TRUE = ("yes", "true", "t", "y", "1", "") STRING_TRUE = ("yes", "true", "t", "y", "1", "")
STRING_FALSE = ("no", "false", "f", "n", "0") STRING_FALSE = ("no", "false", "f", "n", "0")
REQUEST = ("storage", "send", "country", "timeseries", "map") REQUEST = ("storage", "send", "country", "timeseries", "map")
DATATYPE = ("all", "bud", "validated") DATATYPE = ("all", "buffer", "validated")
GRANULARITY = ("year", "month") GRANULARITY = ("year", "month")
ORDERBY = ("nslc", "time", "country", "protocol") ORDERBY = ("nslc", "time", "country", "protocol")
OUTPUT = ("csv", "text") OUTPUT = ("csv", "json", "text")
MEDIA = ("all", "seedlink", "dataselect") MEDIA = ("all", "seedlink", "dataselect")
NODATA_CODE = ("204", "404") NODATA_CODE = ("204", "404")
TIMEOUT = 120 TIMEOUT = 120
......
...@@ -56,11 +56,7 @@ def sql_common_string(params): ...@@ -56,11 +56,7 @@ def sql_common_string(params):
elif "dataselect" in params["media"]: elif "dataselect" in params["media"]:
s = f"{s} AND protocol = 'dataselect'" s = f"{s} AND protocol = 'dataselect'"
if ( if params["request"] in ("send", "timeseries"):
params["request"] != "storage"
and params["request"] != "country"
and params["country"] != "all"
):
s = f"""{s} AND ({is_like_or_equal(params, "country")})""" s = f"""{s} AND ({is_like_or_equal(params, "country")})"""
# starttime, endtime parameters # starttime, endtime parameters
...@@ -77,15 +73,16 @@ def sql_request(params): ...@@ -77,15 +73,16 @@ def sql_request(params):
""" Builds the PostgreSQL request """ """ Builds the PostgreSQL request """
if params["request"] == "storage": if params["request"] == "storage":
columns = "year, network, station, channel, quality, type" columns = "year, network, station, channel, quality"
s = f"SELECT DISTINCT ON ({columns}) size, {columns}, date FROM dataholdings" s = f"SELECT DISTINCT ON ({columns}) sum(size)::BIGINT, {columns}, date FROM dataholdings"
where = sql_common_string(params) where = sql_common_string(params)
s = f"{s} {where} AND channel is not NULL" s = f"{s} {where} AND channel is not NULL"
if params["type"] != "all": if params["type"] != "all":
s = f"""{s} AND (type = '{params["type"]}')""" s = f"""{s} AND (type = '{params["type"]}')"""
if params["year"]: if params["year"]:
s = f"""{s} AND ({is_like_or_equal(params, "year")})""" s = f"""{s} AND ({is_like_or_equal(params, "year")})"""
s = f"{s} ORDER BY {columns}, date DESC" s = f"{s} GROUP BY {columns}, date ORDER BY {columns}, date DESC"
s = s.replace("buffer", "bud")
else: else:
table = "sent_data_summary_weekly" table = "sent_data_summary_weekly"
if params["request"] == "country": if params["request"] == "country":
...@@ -106,7 +103,7 @@ def sql_request(params): ...@@ -106,7 +103,7 @@ def sql_request(params):
where = sql_common_string(params) where = sql_common_string(params)
s = f"{s} {where}" s = f"{s} {where}"
if params["request"] == "country": if params["request"] == "country":
tmp = f"SELECT country, sum(requests)::BIGINT, hll_cardinality(hll_union_agg(clients))::INTEGER FROM {table} {where}" tmp = f"SELECT coalesce(country, 'n/a'), sum(requests)::BIGINT, hll_cardinality(hll_union_agg(clients))::INTEGER FROM {table} {where}"
if params["country"] != "*": if params["country"] != "*":
tmp = tmp + f""" AND ({is_like_or_equal(params, "country")})""" tmp = tmp + f""" AND ({is_like_or_equal(params, "country")})"""
s = f"{s} UNION {tmp} GROUP BY country ORDER BY 2 DESC" s = f"{s} UNION {tmp} GROUP BY country ORDER BY 2 DESC"
...@@ -156,7 +153,7 @@ def format_results(params, data): ...@@ -156,7 +153,7 @@ def format_results(params, data):
def get_header(params): def get_header(params):
if params["request"] == "storage": if params["request"] == "storage":
header = ["size", "year", "network", "station", "channel", "quality", "type"] header = ["size", "year", "network", "station", "channel", "quality"]
header.append("lastupdated") header.append("lastupdated")
elif params["request"] == "country": elif params["request"] == "country":
header = ["country", "requests", "clients"] header = ["country", "requests", "clients"]
...@@ -196,27 +193,42 @@ def records_to_text(params, data, sep=" "): ...@@ -196,27 +193,42 @@ def records_to_text(params, data, sep=" "):
return text return text
def records_to_dictlist(params, data):
""" Create json output """
dictlist = list()
header = get_header(params)
header = [h.lower() for h in header]
for row in data:
dictlist.append(dict(zip(header, row)))
return {
"created": datetime.utcnow().isoformat(timespec="seconds") + "Z",
"datasources": dictlist,
}
def get_response(params, data): def get_response(params, data):
tic = time.time() tic = time.time()
fname = "resifws-statistics" fname = "resifws-statistics"
headers = {"Content-type": "text/plain"} headers = {"Content-type": "text/plain"}
if params["format"] == "text": if params["format"] == "text":
response = make_response(records_to_text(params, data), headers) response = make_response(records_to_text(params, data), headers)
elif params["format"] == "request":
response = make_response(records_to_text(params, data), headers)
elif params["format"] == "sync":
response = make_response(records_to_text(params, data, "|"), headers)
elif params["format"] == "csv": elif params["format"] == "csv":
headers = {"Content-Disposition": f"attachment; filename={fname}.csv"} headers = {"Content-Disposition": f"attachment; filename={fname}.csv"}
response = make_response(records_to_text(params, data, ","), headers) response = make_response(records_to_text(params, data, ","), headers)
response.headers["Content-type"] = "text/csv" response.headers["Content-type"] = "text/csv"
elif params["format"] == "json":
headers = {"Content-type": "application/json"}
response = make_response(
json.dumps(records_to_dictlist(params, data), sort_keys=False), headers
)
logging.debug(f"Response built in {tictac(tic)} seconds.") logging.debug(f"Response built in {tictac(tic)} seconds.")
return response return response
def map_requests(params, data): def map_requests(params, data):
with open("countries.geo.json") as json_file: with open("./static/countries.geo.json") as json_file:
geojson = json.load(json_file) geojson = json.load(json_file)
geodata = dict(x=[], y=[], name=[], requests=[]) geodata = dict(x=[], y=[], name=[], requests=[])
......
...@@ -11,9 +11,9 @@ This service provides access to the RESIF-DC statistics. ...@@ -11,9 +11,9 @@ This service provides access to the RESIF-DC statistics.
request-options :: (request=<country|map|send|storage|timeseries>) request-options :: (request=<country|map|send|storage|timeseries>)
channel-options :: [net=<network> & sta=<station> & loc=<location> & cha=<channel>] channel-options :: [net=<network> & sta=<station> & loc=<location> & cha=<channel>]
date-options :: [starttime=<date>] & [endtime=<date>] date-options :: [starttime=<date>] & [endtime=<date>]
storage-options :: [year=<year>] & [type=<all|bud|validated>] storage-options :: [year=<year>] & [type=<all|buffer|validated>]
send-options :: [country=<country_code>] & [media=<all|dataselect|seedlink>] send-options :: [country=<country_code>] & [media=<all|dataselect|seedlink>]
output-options :: [format=<csv|text>] output-options :: [format=<csv|json|text>]
(..) required (..) required
[..] optional [..] optional
...@@ -34,11 +34,9 @@ This service provides access to the RESIF-DC statistics. ...@@ -34,11 +34,9 @@ This service provides access to the RESIF-DC statistics.
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01</a>\ <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL</a> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL</a>
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01</a>
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01</a>\ <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01</a> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect</a>
## Detailed descriptions of each query parameter ## Detailed descriptions of each query parameter
...@@ -51,8 +49,8 @@ This service provides access to the RESIF-DC statistics. ...@@ -51,8 +49,8 @@ This service provides access to the RESIF-DC statistics.
| cha[nnel] | HHZ | Channel Code. This parameter accepts wildcards. | | cha[nnel] | HHZ | Channel Code. This parameter accepts wildcards. |
| start[time] | 2010-01-10T00:00:00 | Specify the responses that cover the time period after (and including) this time. | | start[time] | 2010-01-10T00:00:00 | Specify the responses that cover the time period after (and including) this time. |
| end[time] | 2011-02-11T01:00:00 | Specify responses that cover the time period prior to this time. | | end[time] | 2011-02-11T01:00:00 | Specify responses that cover the time period prior to this time. |
| format | json | The output format. Accepted values are text (the default) and csv. | | format | text | The output format. Accepted values are text (the default), json, and csv. |
| request | send | Type of statistic requested. Allowed values : <br> - __country__ : the number of requests from each country <br> - __send__ : the volume of distributed data by protocol <br> - __storage__ : the volume of data stored <br> - __timeseries__ : returns a timeseries with the country, the number and the volume of requests | | request | send | Type of statistic requested. Allowed values : <br> - __country__ : the number of requests from each country <br> - __map__ : a color coded map with the number of requests from each country<br> - __send__ : the volume of distributed data by protocol <br> - __storage__ : the volume of data stored <br> - __timeseries__ : returns a timeseries with the country, the number and the volume of requests |
### Additional parameters for country, send, and timeseries request options ### Additional parameters for country, send, and timeseries request options
| Parameter | Example | Discussion | | Parameter | Example | Discussion |
...@@ -63,7 +61,7 @@ This service provides access to the RESIF-DC statistics. ...@@ -63,7 +61,7 @@ This service provides access to the RESIF-DC statistics.
### Additional parameters for storage request option ### Additional parameters for storage request option
| Parameter | Example | Discussion | | Parameter | Example | Discussion |
| :--------- | :------- | :------------------------------------------------------------------------------ | | :--------- | :------- | :------------------------------------------------------------------------------ |
| type | validated | Type of data. Allowed values : all (the default), bud, and validated | | type | validated | Choose validated data or not. Allowed values : all (the default), buffer, and validated |
| years | 2019,2020 | List of years for which the volume of data is requested. | | years | 2019,2020 | List of years for which the volume of data is requested. |
......
...@@ -11,9 +11,9 @@ Ce service donne accès aux statistiques de RESIF-DC. ...@@ -11,9 +11,9 @@ Ce service donne accès aux statistiques de RESIF-DC.
request-options :: (request=<country|map|send|storage|timeseries>) request-options :: (request=<country|map|send|storage|timeseries>)
channel-options :: [net=<network> & sta=<station> & loc=<location> & cha=<channel>] channel-options :: [net=<network> & sta=<station> & loc=<location> & cha=<channel>]
date-options :: [starttime=<date>] & [endtime=<date>] date-options :: [starttime=<date>] & [endtime=<date>]
storage-options :: [year=<year>] & [type=<all|bud|validated>] storage-options :: [year=<year>] & [type=<all|buffer|validated>]
send-options :: [country=<country_code>] & [media=<all|dataselect|seedlink>] send-options :: [country=<country_code>] & [media=<all|dataselect|seedlink>]
output-options :: [format=<csv|text>] output-options :: [format=<csv|json|text>]
(..) requis (..) requis
[..] optionnel [..] optionnel
...@@ -34,11 +34,9 @@ Ce service donne accès aux statistiques de RESIF-DC. ...@@ -34,11 +34,9 @@ Ce service donne accès aux statistiques de RESIF-DC.
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01</a>\ <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL</a> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL</a>
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01</a>
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01</a>\ <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01</a> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all</a>\
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect</a>
## Descriptions détaillées de chaque paramètre de la requête ## Descriptions détaillées de chaque paramètre de la requête
...@@ -51,8 +49,8 @@ Ce service donne accès aux statistiques de RESIF-DC. ...@@ -51,8 +49,8 @@ Ce service donne accès aux statistiques de RESIF-DC.
| cha[nnel] | HHZ | Code de canal. Ce paramètre accepte les jokers. | | cha[nnel] | HHZ | Code de canal. Ce paramètre accepte les jokers. |
| start[time] | 2010-01-10T00:00:00 | Donne les réponses qui couvrent la période après la date donnée incluse. | | start[time] | 2010-01-10T00:00:00 | Donne les réponses qui couvrent la période après la date donnée incluse. |
| end[time] | 2011-02-11T01:00:00 | Donne les réponses qui couvrent la période avant la date donnée incluse. | | end[time] | 2011-02-11T01:00:00 | Donne les réponses qui couvrent la période avant la date donnée incluse. |
| format | txt | Format de sortie. Valeurs autorisées : text et csv. | | format | text | Format de sortie. Valeurs autorisées : text, json et csv. |
| request | send | Type de la statistique demandée. Valeurs autorisées : <br> - __country__ : nombre de requêtes passées par pays <br> - __send__ : volume de données distribuées par protocoles <br> - __storage__ : quantité de données stockées brutes et validées <br> - __timeseries__ : produit une série temporelle avec en colonne le pays, le nombre et la taille cumulés des requêtes | | request | send | Type de la statistique demandée. Valeurs autorisées : <br> - __country__ : nombre de requêtes passées par pays <br> - __map__ : une carte avec le nombre de requêtes provenant de chaque pays <br> - __send__ : volume de données distribuées par protocoles <br> - __storage__ : quantité de données stockées brutes et validées <br> - __timeseries__ : produit une série temporelle avec en colonne le pays, le nombre et la taille cumulés des requêtes |
### Options supplémentaires spécifiques aux requêtes country, send et timeseries ### Options supplémentaires spécifiques aux requêtes country, send et timeseries
| Paramètre | Exemple | Discussion | | Paramètre | Exemple | Discussion |
...@@ -63,7 +61,7 @@ Ce service donne accès aux statistiques de RESIF-DC. ...@@ -63,7 +61,7 @@ Ce service donne accès aux statistiques de RESIF-DC.
### Options supplémentaires spécifiques à la requête storage ### Options supplémentaires spécifiques à la requête storage
| Paramètre | Exemple | Discussion | | Paramètre | Exemple | Discussion |
| :--------- | :------ | :------------------------------------------------------------------------------ | | :--------- | :------ | :------------------------------------------------------------------------------ |
| type | validated | Choix entre les données stockées brutes et validées. Valeurs autorisées : all (par défaut), bud et validated | | type | validated | Choix entre les données stockées validées ou non. Valeurs autorisées : all (par défaut), buffer et validated |
| years | 2019,2020 | Liste des années pour lesquelles on demande la quantité de données. | | years | 2019,2020 | Liste des années pour lesquelles on demande la quantité de données. |
......
...@@ -28,9 +28,9 @@ où : ...@@ -28,9 +28,9 @@ où :
request-options :: (request=&lt;country|map|send|storage|timeseries&gt;) request-options :: (request=&lt;country|map|send|storage|timeseries&gt;)
channel-options :: [net=&lt;network&gt; &amp; sta=&lt;station&gt; &amp; loc=&lt;location&gt; &amp; cha=&lt;channel&gt;] channel-options :: [net=&lt;network&gt; &amp; sta=&lt;station&gt; &amp; loc=&lt;location&gt; &amp; cha=&lt;channel&gt;]
date-options :: [starttime=&lt;date&gt;] &amp; [endtime=&lt;date&gt;] date-options :: [starttime=&lt;date&gt;] &amp; [endtime=&lt;date&gt;]
storage-options :: [year=&lt;year&gt;] &amp; [type=&lt;all|bud|validated&gt;] storage-options :: [year=&lt;year&gt;] &amp; [type=&lt;all|buffer|validated&gt;]
send-options :: [country=&lt;country_code&gt;] &amp; [media=&lt;all|dataselect|seedlink&gt;] send-options :: [country=&lt;country_code&gt;] &amp; [media=&lt;all|dataselect|seedlink&gt;]
output-options :: [format=&lt;csv|text&gt;] output-options :: [format=&lt;csv|json|text&gt;]
(..) requis (..) requis
[..] optionnel</code></pre> [..] optionnel</code></pre>
...@@ -44,10 +44,9 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -44,10 +44,9 @@ output-options :: [format=&lt;csv|text&gt;]
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=country&net=RA,ND&country=IT,US,FR">http://ws.resif.fr/resifws/statistics/1/query?request=country&amp;net=RA,ND&amp;country=IT,US,FR</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=country&net=RA,ND&country=IT,US,FR">http://ws.resif.fr/resifws/statistics/1/query?request=country&amp;net=RA,ND&amp;country=IT,US,FR</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01</a><br /> <p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01&amp;net=CL</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01&amp;net=CL</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;country=all&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;media=dataselect&amp;country=all&amp;starttime=2020-01-01</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01</a><br /> <p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;media=dataselect&amp;starttime=2020-01-01</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01&amp;country=all</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01&amp;country=all&amp;media=dataselect</a></p>
<h2 id="descriptions-détaillées-de-chaque-paramètre-de-la-requête">Descriptions détaillées de chaque paramètre de la requête</h2> <h2 id="descriptions-détaillées-de-chaque-paramètre-de-la-requête">Descriptions détaillées de chaque paramètre de la requête</h2>
<table> <table>
<colgroup> <colgroup>
...@@ -95,13 +94,13 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -95,13 +94,13 @@ output-options :: [format=&lt;csv|text&gt;]
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td style="text-align: left;">format</td> <td style="text-align: left;">format</td>
<td style="text-align: left;">txt</td> <td style="text-align: left;">text</td>
<td style="text-align: left;">Format de sortie. Valeurs autorisées : text et csv.</td> <td style="text-align: left;">Format de sortie. Valeurs autorisées : text, json et csv.</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td style="text-align: left;">request</td> <td style="text-align: left;">request</td>
<td style="text-align: left;">send</td> <td style="text-align: left;">send</td>
<td style="text-align: left;">Type de la statistique demandée. Valeurs autorisées : <br> - <strong>country</strong> : nombre de requêtes passées par pays <br> - <strong>send</strong> : volume de données distribuées par protocoles <br> - <strong>storage</strong> : quantité de données stockées brutes et validées <br> - <strong>timeseries</strong> : produit une série temporelle avec en colonne le pays, le nombre et la taille cumulés des requêtes</td> <td style="text-align: left;">Type de la statistique demandée. Valeurs autorisées : <br> - <strong>country</strong> : nombre de requêtes passées par pays <br> - <strong>map</strong> : une carte avec le nombre de requêtes provenant de chaque pays <br> - <strong>send</strong> : volume de données distribuées par protocoles <br> - <strong>storage</strong> : quantité de données stockées brutes et validées <br> - <strong>timeseries</strong> : produit une série temporelle avec en colonne le pays, le nombre et la taille cumulés des requêtes</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -150,7 +149,7 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -150,7 +149,7 @@ output-options :: [format=&lt;csv|text&gt;]
<tr class="odd"> <tr class="odd">
<td style="text-align: left;">type</td> <td style="text-align: left;">type</td>
<td style="text-align: left;">validated</td> <td style="text-align: left;">validated</td>
<td style="text-align: left;">Choix entre les données stockées brutes et validées. Valeurs autorisées : all (par défaut), bud et validated</td> <td style="text-align: left;">Choix entre les données stockées validées ou non. Valeurs autorisées : all (par défaut), buffer et validated</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td style="text-align: left;">years</td> <td style="text-align: left;">years</td>
......
...@@ -28,9 +28,9 @@ where : ...@@ -28,9 +28,9 @@ where :
request-options :: (request=&lt;country|map|send|storage|timeseries&gt;) request-options :: (request=&lt;country|map|send|storage|timeseries&gt;)
channel-options :: [net=&lt;network&gt; &amp; sta=&lt;station&gt; &amp; loc=&lt;location&gt; &amp; cha=&lt;channel&gt;] channel-options :: [net=&lt;network&gt; &amp; sta=&lt;station&gt; &amp; loc=&lt;location&gt; &amp; cha=&lt;channel&gt;]
date-options :: [starttime=&lt;date&gt;] &amp; [endtime=&lt;date&gt;] date-options :: [starttime=&lt;date&gt;] &amp; [endtime=&lt;date&gt;]
storage-options :: [year=&lt;year&gt;] &amp; [type=&lt;all|bud|validated&gt;] storage-options :: [year=&lt;year&gt;] &amp; [type=&lt;all|buffer|validated&gt;]
send-options :: [country=&lt;country_code&gt;] &amp; [media=&lt;all|dataselect|seedlink&gt;] send-options :: [country=&lt;country_code&gt;] &amp; [media=&lt;all|dataselect|seedlink&gt;]
output-options :: [format=&lt;csv|text&gt;] output-options :: [format=&lt;csv|json|text&gt;]
(..) required (..) required
[..] optional</code></pre> [..] optional</code></pre>
...@@ -44,10 +44,9 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -44,10 +44,9 @@ output-options :: [format=&lt;csv|text&gt;]
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=country&net=RA,ND&country=IT,US,FR">http://ws.resif.fr/resifws/statistics/1/query?request=country&amp;net=RA,ND&amp;country=IT,US,FR</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=country&net=RA,ND&country=IT,US,FR">http://ws.resif.fr/resifws/statistics/1/query?request=country&amp;net=RA,ND&amp;country=IT,US,FR</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01</a><br /> <p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01&amp;net=CL</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=map&starttime=2020-01-01&net=CL">http://ws.resif.fr/resifws/statistics/1/query?request=map&amp;starttime=2020-01-01&amp;net=CL</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;country=all&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&country=all&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;media=dataselect&amp;country=all&amp;starttime=2020-01-01</a></p>
<p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01</a><br /> <p><a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&media=dataselect&starttime=2020-01-01">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;media=dataselect&amp;starttime=2020-01-01</a></p> <a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01&amp;country=all</a><br />
<a href="http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&starttime=2020-01-01&country=all&media=dataselect">http://ws.resif.fr/resifws/statistics/1/query?request=timeseries&amp;starttime=2020-01-01&amp;country=all&amp;media=dataselect</a></p>
<h2 id="detailed-descriptions-of-each-query-parameter">Detailed descriptions of each query parameter</h2> <h2 id="detailed-descriptions-of-each-query-parameter">Detailed descriptions of each query parameter</h2>
<table> <table>
<colgroup> <colgroup>
...@@ -95,13 +94,13 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -95,13 +94,13 @@ output-options :: [format=&lt;csv|text&gt;]
</tr> </tr>
<tr class="odd"> <tr class="odd">
<td style="text-align: left;">format</td> <td style="text-align: left;">format</td>
<td style="text-align: left;">json</td> <td style="text-align: left;">text</td>
<td style="text-align: left;">The output format. Accepted values are text (the default) and csv.</td> <td style="text-align: left;">The output format. Accepted values are text (the default), json, and csv.</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td style="text-align: left;">request</td> <td style="text-align: left;">request</td>
<td style="text-align: left;">send</td> <td style="text-align: left;">send</td>
<td style="text-align: left;">Type of statistic requested. Allowed values : <br> - <strong>country</strong> : the number of requests from each country <br> - <strong>send</strong> : the volume of distributed data by protocol <br> - <strong>storage</strong> : the volume of data stored <br> - <strong>timeseries</strong> : returns a timeseries with the country, the number and the volume of requests</td> <td style="text-align: left;">Type of statistic requested. Allowed values : <br> - <strong>country</strong> : the number of requests from each country <br> - <strong>map</strong> : a color coded map with the number of requests from each country<br> - <strong>send</strong> : the volume of distributed data by protocol <br> - <strong>storage</strong> : the volume of data stored <br> - <strong>timeseries</strong> : returns a timeseries with the country, the number and the volume of requests</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
...@@ -150,7 +149,7 @@ output-options :: [format=&lt;csv|text&gt;] ...@@ -150,7 +149,7 @@ output-options :: [format=&lt;csv|text&gt;]
<tr class="odd"> <tr class="odd">
<td style="text-align: left;">type</td> <td style="text-align: left;">type</td>
<td style="text-align: left;">validated</td> <td style="text-align: left;">validated</td>
<td style="text-align: left;">Type of data. Allowed values : all (the default), bud, and validated</td> <td style="text-align: left;">Choose validated data or not. Allowed values : all (the default), buffer, and validated</td>
</tr> </tr>
<tr class="even"> <tr class="even">
<td style="text-align: left;">years</td> <td style="text-align: left;">years</td>
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
<param name="end" style="query" type="xsd:string"/> <param name="end" style="query" type="xsd:string"/>
<param name="request" style="query" type="xsd:string"> <param name="request" style="query" type="xsd:string">
<option value="country"/> <option value="country"/>
<option value="map"/>
<option value="send"/> <option value="send"/>
<option value="storage"/> <option value="storage"/>
<option value="timeseries"/> <option value="timeseries"/>
...@@ -57,12 +58,13 @@ ...@@ -57,12 +58,13 @@
<param name="year" style="query" type="xsd:string"/> <param name="year" style="query" type="xsd:string"/>
<param name="type" style="query" type="xsd:string"> <param name="type" style="query" type="xsd:string">
<option value="all"/> <option value="all"/>
<option value="bud"/> <option value="buffer"/>
<option value="validated"/> <option value="validated"/>
</param> </param>
<param name="nodata" style="query" type="xsd:string"/> <param name="nodata" style="query" type="xsd:string"/>
<param name="format" style="query" type="xsd:string"> <param name="format" style="query" type="xsd:string">
<option value="csv"/> <option value="csv"/>
<option value="json"/>
<option value="text"/> <option value="text"/>
</param> </param>
</request> </request>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment