refer to Setting Up Geotemporal API V3
Add the initial Admin User
- set master.default="xxxx" in application.conf
- restart the geostreams-api-v3
- use xxxx to signup, then xxxx is set as default admin
Add other user as Admin User
- make sure you are the admin user
- click "mange user" on the home page
- click enable
Delete a datapoint
use https://opensource.ncsa.illinois.edu/bitbucket/snippets/6de7681f45fe4731a4acce344ddcb346
Update trends region
use https://opensource.ncsa.illinois.edu/bitbucket/snippets/e2862e635cbf426988d8c6d4231e151b as the input json,
it indicate which regions & parameters are used. regions's geometry information is not stored in the DB, it uses the one in the json file.
POST to /api/trends/region with master user token ( refer to "delete a datapoint").
Populating Parameters Table
Python Script for parsing a parameters.json file (The parameter.json file for GLM is also on this snippet)
https://opensource.ncsa.illinois.edu/bitbucket/snippets/6f31b95bf0834285a21fe0ad62c16e96
To create a parameter.json file from v2/parameters.json remove the variable name and = sign and just have the configuration within []
Populating the Regions Table
Use https://opensource.ncsa.illinois.edu/bitbucket/snippets/e2862e635cbf426988d8c6d4231e151b
and post to /api/trends/region with valid token.
Sample scripts for ingesting the data
import requests import csv import json import argparse from requests.auth import HTTPBasicAuth def main(): URL = 'http://localhost:9000/' client = requests.session() user = { 'identifier': 'indiragp@illinois.edu', 'password': 'password' } r = requests.post('http://localhost:9000/api/authenticate', data=json.dumps(user), headers={'Content-Type': 'application/json'}) print(r.status_code) print(r.headers) file = "/Users/indiragp/git/seagrant-parsers-py/areas.json" new_headers = r.headers new_headers['Content-Encoding'] = "application/json" with open(file) as f: data = json.load(f) k = requests.post('http://localhost:9000/api/trends/region', data=json.dumps(data), headers=new_headers) print(k.headers) print(k.status_code) print(k.json()) if __name__ == "__main__": main()