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 "manage user" on the home page
- Click enable
Delete a datapoint
Use https://opensource.ncsa.illinois.edu/bitbucket/snippets/6de7681f45fe4731a4acce344ddcb346
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 master token.
The json file indicates which regions & parameters are used. regions's geometry information is not stored in the DB, it uses the one in the json file.
Also, it only add new regions and skip existing regions. This logic need to update if update regions are required.
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()