Code Monkey home page Code Monkey logo

useeio_api's Introduction

USEEIO API

The US Environmentally-Extended Input-Output Model Application Programming Interface (USEEIO API) is a web service that provides pre-calculated USEEIO model results and model metadata for USEEIO family models. The USEEIO API is part of the USEEIO modeling framework.

This repository contains the software to build the web service and documentation and to test the API. It is also associated with a Wiki with instructions to build, test, deploy and use the USEEIO API. Live implementations of the USEEIO API are hosted elsewhere.

The USEEIO API web service is written in Go and can be built for serving on Windows and Linux machines. It can be further containerized in Docker container or deployed to a cloud foundry server. These web services can be built and served on a local machine or deployed to a remote server. USEEIO models make up the data for the web service. They are not hosted here, but must be built and exported in the specified formats in order to be served by the web services. USEEIO models are built in useeior.

The web service can serve multiple USEEIO models. For each model, it serves available matrices and accompanying metadata, and also supports calculate of impact results for a given model with a user defined demand vector and result perspective. More information about the provided components and metadata can be found in the API documentation.

The API documentation uses a standard API documentation specification, Swagger 2.0. It is built into HTML pages using the npm and gulp Javscript package manager and build system.

The test suite is a set Python 3 pass/fail unit tests that extensive test all models on any local or remote web service.

The USEEIO API attempts to implement the 18F US federal government API best practices.

Disclaimer

The United States Environmental Protection Agency (EPA) GitHub project code is provided on an "as is" basis and the user assumes responsibility for its use. EPA has relinquished control of the information and no longer has responsibility to protect the integrity , confidentiality, or availability of the information. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply their endorsement, recommendation or favoring by EPA. The EPA seal and logo shall not be used in any manner to imply endorsement of any commercial product or activity by EPA or the United States Government.

useeio_api's People

Contributors

cantide5ga avatar dependabot[bot] avatar dunnke avatar dyoung11 avatar modelearth avatar msrocka avatar wesingwersen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

useeio_api's Issues

JSON decoding error in serving ExampleModel - go version

Occurred: running the windows distribution of the go version on localhost
Fails indicator, calculation, and demand tests
Same error occurs in all tests when trying to convert a response to JSON from r.json():

raise JSONDecodeError("Expecting value", s, err.value) from None

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Move iomb/webapi here?

If you think it is OK, I would prefer having the python version of the API in this repository, so its easier to compare and manages changes to the API. Then we could make the README about the USEEIO_API in general (I need a broader readme) and house it here. So the proposal would be to move the two files from https://github.com/USEPA/IO-Model-Builder/tree/master/iomb/webapi into this repository, probably in a folder like 'useeioapipy'. I suppose we could then create a simple setup.py if we wanted to make it installable.

JSON decoding error in parsing flow and indicator ids

testing a go build on localhost from the flowupdate branch with data from the USEEIOv2.0 model build with the useeior/v2-alpha branch, the test_indicators.py and test_flows.py are failing with a JSONDecodeError

INFO:root:check indicator 3 in model USEEIOv2.0

Error
Traceback (most recent call last):
  File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\unittest\case.py", line 59, in testPartExecutor
    yield
  File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\unittest\case.py", line 615, in run
    testMethod()
  File "C:\Users\wesle\USEEIO_API\python\tests\test_indicators.py", line 39, in test_get_indicator
    same = client.get_indicator(model_id, indicator['id'])
  File "C:\Users\wesle\USEEIO_API\python\useeioapi\client.py", line 36, in get_indicator
    return self.__get_json('/%s/indicators/%s' % (model_id, iid))
  File "C:\Users\wesle\USEEIO_API\python\useeioapi\client.py", line 75, in __get_json
    return r.json()
  File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\site-packages\requests\models.py", line 898, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "C:\Users\wesle\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 1 column 5 (char 4)

Reorganize batch files for Go builds

There is one batch file to build windows and linux distributions (make.bat). This file should be modified and moved within the 'go' folder to make it clear that it's for making the go version.

There is also an cfdist.bat within the apidoc folder and some associated files. As I understand the 'app' this creates is identical (but it only creates the linux distribution), however, it relies on other files. Perhaps the cfdist.bat could be removed, and the additional files (cfproc and cfdist.yaml) put into the go/cfdist folder?
That would clear up the apidocs folder to just have the apidoc files in there.

Add flows endpoints to get flow info

Add endpoints
flows/
flows/{flowID}
to provide the list of elementary flows and individual flow metadata similar to what is provided for sectors and indicators

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.