The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Introduction

About

The Assessment, Total Maximum Daily Load (TMDL) Tracking and Implementation System (ATTAINS) is the U.S. Environmental Protection Agency (EPA) database used to track information provided by states about water quality assessments conducted under the Clean Water Act. The assessments are conducted every two years to evaluate if the nation’s water bodies meet water quality standards. States are required to take Actions (TMDLs or other efforts) on water bodies that do not meet standards. Public information in ATTAINS is made available through webservices and provided as JSON files. rATTAINS facilitates accessing this data with various functions that provide raw JSON or formatted “tidy” data for each of the ATTAINS webservice endpoints. More information about Clean Water Act assessment and reporting is available through the EPA. For alternative methods of accessing the same data, see “How’s My Waterway” webpage for interactive data exploration or the ArcGIS MapService for spatial data.

Functions

Summary Services

The EPA provides two summary service endpoint that provide summaries of assessed uses by the organization identifier or by hydrologic unit code (HUC). For example, to return a summary of assessed uses by the state of Tennessee the following function is used:

library(rATTAINS)
x <- state_summary(organization_id = "TDECWR",
                   reporting_cycle = "2016")
x
#> # A tibble: 71 × 24
#>    organizatio…¹ organ…² organ…³ repor…⁴ water…⁵ units…⁶ use_n…⁷ fully…⁸ fully…⁹
#>    <chr>         <chr>   <chr>   <chr>   <chr>   <chr>   <chr>     <dbl>   <int>
#>  1 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  2 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  3 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  4 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  5 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  6 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  7 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  8 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#>  9 TDECWR        Tennes… State   2016    LAKE/R… Acres   Fish a… 531027.      55
#> 10 TDECWR        Tennes… State   2016    LAKE/R… Acres   Recrea… 376478.      36
#> # … with 61 more rows, 15 more variables: use_insufficient_information <dbl>,
#> #   use_insufficient_information_count <int>, not_assessed <dbl>,
#> #   not_assessed_count <int>, not_supporting <dbl>, not_supporting_count <int>,
#> #   parameter_group <chr>, parameter_insufficient_information <dbl>,
#> #   parameter_insufficient_information_count <int>, cause <dbl>,
#> #   cause_count <int>, meeting_criteria <dbl>, meeting_criteria_count <int>,
#> #   removed <dbl>, removed_count <int>, and abbreviated variable names …

The HUC12 service operates similarly but provides data summarized by area, specifically HUC12 units. For example:

