Git Product home page Git Product logo

epa_python's Introduction

EPA Python API wrapper

Python wrapper for the multiple APIs available through the EPA's website.

Documentation for the APIs can be found here: http://www.epa.gov/enviro/facts/ef_restful.html

APIs

RADInfo

>>> from epa.radinfo import RADInfo
>>> r = RADInfo()

>>> # An empty method returns a dict of available columns.
... r.facility_type()

>>> # A method call without a value returns info about that column.
... r.facility_type('cit_ref_code')

>>> # Find information on a facility in a certain city.
... r.facility('city_name', 'Berkeley')
{'data': {'about': "Berkeley's Radiation Facility"}}

>>> # Find all the radiation facilities in Texas.
... r.facility('state_code', 'TX')
{'all': {'seven': 'Texas facilities'}}

>>> # Integer values are converted to strings automatically.
... r.regulation('part_id', 61)

>>> r.regulation('title_id', '40')

>>> # Search for the CIT_REF_CODE of a RAD NPL facility.
... r.regulation('cit_ref_code', '40CFR300')

>>> data = r.regulatory_program('sec_cit_ref_flag', 'N')
>>> data['Count']
100

>>> new_data = r.regulatory_program('sec_cit_ref_code', 'N', count=200)
>>> new_data['Count']
190

>>> data = r.regulatory_program('cit_ref_code', '40CFR300', start=50)
>>> data['Count']
8

>>> # Find geographic information.
... r.geo('geometric_type_code', '001')

GICS

>>> from epa.gics import GICS
>>> g = GICS()

>>> # List construction projects that are 91% complete.
... g.construction('complete_percent', 91)

>>> # Find all the construction projects at a specific facility.
... data = g.construction('facility_number', 190226001)
>>> data['Count']
8

>>> # Search for a specific grant's milestones.
... g.milestone('grant_number', 190709130)

>>> # Find all ADMIN COMPLETE milestones.
... g.milestone('milestone_type', 'ADMIN COMPLETE')

>>> # Search for milestones on a specific DD-MON-YY date.
... g.milestone('milestone_date', '16-MAR-01')

>>> # Find descriptions for a status code.
... g.status('status_code', 'AF')

>>> # Find grants on a specific date.
... g.grant('award_accept_date', '12-MAR-01')

>>> # Find grants for a specific city.
... g.grant('projecty_city_name', 'San Francisco')

>>> # Search the GICS API's grants for a specific state.
... g.grant('project_state_code', 'TX', count=500)

>>> # Find an applicant in a specific zipcode.
... g.applicant('zip_code', 94105)

PCS

>>> from epa.pcs import PCS
>>> p = PCS()

>>> # Search for facilities in a city.
... p.facility('location_city', 'San Francisco')

>>> # Find a facility in a particular zipcode.
... p.facility('location_zip_code', 76108)

>>> # Find a sludge facility in a specific state.
... p.sludge('handler_state', 'NY')

>>> p.pipe_schedule('discharge_num', 333)

>>> p.pipe_schedule('npdes', 'GMG290024')

>>> p.dmr_measurement('discharge_num', '001')

>>> # Find the inspections that took place on a specific date.
... p.inspection('insp_date', '16-MAR-01')

>>> p.enforcement_action('ea_code', '09')

Copyright

Copyright (c) 2011 Code for America Laboratories.

See LICENSE for details.

epa_python's People

Contributors

cspanring avatar zachwill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epa_python's Issues

ImportError: No module named 'environfacts_api'

Is this repo still being maintained (seems to be 6 years since last code change)?

When I try to run the first line of the sample code in the README.md

from epa.radinfo import RADInfo

I right away get...

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-5-a844d8bf2a68> in <module>()
----> 1 from epa.radinfo import RADInfo

C:\Anaconda3\lib\site-packages\epa\__init__.py in <module>()
      1 #!/usr/bin/env python
      2 
----> 3 import envirofacts
      4 import gics
      5 import pcs

ImportError: No module named 'envirofacts'

If you know how to fix this or of any other python wrapper for the EPA API that works, thanks in advance.

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.