Ejemplo n.º 1
0
    common.constrain_to_domain('MITType',
                               allow_null=False,
                               domain='UICMITTypeDomain'))
type_domain_constraint.triggers = [config.triggers.update]

date_constraint_update = Constraint('MIT date', 'MITDate.update',
                                    common.constrain_to_required('MITDate'))
date_constraint_update.triggers = [config.triggers.update]

result_constraint_update = Constraint(
    'MIT result', 'MITResult.update',
    common.constrain_to_required('MITResult'))
result_constraint_update.triggers = [config.triggers.update]

type_constraint = Constraint('MIT Date and Type', 'MITDate',
                             load_rule_for(FOLDER, 'typeConstraint'))
type_constraint.triggers = [config.triggers.insert, config.triggers.update]

result_constraint = Constraint('MIT Result and Type', 'MITResult',
                               load_rule_for(FOLDER, 'resultConstraint'))
result_constraint.triggers = [config.triggers.insert, config.triggers.update]

remediation_constraint = Constraint(
    'MIT Remediation Action and Result', 'RemediationAction',
    load_rule_for(FOLDER, 'remedationConstraint'))
remediation_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]

remediation_date_constraint = Constraint(
    'Remediation Action Date and Remedation Action', 'RemActDate',
Ejemplo n.º 2
0
type_domain_constraint_update = Constraint(
    'Violation Type', 'ViolationType.update',
    common.constrain_to_domain('ViolationType',
                               allow_null=False,
                               domain='UICViolationTypeDomain'))
type_domain_constraint_update.triggers = [config.triggers.update]

contamination_domain_constraint = Constraint(
    'Contamination', 'USDWContamination.domain',
    common.constrain_to_domain('USDWContamination',
                               allow_null=True,
                               domain='UICYesNoUnknownDomain'))

contamination_domain_constraint_update = Constraint(
    'Contamination', 'USDWContamination.update',
    load_rule_for(FOLDER, 'wellRequiresContaminationConstraint'))
contamination_domain_constraint_update.triggers = [config.triggers.update]

endanger_domain_constraint = Constraint(
    'Endanger', 'Endanger',
    common.constrain_to_domain('Endanger',
                               allow_null=True,
                               domain='UICYesNoUnknownDomain'))

endanger_domain_constraint_update = Constraint(
    'Endanger', 'Endanger.update',
    common.constrain_to_domain('Endanger',
                               allow_null=False,
                               domain='UICYesNoUnknownDomain'))
endanger_domain_constraint_update.triggers = [config.triggers.update]
Ejemplo n.º 3
0
'''

from config import config
from models.ruletypes import Constant, Constraint
from services.loader import load_rule_for

from . import common

TABLE = 'UICWellOperatingStatus'
FOLDER = 'operatingStatus'

guid_constant = Constant('Well operating status Guid', 'GUID', 'GUID()')

type_domain_constraint = Constraint(
    'Operating Status Type', 'OperatingStatusType', common.constrain_to_domain('OperatingStatusType', allow_null=False, domain='UICOperatingStatusTypeDomain')
)
type_domain_constraint.triggers = [config.triggers.update]

date_constraint = Constraint('Operating Status Date', 'OperatingStatusDate', load_rule_for(FOLDER, 'dateConstraint'))
date_constraint.triggers = [config.triggers.insert, config.triggers.update]

type_constraint = Constraint('Operating status type needs a date', 'OperatingStatusType date requirement', load_rule_for(FOLDER, 'typeConstraint'))
type_constraint.triggers = [config.triggers.insert, config.triggers.update]

RULES = [
    guid_constant,
    type_domain_constraint,
    date_constraint,
    type_constraint,
]
Ejemplo n.º 4
0
well.py
A module that holds the rules for uicwells
'''

from . import common
from config import config
from services.loader import load_rule_for
from models.ruletypes import Calculation, Constant, Constraint

TABLE = 'UICWell'
FOLDER = 'well'

guid_constant = Constant('Well Guid', 'GUID', 'Guid()')

id_calculation = Calculation('Well Id', 'WellId',
                             load_rule_for(FOLDER, 'idCalculation'))
id_calculation.triggers = [config.triggers.insert, config.triggers.update]
id_calculation.editabe = config.editable.no

facility_calculation = Calculation(
    'Facility Fk', 'Facility_Fk', load_rule_for(FOLDER, 'facilityCalculation'))

class_constraint = Constraint(
    'Well Class', 'Class',
    common.constrain_to_domain('WellClass',
                               allow_null=True,
                               domain='UICWellClassDomain'))

class_constraint_update = Constraint(
    'Well Class', 'Class.update',
    common.constrain_to_domain('WellClass',
Ejemplo n.º 5
0
A module that has the UICAuthorization rules
'''

from config import config
from models.ruletypes import Calculation, Constant, Constraint
from services.loader import load_rule_for

from . import common

TABLE = 'UICAuthorization'
FOLDER = 'authorization'

guid_constant = Constant('Authorization Guid', 'GUID', 'GUID()')

id_calculation = Calculation('Authorization Id', 'AuthorizationID',
                             load_rule_for(FOLDER, 'idCalculation'))
id_calculation.triggers = [config.triggers.insert, config.triggers.update]
id_calculation.editable = config.editable.no

start_date_constraint_update = Constraint(
    'Start Date', 'StartDate.update',
    common.constrain_to_required('startdate'))
start_date_constraint_update.triggers = [config.triggers.update]

type_domain_constraint = Constraint(
    'Authorization Type', 'AuthorizationType',
    common.constrain_to_domain('AuthorizationType',
                               allow_null=True,
                               domain='UICAuthorizeTypeDomain'))

type_domain_constraint_update = Constraint(
Ejemplo n.º 6
0
type_constraint = Constraint(
    'Contact Type', 'ContactType',
    common.constrain_to_domain('ContactType',
                               allow_null=True,
                               domain='UICContactTypeDomain'))

type_constraint_update = Constraint(
    'Contact Type', 'ContactType.update',
    common.constrain_to_domain('ContactType',
                               allow_null=False,
                               domain='UICContactTypeDomain'))
type_constraint_update.triggers = [config.triggers.update]

contact_type_constraint = Constraint('Owner Operator', 'OwnerType',
                                     load_rule_for(FOLDER, 'contactType'))
contact_type_constraint.triggers = [config.triggers.update]

RULES = [
    guid_constant,
    type_constraint,
    state_constraint,
    contact_type_constraint,
    type_constraint_update,
    name_constraint_update,
    organization_constraint_update,
    address_constraint_update,
    phone_constraint_update,
    city_constraint_update,
    state_constraint_update,
    state_constraint,
Ejemplo n.º 7
0
guid_constant = Constant('Enforcement Guid', 'GUID', 'GUID()')

type_constraint = Constraint(
    'Enforcement Type', 'EnforcementType',
    common.constrain_to_domain('EnforcementType',
                               allow_null=True,
                               domain='UICEnforcementTypeDomain'))

type_constraint_update = Constraint(
    'Enforcement Type', 'EnforcementType.update',
    common.constrain_to_domain('EnforcementType',
                               allow_null=False,
                               domain='UICEnforcementTypeDomain'))
type_constraint_update.triggers = [config.triggers.update]

date_constraint = Constraint('Enforcement Date', 'EnforcementDate',
                             load_rule_for(FOLDER, 'dateConstraint'))
date_constraint.triggers = [config.triggers.insert, config.triggers.update]

comment_constraint = Constraint('Comment', 'Comment',
                                load_rule_for(FOLDER, 'commentConstraint'))
comment_constraint.triggers = [config.triggers.insert, config.triggers.update]

RULES = [
    guid_constant,
    type_constraint,
    type_constraint_update,
    date_constraint,
    comment_constraint,
]
Ejemplo n.º 8
0
TABLE = 'UICMIT'
FOLDER = 'mit'

guid_constant = Constant('MIT Guid', 'GUID', 'GUID()')

type_domain_constraint = Constraint('MIT type', 'Type', common.constrain_to_domain('MITType', allow_null=False, domain='UICMITTypeDomain'))
type_domain_constraint.triggers = [config.triggers.update]

date_constraint_update = Constraint('MIT date', 'MITDate.update', common.constrain_to_required('MITDate'))
date_constraint_update.triggers = [config.triggers.update]

result_constraint_update = Constraint('MIT result', 'MITResult.update', common.constrain_to_required('MITResult'))
result_constraint_update.triggers = [config.triggers.update]

type_constraint = Constraint('MIT Date and Type', 'MITDate', load_rule_for(FOLDER, 'typeConstraint'))
type_constraint.triggers = [config.triggers.insert, config.triggers.update]

result_constraint = Constraint('MIT Result and Type', 'MITResult', load_rule_for(FOLDER, 'resultConstraint'))
result_constraint.triggers = [config.triggers.insert, config.triggers.update]

remediation_constraint = Constraint('MIT Remediation Action and Result', 'RemediationAction', load_rule_for(FOLDER, 'remedationConstraint'))
remediation_constraint.triggers = [config.triggers.insert, config.triggers.update]

remediation_date_constraint = Constraint('Remediation Action Date and Remedation Action', 'RemActDate', load_rule_for(FOLDER, 'remediationDate'))
remediation_date_constraint.triggers = [config.triggers.insert, config.triggers.update]

comment_constraint = Constraint('Comment for Other Action', 'Comment', load_rule_for(FOLDER, 'commentConstraint'))
comment_constraint.triggers = [config.triggers.insert, config.triggers.update]

comment_mittype_constraint = Constraint('Comment for MIT Type', 'Comment.MITType', load_rule_for(FOLDER, 'commentMitTypeConstraint'))
Ejemplo n.º 9
0
'''
well.py
A module that holds the rules for uicwells
'''

from . import common
from config import config
from services.loader import load_rule_for
from models.ruletypes import Calculation, Constant, Constraint

TABLE = 'UICWell'
FOLDER = 'well'

guid_constant = Constant('Well Guid', 'GUID', 'Guid()')

id_calculation = Calculation('Well Id', 'WellId', load_rule_for(FOLDER, 'idCalculation'))
id_calculation.triggers = [config.triggers.insert, config.triggers.update]
id_calculation.editabe = config.editable.no

well_name_constraint = Constraint('Well Name', 'WellName', common.constrain_to_required('WellName'))
well_name_constraint.triggers = [config.triggers.update]

facility_calculation = Calculation('Facility Fk', 'Facility_Fk', load_rule_for(FOLDER, 'facilityCalculation'))

class_constraint = Constraint('Well Class', 'Class', common.constrain_to_domain('WellClass', allow_null=True, domain='UICWellClassDomain'))

class_constraint_update = Constraint('Well Class', 'Class.update', common.constrain_to_domain('WellClass', allow_null=False, domain='UICWellClassDomain'))
class_constraint_update.triggers = [config.triggers.update]

subclass_constraint = Constraint('Well Subclass', 'Subclass', load_rule_for(FOLDER, 'subClassConstraint'))
subclass_constraint.triggers = [config.triggers.insert, config.triggers.update]
Ejemplo n.º 10
0
deficiency_domain_constraint = Constraint(
    'Inspection Deficiency', 'InspectionDeficiency.domain',
    common.constrain_to_domain('InspectionDeficiency',
                               allow_null=True,
                               domain='UICDeficiencyDomain'))

deficiency_domain_constraint_update = Constraint(
    'Inspection Deficiency', 'InspectionDeficiency.update',
    common.constrain_to_domain('InspectionDeficiency',
                               allow_null=False,
                               domain='UICDeficiencyDomain'))
deficiency_domain_constraint_update.triggers = [config.triggers.update]

foreign_key_constraint = Constraint('One parent relation', 'Single Parent',
                                    load_rule_for(FOLDER, 'oneFKConstraint'))
foreign_key_constraint.triggers = [config.triggers.update]

facility_only_constraint = Constraint('NW for facility only', 'InspectionType',
                                      load_rule_for(FOLDER, 'typeConstraint'))
facility_only_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]

inspection_date_constraint = Constraint(
    'Well operating status date', 'InspectionDate',
    load_rule_for(FOLDER, 'dateConstraint'))
inspection_date_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]
Ejemplo n.º 11
0
well_type_constraint = Constraint(
    'Art Pen Well Type', 'ArtPen_WellType',
    common.constrain_to_domain('ArtPen_WellType',
                               allow_null=True,
                               domain='UICArtPenWellType'))

well_type_constraint_update = Constraint(
    'Art Pen Well Type', 'ArtPen_WellType.update',
    common.constrain_to_domain('ArtPen_WellType',
                               allow_null=False,
                               domain='UICArtPenWellType'))
well_type_constraint_update.triggers = [config.triggers.update]

review_date_constraint = Constraint(
    'Art Pen Review Date', 'Artpen_ReviewDate',
    load_rule_for(FOLDER, 'reviewDateConstraint'))
review_date_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]

catype_constraint = Constraint('Art Pen Review Date', 'ArtPen_CAType',
                               load_rule_for(FOLDER, 'caTypeConstraint'))
catype_constraint.triggers = [config.triggers.insert, config.triggers.update]

cadate_constraint = Constraint('CA Date', 'ArtPen_CADate',
                               load_rule_for(FOLDER, 'caDateConstraint'))
cadate_constraint.triggers = [config.triggers.insert, config.triggers.update]

comment_constraint = Constraint('Art Pen Other Ca', 'Comments',
                                load_rule_for(FOLDER, 'commentConstraint'))
comment_constraint.triggers = [config.triggers.update]
    'Authorization Action Type', 'AuthorizationActionType',
    common.constrain_to_domain('AuthorizationActionType',
                               allow_null=True,
                               domain='UICAuthorizeActionTypeDomain'))

action_type_domain_constraint_update = Constraint(
    'Authorization Action Type', 'AuthorizationActionType.update',
    common.constrain_to_domain('AuthorizationActionType',
                               allow_null=False,
                               domain='UICAuthorizeActionTypeDomain'))
action_type_domain_constraint_update.triggers = [config.triggers.update]

action_date_constraint = Constraint(
    'Authorization Action Date',
    'AuthorizationActionDate and AuthorizationActionType',
    load_rule_for(FOLDER, 'dateConstraint'))
action_date_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]

action_type_constraint = Constraint(
    'Authorization Action Type',
    'AuthorizationActionType and AuthorizationActionDate',
    load_rule_for(FOLDER, 'typeConstraint'))
action_type_constraint.triggers = [
    config.triggers.insert, config.triggers.update
]

RULES = [
    guid_constant,
    action_type_domain_constraint,
Ejemplo n.º 13
0
A module that creates attribute rules for the UICFacility table
'''

from config import config
from models.ruletypes import Calculation, Constant, Constraint
from services.loader import load_rule_for

from . import common

TABLE = 'UICFacility'
FOLDER = 'facility'

guid_constant = Constant('Facility Guid', 'GUID', 'Guid()')

fips_calculation = Calculation('County Fips', 'CountyFIPS',
                               load_rule_for(FOLDER, 'fipsCalculation'))

id_calculation = Calculation('Facility Id', 'FacilityID',
                             load_rule_for(FOLDER, 'idCalculation'))
id_calculation.triggers = [config.triggers.insert, config.triggers.update]
id_calculation.editable = config.editable.no

city_calculation = Calculation('Facility City', 'FacilityCity',
                               load_rule_for(FOLDER, 'cityCalculation'))

zip_calculation = Calculation('Facility Zip', 'FacilityZIP',
                              load_rule_for(FOLDER, 'zipCalculation'))

fips_domain_constraint = Constraint('County Fips', 'FIPS',
                                    load_rule_for(FOLDER, 'fipsConstraint'))
fips_domain_constraint.triggers = [
Ejemplo n.º 14
0
    'Contamination', 'USDWContamination', common.constrain_to_domain('USDWContamination', allow_null=True, domain='UICYesNoUnknownDomain')
)

contamination_domain_constraint_update = Constraint(
    'Contamination', 'USDWContamination.update', common.constrain_to_domain('USDWContamination', allow_null=False, domain='UICYesNoUnknownDomain')
)
contamination_domain_constraint_update.triggers = [config.triggers.update]

endanger_domain_constraint = Constraint('Endanger', 'Endanger', common.constrain_to_domain('Endanger', allow_null=True, domain='UICYesNoUnknownDomain'))

endanger_domain_constraint_update = Constraint(
    'Endanger', 'Endanger.update', common.constrain_to_domain('Endanger', allow_null=False, domain='UICYesNoUnknownDomain')
)
endanger_domain_constraint_update.triggers = [config.triggers.update]

contamination_calculation = Calculation('Significant Non Compliance', 'SignificantNonCompliance', load_rule_for(FOLDER, 'significantNonComplianceCalculation'))
contamination_calculation.triggers = [config.triggers.insert, config.triggers.update]

noncompliance_domain_constraint = Constraint(
    'SignificantNonCompliance', 'SignificantNonCompliance.domain',
    common.constrain_to_domain('SignificantNonCompliance', allow_null=True, domain='UICYesNoUnknownDomain')
)

noncompliance_domain_constraint_update = Constraint(
    'SignificantNonCompliance', 'SignificantNonCompliance.update',
    common.constrain_to_domain('SignificantNonCompliance', allow_null=False, domain='UICYesNoUnknownDomain')
)
noncompliance_domain_constraint_update.triggers = [config.triggers.update]

comment_constraint = Constraint('Comments required for other', 'Comments', load_rule_for(FOLDER, 'commentConstraint'))
comment_constraint.triggers = [config.triggers.insert, config.triggers.update]
assistance_domain_constraint_update = Constraint(
    'Inspection Assistance', 'InspectionAssistance',
    common.constrain_to_domain('InspectionAssistance', allow_null=False, domain='UICComplianceAssistanceDomain')
)
assistance_domain_constraint_update.triggers = [config.triggers.update]

deficiency_domain_constraint = Constraint(
    'Inspection Deficiency', 'InspectionDeficiency.domain', common.constrain_to_domain('InspectionDeficiency', allow_null=True, domain='UICDeficiencyDomain')
)

deficiency_domain_constraint_update = Constraint(
    'Inspection Deficiency', 'InspectionDeficiency.update', common.constrain_to_domain('InspectionDeficiency', allow_null=False, domain='UICDeficiencyDomain')
)
deficiency_domain_constraint_update.triggers = [config.triggers.update]

foreign_key_constraint = Constraint('One parent relation', 'Single Parent', load_rule_for(FOLDER, 'oneFKConstraint'))
foreign_key_constraint.triggers = [config.triggers.update]

facility_only_constraint = Constraint('NW for facility only', 'InspectionType', load_rule_for(FOLDER, 'typeConstraint'))
facility_only_constraint.triggers = [config.triggers.insert, config.triggers.update]

inspection_date_constraint = Constraint('Well operating status date', 'InspectionDate', load_rule_for(FOLDER, 'dateConstraint'))
inspection_date_constraint.triggers = [config.triggers.insert, config.triggers.update]

deficiency_constraint = Constraint('No Deficiency', 'InspectionDeficiency', load_rule_for(FOLDER, 'deficiencyConstraint'))
deficiency_constraint.triggers = [config.triggers.insert, config.triggers.update]

name_constraint_update = Constraint('Name is required', 'Inspector', common.constrain_to_required('Inspector'))
name_constraint_update.triggers = [config.triggers.update]

RULES = [