# An Open-Source R Package for Building and Using US Environmentally-Extended Input-Output Models
## 2 Materials & Methods
### Environmental Data and Satellite Tables  
_useeior_ characterizes the amount of environmental releases/losses, resource use, waste generation, and employment by model-specified industry, through the use of national totals of flows by NAICS industry and the crosswalk created in Section 2.1. National totalsof flows by NAICS industry data used in _useeior_ can be generated by a Python-based tool called FLOWSA [15], which structures data in a flow-by-sector (FBS) format. The latest version of FLOWSA, v1.0.1, delivers FBS data that covers a variety of flow types, including criteria and hazardous air emissions, point source industrial releases to water and soil, use of land, use of water, and employment. To support impact assessment and a consistent flow naming system across data sources, flows in FLOWSA conform to the Federal Elementary Flow List (FEDEFL) [27]. The FBS data to build the models specified in _useeior_ v1.0.0 are retrieved from the EPA Data Commons [28] via automated functions in _useeior_.  
These flow-by-NAICS-industry data are transformed into flow-by-model-sector format, and loaded as satellite tables via the NAICS-to-BEA crosswalk. Value added by BEA industry are also considered flow data, but are directly loaded from the IO data that was added in the previous step.  
model <- loadandbuildSatelliteTables(model)  
A Satellite Tables component is added in the _model_ object after this step. In the new component, the satellite tables are stored in _totals_by_sector_, while flow metadata were stored in _flows_. Each type of flow had a designated satellite table. Following the loading of all satellite tables, _useeior_ identified instances of flows reported by the same sector from multiple satellite tables as a means to avoid double counting. All satellite tables were formatted into a standard structure that included the following columns:  
* Flow name, context, universally unique identifier (UUID), amount, unit, location, and data year;
* Sector code and name;
* Data quality scores for data reliability, temporal correlation, geographical correlation, technological correlation, and data collection.  
Flow metadata displays unique flows found across all satellite tables with names, contexts, UUIDs, and units were sourced from FEDEFL.  
Satellite, or _totals_by_sector_, tables provide a full picture of flows from and to the environment. They are used to calculate impact coefficients and validate the model.  
If aggregation or disaggregation is specified during model build, each satellite table is aggregated or disaggregated upon loading. Specifications for disaggregating environmental data can be provided in one of two ways. If flow totals are provided for a given flow for any of the new sectors, _useeior_ replaces the existing satellite table data for that flow with the data in the supplementary disaggregation file. Alternatively, flow ratios can be provided for one or more flows in a satellite table. If the FlowRatio field was supplied, _useeior_ disaggregates each flow to the new sectors according to the supplied ratios. In either case, if data for a specific flow are not provided, _useeior_ disaggregates the existing satellite table data for that flow proportional to gross industry output of the new sectors.