generated from edgi-govdata-archiving/Template
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
region_state_test.py
96 lines (83 loc) · 2.91 KB
/
region_state_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import pdb
from Region import Region
import pandas as pd
programs = ['CAA', 'CWA', 'RCRA']
region = Region(db='region_cds.db', type='State', state='AK',
base_year=2023, programs=programs)
inflation = region.get_inflation()
print("Inflation")
print(inflation)
df = region.get_per_1000('inspections', 'USA')
print("USA inspections")
print(df)
df = region.get_per_1000('violations', 'USA')
print("USA violations")
print(df)
df = region.get_per_1000('violations', 'State')
print("State violations")
print(df)
'''
cwa_per_1000 = region.get_cwa_per_1000(2021)
print("CWA violations per 1000 facilities")
print(cwa_per_1000)
'''
print('CAA active facilities: {}'.format(region.get_active_facilities('CAA')))
print('CWA active facilities: {}'.format(region.get_active_facilities('CWA')))
print('RCRA active facilities: {}'.format(region.get_active_facilities('RCRA')))
print('GHG active facilities: {}'.format(region.get_active_facilities('GHG')))
CAArecurring = region.get_recurring_violations('CAA')
print(CAArecurring)
CWArecurring = region.get_recurring_violations('CWA')
print(CWArecurring)
RCRArecurring = region.get_recurring_violations('RCRA')
print(RCRArecurring)
violations = region.get_events('violations', 'All')
print("Violations")
print(" All programs")
print(violations)
CAAviolations = region.get_events('violations', 'CAA')
print(" CAA")
print(CAAviolations)
CWAviolations = region.get_events('violations', 'CWA')
print(" CWA")
print(CWAviolations)
RCRAviolations = region.get_events('violations', 'RCRA')
print(" RCRA")
print(RCRAviolations)
enforcement = region.get_events('enforcements', 'All')
print("Enforcements")
print(" All Programs")
print(enforcement)
CAAenforcement = region.get_events('enforcements', 'CAA')
print(" CAA")
print(CAAenforcement)
CWAenforcement = region.get_events('enforcements', 'CWA')
print(" CWA")
print(CWAenforcement)
RCRAenforcement = region.get_events('enforcements', 'RCRA')
print(" RCRA")
print(RCRAenforcement)
inspections = region.get_events('inspections', 'All')
print("Inspections")
print(inspections)
CAAinspections = region.get_events('inspections', 'CAA')
print(CAAinspections)
CWAinspections = region.get_events('inspections', 'CWA')
print(CWAinspections)
RCRAinspections = region.get_events('inspections', 'RCRA')
print(RCRAinspections)
print('Per 1000 - inspections')
inspectionsper1000_state = region.get_per_1000('inspections', 'State')
print(inspectionsper1000_state)
print('Per 1000 - violations')
violationsper1000_state = region.get_per_1000('violations', 'State')
print(violationsper1000_state)
CAAbadactors = region.get_non_compliants('CAA')
print('CAA Non-compliants')
print(CAAbadactors[['fac_name', 'noncomp_count']])
CWAbadactors = region.get_non_compliants('CWA')
print('CWA Non-compliants')
print(CWAbadactors[['fac_name', 'noncomp_count']])
RCRAbadactors = region.get_non_compliants('RCRA')
print('RCRA Non-compliants')
print(RCRAbadactors[['fac_name', 'noncomp_count']])