x <- huc12_summary("020700100204")
x
#> $huc_summary
#> # A tibble: 1 × 14
#>   huc12  asses…¹ total…² total…³ asses…⁴ asses…⁵ asses…⁶ asses…⁷ asses…⁸ asses…⁹
#>   <chr>    <int>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#> 1 02070…      17    46.1    46.2    35.2    76.4       0       0       0       0
#> # … with 4 more variables: contain_impaired_waters_catchment_area_sq_mi <dbl>,
#> #   contain_impaired_catchment_area_percent <dbl>,
#> #   contain_restoration_catchment_area_sq_mi <dbl>,
#> #   contain_restoration_catchment_area_percent <dbl>, and abbreviated variable
#> #   names ¹​assessment_unit_count, ²​total_catchment_area_sq_mi,
#> #   ³​total_huc_area_sq_mi, ⁴​assessed_catchment_area_sq_mi,
#> #   ⁵​assessed_cathcment_area_percent, ⁶​assessed_good_catchment_area_sq_mi, …
#> 
#> $au_summary
#> # A tibble: 17 × 1
#>    assessment_unit_id          
#>    <chr>                       
#>  1 MD-02140205-Northwest_Branch
#>  2 MD-02140205                 
#>  3 DCTFD01R_00                 
#>  4 DCTNA01R_00                 
#>  5 DCTFS01R_00                 
#>  6 MD-ANATF                    
#>  7 DCTTX27R_00                 
#>  8 DCTFC01R_00                 
#>  9 MD-02140205-Mainstem        
#> 10 DCTWB00R_02                 
#> 11 DCANA00E_02                 
#> 12 DCTHR01R_00                 
#> 13 DCTWB00R_01                 
#> 14 DCTPB01R_00                 
#> 15 DCTDU01R_00                 
#> 16 DCANA00E_01                 
#> 17 DCAKL00L_00                 
#> 
#> $ir_summary
#> # A tibble: 2 × 4
#>   EPA_IR_category_name catchment_size_sq_mi catchment_size_percent assessment_…¹
#>   <chr>                               <dbl>                  <dbl>         <int>
#> 1 4A                                   12.7                   27.5            10
#> 2 5                                    25.8                   56.0             7
#> # … with abbreviated variable name ¹​assessment_unit_count
#> 
#> $status_summary
#> # A tibble: 1 × 4
#>   overall_status catchment_size_sq_mi catchment_size_percent assessment_unit_c…¹
#>   <chr>                         <dbl>                  <dbl>               <int>
#> 1 Not Supporting                 35.2                   76.4                  17
#> # … with abbreviated variable name ¹​assessment_unit_count
#> 
#> $use_group_summary
#> # A tibble: 5 × 5
#>   use_group_name      use_attainment           catchment_size_…¹ catch…² asses…³
#>   <chr>               <chr>                                <dbl>   <dbl>   <int>
#> 1 ECOLOGICAL_USE      Not Supporting                      10.9     23.7       13
#> 2 FISHCONSUMPTION_USE Insufficient Information            15.9     34.4        1
#> 3 FISHCONSUMPTION_USE Not Supporting                      15.9     34.4       12
#> 4 OTHER_USE           Fully Supporting                     0.683    1.48       3
#> 5 RECREATION_USE      Not Supporting                      15.2     32.9       13
#> # … with abbreviated variable names ¹​catchment_size_sq_mi,
#> #   ²​catchment_size_percent, ³​assessment_unit_count
#> 
#> $use_summary
#> # A tibble: 6 × 6
#>   use_name                               use_g…¹ use_a…² catch…³ catch…⁴ asses…⁵
#>   <chr>                                  <chr>   <chr>     <dbl>   <dbl>   <int>
#> 1 Navigation                             OTHER_… Fully …  10.9     23.7        3
#> 2 Primary Contact Recreation             RECREA… Not Su…  15.9     34.4       13
#> 3 Protection and Propagation of Fish, S… ECOLOG… Not Su…  15.9     34.4       13
#> 4 Protection of Human Health related to… FISHCO… Insuff…   0.683    1.48       1
#> 5 Protection of Human Health related to… FISHCO… Not Su…  15.2     32.9       12
#> 6 Secondary Contact Recreation and Aest… RECREA… Not Su…  15.9     34.4       13
#> # … with abbreviated variable names ¹​use_group_name, ²​use_attainment,
#> #   ³​catchment_size_sq_mi, ⁴​catchment_size_percent, ⁵​assessment_unit_count
#> 
#> $param_summary
#> # A tibble: 16 × 4
#>    parameter_group_name                catchment_size_sq_mi catchment_…¹ asses…²
#>    <chr>                                              <dbl>        <dbl>   <int>
#>  1 ALGAL GROWTH                                        9.21        20.0        2
#>  2 CHLORINE                                            1.73         3.75       1
#>  3 HABITAT ALTERATIONS                                 2.80         6.07       2
#>  4 HYDROLOGIC ALTERATION                               5.98        13.0        5
#>  5 METALS (OTHER THAN MERCURY)                        11.8         25.7        9
#>  6 NUTRIENTS                                           9.21        20.0        2
#>  7 OIL AND GREASE                                     10.9         23.7        3
#>  8 ORGANIC ENRICHMENT/OXYGEN DEPLETION                12.7         27.5        6
#>  9 PATHOGENS                                          15.9         34.4       13
#> 10 PESTICIDES                                         15.2         32.9        9
#> 11 PH/ACIDITY/CAUSTIC CONDITIONS                       1.95         4.22       1
#> 12 POLYCHLORINATED BIPHENYLS (PCBS)                   15.2         32.9       10
#> 13 SEDIMENT                                            1.90         4.11       1
#> 14 TOXIC ORGANICS                                     13.3         28.7        8
#> 15 TRASH                                               9.21        20.0        2
#> 16 TURBIDITY                                          15.9         34.4       13
#> # … with abbreviated variable names ¹​catchment_size_percent,
#> #   ²​assessment_unit_count
#> 
#> $res_plan_summary
#> # A tibble: 1 × 4
#>   summary_type_name catchment_size_sq_mi catchment_size_percent assessment_uni…¹
#>   <chr>                            <dbl>                  <dbl>            <int>
#> 1 TMDL                              15.9                   34.4               13
#> # … with abbreviated variable name ¹​assessment_unit_count
#> 
#> $vision_plan_summary
#> # A tibble: 1 × 4
#>   summary_type_name catchment_size_sq_mi catchment_size_percent assessment_uni…¹
#>   <chr>                            <dbl>                  <dbl>            <int>
#> 1 TMDL                              15.9                   34.4               13
#> # … with abbreviated variable name ¹​assessment_unit_count

huc12_summary() returns a list of tibbles with different summaries of information. Using the above example: - x$huc_summary provides a summary of HUC area, and the area and percentage of catchment assessed as good, unknown, or impaired. - x$au_summary provides a tibble with the unique identifiers for the assessment units (or distinct sections of waterbodies) within the queried HUC12. - x$ir_summary provides a simple summary of the area of the catchment classified under different Integrated Report Categories. - x$status_summary provides a summary of the overall status within the HUC12. - x$use_group_summary provides a summary of use attainment bu use group within the HUC12. - x$use_summary breaks the use summary down further by the use name. - x$param_summary provides the same information for parameter groups. - x$res_plan_summary and x$vision_plan_summary provides a summary of the amount of the watershed covered by particular types of restoration plans or vision plan, such as TMDLs.

