# Data-Driven Approaches for Predicting and Forecasting Air Quality in Urban Areas
## 2 Materials and Methods
### Data Import Process Description  
These datasets were integrated using API requests to the EPA's online database [67], which provided individual CSV files for each pollutant parameter. We employed a C# script to align and correlate the data from these CSV files, facilitating their import into a centralized database. The database was an SQL Server hosted locally for local training of the custom-made algorithm. An entry was created for each day of 2020-2023 to populate the database. The import process involved reading data from a CSV file through an API request containing daily records for the selected AQ parameters. Four API requests were made for the complete CO, NO\({}_{2}\), SO\({}_{2}\), and PM\({}_{2.5}\) data import. In the same database, records were extracted from a CSV file provided by Open NY, containing data for the same period detailing the number of vehicles that passed through two access points in Bronx County. Additionally, temperature, humidity, and wind speed data for the same dates were imported from the OMAP system. The import procedure is as follows:  
* The table AirQualityDataBronx is populated with values corresponding to the data from 1 January 2020 to 31 December 2023, and NULL values will be used for each column;
* For each analyzed parameter, an API request to the EPA is made: \(\odot\) Using the CsvHelper library, the C# script first reads the CSV file containing the AQ value for the first parameter analyzed; \(\odot\) Each record from the CSV is parsed and transformed into an AirQualityRecord object, capturing the values for attributes such as the date, parameter type, and the corresponding \(AQI\) value for the parameter; \(\odot\) The script establishes a connection to the SQL database; \(\odot\) An SQL UPDATE command is run to modify the existing records in the AirQualityData table based on the new date; \(\odot\) The global \(AQI\) is computed as the maximum value for the AQ_CO, AQ_NO\({}_{2}\), AQ_SO\({}_{2}\), AQ_PM\({}_{2.5}\);
* A second API Request to Open NY is made to obtain a traffic dataset in the Bronx, representing the total number of cars transiting the county. To calculate the unit traffic data, the hourly traffic volume for each monitoring station in the Bronx was analyzed. At the source [63], the available dataset provided information on the number of vehicles passing through each station (broken down by inbound and outbound directions) at each hour of the day. The monitored locations are not explicitly mentioned, but the number of vehicles provided the information to compute the daily traffic volume for each station. The data are imported into the DailyTrafficData table. * A third Request to the OMAP is made to retrieve the temperature, humidity, and wind speed values for each day in the 2020-2023 interval. The data are imported into the BronxWeatherDataHistory table;
* The data from the tables AirQualityDataBronx, DailyTrafficData, and BronxWeatherDataHistory are imported into a single table named BronxStats;
* The records for which one of the monitored parameters had a NULL value were at random, and we removed them due to missing data in the CSV files for several days, ensuring data integrity for analysis. Figure 1 presents a map of the stations' locations for data collection, including the contaminant measurement station and the meteorological measurement station. Each pollutant has a formula that converts its concentration into an \(AQI\) value.