X

Track changes made to this page

If you find this page useful and would like to be notified of changes made to this page, start by inputting your email below.



Privacy policy
Close this window

powered by ChangeDetection

Violation Count Generation

The Violation Count comes directly from the well table.


WellDataConfig.py

From WellDataConfig.py in ~/wiki/installers/wikimanager/Config:

wellDetailsTablesSelectionColumns = dict(

municipality='MUNICIPALITY_NAME_LONG',
county='COUNTY_NAME, STATE_CODE',
# permit='OPERATOR_NAME',#, OPERATOR_OGO',
unconventional='FARM_NAME',
# production='WELL_STATUS',
well='WELL_STATUS, WELL_PAD_ID, FIRST_PERMIT_ISSUED_DATE, LAST_PERMIT_ISSUED_DATE, SPUD_DATE, UNCONVENTIONAL, HORIZONTAL_WELL, OPERATOR_NAME, VIOLATION_COUNT, LATITUDE_DECIMAL, LONGITUDE_DECIMAL')


WellDataAccessor.py

This is referenced by WellDataAccessor.py in ~/wiki/installers/wikimanager/DBUtil:

elif table == 'well':

sqlStr = 'SELECT ' + wdc.wellDetailsTablesSelectionColumns[table] + ' FROM ' + table + ' WHERE ' + \                               
wdc.wellDataDBTableIDs[table] + ' = \ + self.wellID + '\


WellSourceBuilder.py

which returns the data dictionary to WellSourceBuilder.py in ~/wiki/installers/wikimanager/FileUtil/SourceBuilders. WellSourceBuilder.py generates the wiki text by a series of if statements.


pre_deployment.sql

pre_deployment.sql ~/installers/wikimanager/ calculates and updates the violation count based on the compliance and violation tables. This script counts the number of instances of unique VIOLATION_ID_PKs in the violation table for a particular well API. Because WELL_APIs do not exist in the violation table, a WELL_API's associated violations are found by joining compliance (which contains WELL_APIs and INSP_ID_PKs) and violation. The inaccurate count stems from the fact that every INSP_ID_PK in compliance has at least one corresponding INSP_ID_FK and VIOLATION_ID_PK in violation, even if there was no violation and the VIOLATION_ID is NULL. We do not know how these rows came to be in the table; there are primarily filled with NULL/'0000-00-00' values. We are working around this right now by adding the condition that a violation can only be counted if its VIOLATION_ID is not NULL. In the long term, we would like to eliminate all of the rows of NULLs and zeros from violation.