Giter Site home page Giter Site logo

solararbiter / solarforecastarbiter-api Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 6.0 3.95 MB

HTTP API and database schema for the Solar Forecast Arbiter

Home Page: https://api.solarforecastarbiter.org

License: MIT License

Python 99.83% HTML 0.06% Dockerfile 0.01% Shell 0.11%

solarforecastarbiter-api's People

Contributors

alorenzo175 avatar lboeman avatar wholmgren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

solarforecastarbiter-api's Issues

JSON missing/null value parsing

If we're expecting users to serialize missing or null values into JSON as the javascript null object, Flask will parse it into None and pandas into a NaN.
If we need to be more permissive with missing data in JSON, we'll have to find/replace accepted NaN values.

intro documentation

We should add more intro material that outlines how we expect most people to interact with the API: POSTing and GETing preexisting observations. An important item to clarify is one csv per observation (so one csv per data type) and therefore likely multiple POST/GET operations per site.

Integration tests

On top of existing Unit tests we need 'integration' tests to ensure the system functions as expected. the requests used to test the dev-storage backend #39 are a good place to start for these.

  • storage creates a uuid for new metadata objects, adds 'Provider' field.

Accept file uploads

Accept file uploads with the multipart/form-data content type for forecast and observation endpoints.

Handle values updates

Currently, inserting values with the same timestamps throws a 1062 duplicate primary key error. We may need to add ON DUPLICATE KEY UPDATE to the INSERT statements in the store procedures for forecasts, observations and cdf_forecasts.

Deletion 404s

Since mysql fails silently when something doesn't exist, we should check for this and return something. Currently, deleting an object or trying to delete a missing object returns a 200 and trying to delete something you don't have access to throws a 404.

missing values on marshmallow deserialize

Many fields in the schema are not required but have no missingor default values. We should probably set these fields so we know the once place where default values come in. The database storage_interface also won't work as is since the fields are not set at times.

Deletion 403

When user has read permissions but cannot delete an object.

Turn nested site objects into links

Forecasts and Oservations should not include the full nested site object, but rather a _links object with site attribute that links to site metadata.

API doc issues

Need to address most of these before sending out stakeholder feedback request:

"Authorization request must include client_id='c16EJo48lbTCQEhqSztGGlmxxxmZ4zX' and audience='https://api.solarforecastarbiter.org'" can we make it look like this: "Authorization request must include client_id='c16EJo48lbTCQEhqSztGGlmxxxmZ4zX' and audience='https://api.solarforecastarbiter.org'" or similar?

The get site forecasts section says "Get all forecasts associated with site that user has access to". Probably better to say "Get metadata for all forecasts...". Same for get site observations.

get site information or metadata? probably metadata.

observation variables not up to date. Same for forecasts.

observation data example contains only 1 line. I guess it's ok but including a second line would make it more obvious that multiple data points are allowed in one upload.

The API has issue_frequency. The use cases describe this as run_length / issue frequency. run_length_issue_frequency?

Should we bring more/all of the forecast attribute descriptions into the API doc?

Interval length, not duration.

Intervals per submission is no more.

Add something like "to be determined in March/April 2019 to Reports and Trials".

fix values API documentation

Right now, the API docs say that a requests to /observations/id/values returns an array of dicts. The actual behavior returns just the dict as it should. We should update the docs and check them for the other values endpoints

String validation

We should validate things like site name better to avoid storing dangerous SQL injection or xss strings in the DB. Only allow letters digits and a few punctuation marks

Set Proper API responses

All endpoints should respond with:

  • a 200 code when successful
  • 401: unauthorized when a user is not logged in (this may need to be merged with 404 depending on if we require signup for public data.
  • 400 when a logged in user has permissions to perform an action but the request is invalid for some other reason. This usually produces a meaningful error message.
  • 404 User lacks permissions or the resource does not exist. This is so that users cannot discover resources they do not have access to.

Forecast Blueprint

Implement /forecasts endpoints in forecasts blueprint. Schema should also be updated with proper validation.

notes for validation:
will need to verify this, duration, and issue freq later
and issue_time. probably easiest to use pandas timedeltas for the former three, and a time function for issue_time

Originally posted by @alorenzo175 in #28

Working Test API from static content in demo module.

  • create demo objects to act as static data store.
  • Make storage module to load and interact with static data store.
  • Update dashboard to call API for data.

issues discovered while working on dashboard:

  • Observations lack interval_length field
  • site_id stored as UUID when parsed by marshmallow. cast to string for storage.
  • parse and store time duration variables in minutes
  • don't allow duplicate timestamps in uploads.

Create users on signup

Add users to the database after signup. Perhaps this is a manual process, or there is a flag the admins have to select after the process described in #81

Delete values

Allow users to delete values at specific timestamps/ a list of timestamps

ensure users are validated after signup

Should make sure users have validated email and that the organization has accepted the TOU before allowing access to login. Users should already require organization administrator approval since they will not have any default organization permissions.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.