Domains

Each function has a number of allowable arguments and associated values. In order to explore what values you might be interested in querying, the Domain Value service provides information about allowable options. This is mapped to the domain_values() function. When used without any arguments you get a full list of possible “domains.” These are typically searchable parameters used in all the functions in rATTAINS. Note that the domain names returned by these service are not a one to one match with the argument names used in rATTAINS. It is typically fairly easy to figure out which ones match up to which arguments.

For example if I want to find out the possible organization identifiers to query by:

x <- domain_values(domain_name = "OrgStateCode")
x
#> # A tibble: 146 × 5
#>    domain       name  code  context         context_2
#>    <chr>        <chr> <chr> <chr>           <chr>    
#>  1 OrgStateCode AK    AK    EPA             <NA>     
#>  2 OrgStateCode FL    FL    21FL303D        <NA>     
#>  3 OrgStateCode PA    PA    EPA             <NA>     
#>  4 OrgStateCode CC    CC    TEST_ORG_C      <NA>     
#>  5 OrgStateCode AZ    AZ    TEST_TRIBE_B    <NA>     
#>  6 OrgStateCode MS    MS    21MSWQ          <NA>     
#>  7 OrgStateCode CT    CT    CT_DEP01        <NA>     
#>  8 OrgStateCode ND    ND    21NDHDWQ        <NA>     
#>  9 OrgStateCode MN    MN    REDLAKE         <NA>     
#> 10 OrgStateCode NM    NM    PUEBLO_POJOAQUE <NA>     
#> # … with 136 more rows

The function returns a variable with the state codes and the possible parameter values as the context variable. Similarly if I want to look up possible Use Names that are utilized by the Texas Commission on Environmental Quality:

x <- domain_values(domain_name = "UseName", context = "TCEQMAIN")
x
#> # A tibble: 17 × 5
#>    domain  name                                        code      context conte…¹
#>    <chr>   <chr>                                       <chr>     <chr>   <chr>  
#>  1 UseName Recreation Use                              Recreati… TCEQMA… <NA>   
#>  2 UseName Fish Consumption Use                        Fish Con… TCEQMA… <NA>   
#>  3 UseName INTERMEDIATE AQUATIC LIFE                   INTERMED… TCEQMA… <NA>   
#>  4 UseName OVERALL USE SUPPORT                         OVERALL … TCEQMA… <NA>   
#>  5 UseName Aquatic Life Use                            Aquatic … TCEQMA… <NA>   
#>  6 UseName Oyster Waters Use                           Oyster W… TCEQMA… <NA>   
#>  7 UseName FISH CONSUMPTION                            FISH CON… TCEQMA… <NA>   
#>  8 UseName OYSTER AQUATIC LIFE                         OYSTER A… TCEQMA… <NA>   
#>  9 UseName NON-CONTACT RECREATION                      NON-CONT… TCEQMA… <NA>   
#> 10 UseName CONTACT RECREATION USE                      CONTACT … TCEQMA… <NA>   
#> 11 UseName DOMESTIC WATER SUPPLY - PUBLIC WATER SUPPLY DOMESTIC… TCEQMA… <NA>   
#> 12 UseName Public Water Supply Use                     Public W… TCEQMA… <NA>   
#> 13 UseName General Use                                 General … TCEQMA… <NA>   
#> 14 UseName PRIMARY RECREATION/SWIMMING                 PRIMARY … TCEQMA… <NA>   
#> 15 UseName CONTACT RECREATION                          CONTACT … TCEQMA… <NA>   
#> 16 UseName NONCONTACT RECREATION USE                   NONCONTA… TCEQMA… <NA>   
#> 17 UseName Recreational Beaches                        Recreati… TCEQMA… <NA>   
#> # … with abbreviated variable name ¹​context_2

Other Services

JSON Files

By default, all the functions rATTAINS return one or more “tidy” dataframes. These dataframe are created by attempting to flatten the nested JSON data returned by the webservice. This does require some opinionated decisions on what constitutes flat data, and at what variable data should be flattened to. We recognize that the dataframe output might not meet user needs. There if you would prefer to parse the JSON data yourself, use the tidy=FALSE argument to return an unparsed JSON string. A number of R packages are available to parse and flatten JSON data to prepare it for analysis.

Notes

The U.S. EPA is the data provider for this public information. rATTAINS and the author are not affiliated with the EPA. Questions about the package functionality should be directed to the package author. Questions about the webservice or underlying data should be directed to the U.S. EPA. Please do not abuse the webservice using this package.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.