class tblS6AccidentChemicals(BaseRMPModel): accidentchemicalid = CopyFromIntegerField( source_column='AccidentChemicalID', primary_key=True, ) accidenthistoryid = CopyFromForeignKey( 'tblS6AccidentHistory', source_column='AccidentHistoryID', on_delete=models.PROTECT, ) chemicalid = CopyFromForeignKey( 'tlkpChemicals', source_column='ChemicalID', on_delete=models.PROTECT, ) quantityreleased = CopyFromFloatField( source_column='QuantityReleased', null=True, ) percentweight = CopyFromFloatField( source_column='PercentWeight', null=True, ) class Meta: verbose_name = 'Accident History: Chemicals' verbose_name_plural = 'Accident History: Chemicals'
class tblS4FlammablesWorstCase(BaseRMPModel): FlammableID = CopyFromIntegerField(primary_key=True, ) ProcessChemicalID = CopyFromForeignKey( 'tblS1ProcessChemicals', db_column='ProcessChemicalID', on_delete=models.PROTECT, ) AnalyticalBasis = CopyFromCharField( max_length=255, blank=True, ) QuantityReleased = CopyFromFloatField(null=True, ) Distance2Endpoint = CopyFromFloatField(null=True, ) ResidentialPopulation = CopyFromCharField( max_length=9, blank=True, ) PR_Schools = CopyFromBooleanField() PR_Residences = CopyFromBooleanField() PR_Hospitals = CopyFromBooleanField() PR_Prisons = CopyFromBooleanField() PR_PublicRecreation = CopyFromBooleanField() PR_Comm_Ind = CopyFromBooleanField() PR_OtherType = CopyFromCharField( max_length=200, blank=True, ) ER_NatlStateParks = CopyFromBooleanField() ER_WildlifeSactuary = CopyFromBooleanField() ER_FedWilderness = CopyFromBooleanField() ER_OtherType = CopyFromCharField( max_length=200, blank=True, ) PM_BlastWalls = CopyFromBooleanField() PM_OtherType = CopyFromCharField( max_length=200, blank=True, ) ptrGraphic = CopyFromCharField( max_length=12, blank=True, ) CBI_Flag = CopyFromBooleanField() class Meta: verbose_name = 'Flammables: Worst Case Scenario'
class tblS6AccidentChemicals(BaseRMPModel): AccidentChemicalID = CopyFromIntegerField(primary_key=True, ) AccidentHistoryID = CopyFromForeignKey( 'tblS6AccidentHistory', db_column='AccidentHistoryID', on_delete=models.PROTECT, ) ChemicalID = CopyFromForeignKey( 'tlkpChemicals', db_column='ChemicalID', on_delete=models.PROTECT, ) QuantityReleased = CopyFromFloatField(null=True, ) PercentWeight = CopyFromFloatField(null=True, ) class Meta: verbose_name = 'Accident History: Chemicals' verbose_name_plural = 'Accident History: Chemicals'
class tblS6AccidentHistory(BaseRMPModel): AccidentHistoryID = CopyFromIntegerField( primary_key=True, ) FacilityID = CopyFromForeignKey( 'Tbls1Facilities', db_column='FacilityID', on_delete=models.PROTECT, ) AccidentDate = CopyFromDateTimeField( null=True, ) AccidentTime = CopyFromCharField( max_length=4, blank=True, ) NAICSCode = CopyFromForeignKey( 'tlkpNAICS', db_column='NAICSCode', on_delete=models.PROTECT, blank=True, ) AccidentReleaseDuration = CopyFromCharField( max_length=5, blank=True, ) RE_Gas = CopyFromBooleanField( ) RE_Spill = CopyFromBooleanField( ) RE_Fire = CopyFromBooleanField( ) RE_Explosion = CopyFromBooleanField( ) RE_ReactiveIncident = CopyFromBooleanField( ) RS_StorageVessel = CopyFromBooleanField( ) RS_Piping = CopyFromBooleanField( ) RS_ProcessVessel = CopyFromBooleanField( ) RS_TransferHose = CopyFromBooleanField( ) RS_Valve = CopyFromBooleanField( ) RS_Pump = CopyFromBooleanField( ) RS_Joint = CopyFromBooleanField( ) OtherReleaseSource = CopyFromCharField( max_length=200, blank=True, ) WindSpeed = CopyFromFloatField( null=True, ) WindSpeedUnitCode = CopyFromForeignKey( 'tlkpWindSpeedUnitCodes', db_column='WindSpeedUnitCode', on_delete=models.PROTECT, blank=True, ) WindDirection = CopyFromCharField( max_length=3, blank=True, ) Temperature = CopyFromFloatField( null=True, ) StabilityClass = CopyFromCharField( max_length=1, blank=True, ) Precipitation = CopyFromBooleanField( ) WeatherUnknown = CopyFromBooleanField( ) DeathsWorkers = CopyFromIntegerField( null=True, ) DeathsPublicResponders = CopyFromIntegerField( null=True, ) DeathsPublic = CopyFromIntegerField( null=True, ) InjuriesWorkers = CopyFromIntegerField( null=True, ) InjuriesPublicResponders = CopyFromIntegerField( null=True, ) InjuriesPublic = CopyFromIntegerField( null=True, ) OnsitePropertyDamage = CopyFromFloatField( null=True, ) OffsiteDeaths = CopyFromBooleanField( null=True, ) Hospitalization = CopyFromFloatField( null=True, ) MedicalTreatment = CopyFromFloatField( null=True, ) Evacuated = CopyFromFloatField( null=True, ) ShelteredInPlace = CopyFromFloatField( null=True, ) OffsitePropertyDamage = CopyFromFloatField( null=True, ) ED_Kills = CopyFromBooleanField( ) ED_MinorDefoliation = CopyFromBooleanField( ) ED_WaterContamination = CopyFromBooleanField( ) ED_SoilContamination = CopyFromBooleanField( ) ED_Other = CopyFromCharField( max_length=200, blank=True, ) InitiatingEvent = CopyFromForeignKey( 'tlkpS6InitiatingEvents', on_delete=models.PROTECT, blank=True, ) CF_EquipmentFailure = CopyFromBooleanField( ) CF_HumanError = CopyFromBooleanField( ) CF_ImproperProcedure = CopyFromBooleanField( ) CF_Overpressurization = CopyFromBooleanField( ) CF_UpsetCondition = CopyFromBooleanField( ) CF_BypassCondition = CopyFromBooleanField( ) CF_Maintenance = CopyFromBooleanField( ) CF_ProcessDesignFailure = CopyFromBooleanField( ) CF_UnsuitableEquipment = CopyFromBooleanField( ) CF_UnusualWeather = CopyFromBooleanField( ) CF_ManagementError = CopyFromBooleanField( ) CF_Other = CopyFromCharField( max_length=200, blank=True, ) OffsiteRespondersNotify = CopyFromCharField( max_length=25, blank=True, ) CI_ImprovedEquipment = CopyFromBooleanField( ) CI_RevisedMaintenance = CopyFromBooleanField( ) CI_RevisedTraining = CopyFromBooleanField( ) CI_RevisedOpProcedures = CopyFromBooleanField( ) CI_NewProcessControls = CopyFromBooleanField( ) CI_NewMitigationSystems = CopyFromBooleanField( ) CI_RevisedERPlan = CopyFromBooleanField( ) CI_ChangedProcess = CopyFromBooleanField( ) CI_ReducedInventory = CopyFromBooleanField( ) CI_None = CopyFromBooleanField( ) CI_OtherType = CopyFromCharField( max_length=200, blank=True, ) CBI_Flag = CopyFromBooleanField( ) class Meta: verbose_name = 'Accident History' verbose_name_plural = 'Accident History'
class tblS2ToxicsWorstCase(BaseRMPModel): toxicid = CopyFromIntegerField( primary_key=True, source_column='ToxicID', ) processchemicalid = CopyFromForeignKey( 'tblS1ProcessChemicals', on_delete=models.PROTECT, source_column='ProcessChemicalID', ) percentweight = CopyFromFloatField( source_column='PercentWeight', null=True, ) physicalstate = CopyFromCharField( source_column='PhysicalState', max_length=1, blank=True, ) analyticalbasis = CopyFromCharField( source_column='AnalyticalBasis', max_length=255, blank=True, ) scenario = CopyFromBooleanField( source_column='Scenario', null=True, ) quantityreleased = CopyFromFloatField( source_column='QuantityReleased', null=True, ) releaseduration = CopyFromFloatField( source_column='ReleaseDuration', null=True, ) releaserate = CopyFromFloatField( source_column='ReleaseRate', null=True, ) windspeed = CopyFromFloatField(source_column='WindSpeed', ) stabilityclass = CopyFromCharField( source_column='StabilityClass', max_length=1, blank=True, ) topography = CopyFromForeignKey( 'tlkpTopographyCode', on_delete=models.PROTECT, source_column='Topography', blank=True, ) endpoint_distance = CopyFromFloatField( source_column='Distance2Endpoint', null=True, ) residentialpopulation = CopyFromBigIntegerField( source_column='ResidentialPopulation', null=True, ) pr_schools = CopyFromBooleanField(source_column='PR_Schools', ) pr_residences = CopyFromBooleanField(source_column='PR_Residences', ) pr_hospitals = CopyFromBooleanField(source_column='PR_Hospitals', ) pr_prisons = CopyFromBooleanField(source_column='PR_Prisons', ) pr_publicrecreation = CopyFromBooleanField( source_column='PR_PublicRecreation', ) pr_comm_ind = CopyFromBooleanField(source_column='PR_Comm_Ind', ) pr_othertype = CopyFromCharField( source_column='PR_OtherType', max_length=200, blank=True, ) er_natlstateparks = CopyFromBooleanField( source_column='ER_NatlStateParks', ) er_wildlifesactuary = CopyFromBooleanField( source_column='ER_WildlifeSactuary', ) er_fedwilderness = CopyFromBooleanField(source_column='ER_FedWilderness', ) er_othertype = CopyFromCharField( source_column='ER_OtherType', max_length=200, blank=True, ) pm_dikes = CopyFromBooleanField(source_column='PM_Dikes', ) pm_enclosures = CopyFromBooleanField(source_column='PM_Enclosures', ) pm_berms = CopyFromBooleanField(source_column='PM_Berms', ) pm_drains = CopyFromBooleanField(source_column='PM_Drains', ) pm_sumps = CopyFromBooleanField(source_column='PM_Sumps', ) pm_othertype = CopyFromCharField( source_column='PM_OtherType', max_length=200, blank=True, ) ptrgraphic = CopyFromBooleanField( source_column='ptrGraphic', max_length=12, null=True, ) cbi_flag = CopyFromBooleanField(source_column='CBI_Flag', ) class Meta: verbose_name = 'Toxics: Worst Case Scenario' verbose_name_plural = 'Toxics: Worst Case Scenarios'
class tblS3ToxicsAltReleases(BaseRMPModel): ToxicID = CopyFromIntegerField(primary_key=True, ) ProcessChemicalID = CopyFromForeignKey( 'tblS1ProcessChemicals', on_delete=models.PROTECT, db_column='ProcessChemicalID', ) PercentWeight = CopyFromFloatField(null=True, ) PhysicalState = CopyFromForeignKey( 'tlkpPhysicalStateCodes', on_delete=models.PROTECT, blank=True, db_column='PhysicalState', ) AnalyticalBasis = CopyFromCharField( max_length=255, blank=True, ) Scenario = CopyFromCharField( max_length=200, blank=True, ) QuantityReleased = CopyFromFloatField(null=True, ) ReleaseDuration = CopyFromFloatField(null=True, ) ReleaseRate = CopyFromFloatField(null=True, ) WindSpeed = CopyFromFloatField(null=True, ) StabilityClass = CopyFromCharField( max_length=1, blank=True, ) Topography = CopyFromForeignKey( 'tlkpTopographyCode', on_delete=models.PROTECT, blank=True, db_column='Topography', ) Distance2Endpoint = CopyFromFloatField(null=True, ) ResidentialPopulation = CopyFromBigIntegerField(null=True, ) PR_Schools = CopyFromBooleanField() PR_Residences = CopyFromBooleanField() PR_Hospitals = CopyFromBooleanField() PR_Prisons = CopyFromBooleanField() PR_PublicRecreation = CopyFromBooleanField() PR_Comm_Ind = CopyFromBooleanField() PR_OtherType = CopyFromCharField( max_length=200, blank=True, ) ER_NatlStateParks = CopyFromBooleanField() ER_WildlifeSactuary = CopyFromBooleanField() ER_FedWilderness = CopyFromBooleanField() ER_OtherType = CopyFromCharField( max_length=200, blank=True, ) PM_Dikes = CopyFromBooleanField() PM_Enclosures = CopyFromBooleanField() PM_Berms = CopyFromBooleanField() PM_Drains = CopyFromBooleanField() PM_Sumps = CopyFromBooleanField() PM_OtherType = CopyFromCharField( max_length=200, blank=True, ) AM_SprinklerSystems = CopyFromBooleanField() AM_DelugeSystems = CopyFromBooleanField() AM_WaterCurtain = CopyFromBooleanField() AM_Neutralization = CopyFromBooleanField() AM_ExcessFlowValve = CopyFromBooleanField() AM_Flares = CopyFromBooleanField() AM_Scrubbers = CopyFromBooleanField() AM_EmergencyShutdown = CopyFromBooleanField() AM_OtherType = CopyFromCharField( max_length=200, blank=True, ) ptrGraphic = CopyFromCharField( max_length=12, blank=True, ) CBI_Flag = CopyFromBooleanField() class Meta: verbose_name = 'Toxics: Alternative Release Scenario'
class tblS6AccidentHistory(BaseRMPModel): accidenthistoryid = CopyFromIntegerField( source_column='AccidentHistoryID', primary_key=True, ) facilityid = CopyFromForeignKey( 'Tbls1Facilities', source_column='FacilityID', on_delete=models.PROTECT, ) accidentdate = CopyFromDateTimeField( source_column='AccidentDate', null=True, ) accidenttime = CopyFromCharField( source_column='AccidentTime', max_length=4, blank=True, ) naicscode = CopyFromForeignKey( 'tlkpNAICS', source_column='NAICSCode', on_delete=models.PROTECT, blank=True, ) accidentreleaseduration = CopyFromCharField( source_column='AccidentReleaseDuration', max_length=5, blank=True, ) re_gas = CopyFromBooleanField(source_column='RE_Gas', ) re_spill = CopyFromBooleanField(source_column='RE_Spill', ) re_fire = CopyFromBooleanField(source_column='RE_Fire', ) re_explosion = CopyFromBooleanField(source_column='RE_Explosion', ) re_reactiveincident = CopyFromBooleanField( source_column='RE_ReactiveIncident', ) rs_storagevessel = CopyFromBooleanField(source_column='RS_StorageVessel', ) rs_piping = CopyFromBooleanField(source_column='RS_Piping', ) rs_processvessel = CopyFromBooleanField(source_column='RS_ProcessVessel', ) rs_transferhose = CopyFromBooleanField(source_column='RS_TransferHose', ) rs_valve = CopyFromBooleanField(source_column='RS_Valve', ) rs_pump = CopyFromBooleanField(source_column='RS_Pump', ) rs_joint = CopyFromBooleanField(source_column='RS_Joint', ) otherreleasesource = CopyFromCharField( source_column='OtherReleaseSource', max_length=200, blank=True, ) windspeed = CopyFromFloatField( source_column='WindSpeed', null=True, ) windspeedunitcode = CopyFromForeignKey( 'tlkpWindSpeedUnitCodes', source_column='WindSpeedUnitCode', on_delete=models.PROTECT, blank=True, ) winddirection = CopyFromCharField( source_column='WindDirection', max_length=3, blank=True, ) temperature = CopyFromFloatField( source_column='Temperature', null=True, ) stabilityclass = CopyFromCharField( source_column='StabilityClass', max_length=1, blank=True, ) precipitation = CopyFromBooleanField(source_column='Precipitation', ) weatherunknown = CopyFromBooleanField(source_column='WeatherUnknown', ) deathsworkers = CopyFromIntegerField( source_column='DeathsWorkers', null=True, ) deathspublicresponders = CopyFromIntegerField( source_column='DeathsPublicResponders', null=True, ) deathspublic = CopyFromIntegerField( source_column='DeathsPublic', null=True, ) injuriesworkers = CopyFromIntegerField( source_column='InjuriesWorkers', null=True, ) injuriespublicresponders = CopyFromIntegerField( source_column='InjuriesPublicResponders', null=True, ) injuriespublic = CopyFromIntegerField( source_column='InjuriesPublic', null=True, ) onsitepropertydamage = CopyFromFloatField( source_column='OnsitePropertyDamage', null=True, ) offsitedeaths = CopyFromBooleanField( source_column='OffsiteDeaths', null=True, ) hospitalization = CopyFromFloatField( source_column='Hospitalization', null=True, ) medicaltreatment = CopyFromFloatField( source_column='MedicalTreatment', null=True, ) evacuated = CopyFromFloatField( source_column='Evacuated', null=True, ) shelteredinplace = CopyFromFloatField( source_column='ShelteredInPlace', null=True, ) offsitepropertydamage = CopyFromFloatField( source_column='OffsitePropertyDamage', null=True, ) ed_kills = CopyFromBooleanField(source_column='ED_Kills', ) ed_minordefoliation = CopyFromBooleanField( source_column='ED_MinorDefoliation', ) ed_watercontamination = CopyFromBooleanField( source_column='ED_WaterContamination', ) ed_soilcontamination = CopyFromBooleanField( source_column='ED_SoilContamination', ) ed_other = CopyFromCharField( source_column='ED_Other', max_length=200, blank=True, ) initiatingevent = CopyFromForeignKey( 'tlkpS6InitiatingEvents', source_column='InitiatingEvent', on_delete=models.PROTECT, blank=True, ) cf_equipmentfailure = CopyFromBooleanField( source_column='CF_EquipmentFailure', ) cf_humanerror = CopyFromBooleanField(source_column='CF_HumanError', ) cf_improperprocedure = CopyFromBooleanField( source_column='CF_ImproperProcedure', ) cf_overpressurization = CopyFromBooleanField( source_column='CF_Overpressurization', ) cf_upsetcondition = CopyFromBooleanField( source_column='CF_UpsetCondition', ) cf_bypasscondition = CopyFromBooleanField( source_column='CF_BypassCondition', ) cf_maintenance = CopyFromBooleanField(source_column='CF_Maintenance', ) cf_processdesignfailure = CopyFromBooleanField( source_column='CF_ProcessDesignFailure', ) cf_unsuitableequipment = CopyFromBooleanField( source_column='CF_UnsuitableEquipment', ) cf_unusualweather = CopyFromBooleanField( source_column='CF_UnusualWeather', ) cf_managementerror = CopyFromBooleanField( source_column='CF_ManagementError', ) cf_other = CopyFromCharField( source_column='CF_Other', max_length=200, blank=True, ) offsiterespondersnotify = CopyFromCharField( source_column='OffsiteRespondersNotify', max_length=25, blank=True, ) ci_improvedequipment = CopyFromBooleanField( source_column='CI_ImprovedEquipment', ) ci_revisedmaintenance = CopyFromBooleanField( source_column='CI_RevisedMaintenance', ) ci_revisedtraining = CopyFromBooleanField( source_column='CI_RevisedTraining', ) ci_revisedopprocedures = CopyFromBooleanField( source_column='CI_RevisedOpProcedures', ) ci_newprocesscontrols = CopyFromBooleanField( source_column='CI_NewProcessControls', ) ci_newmitigationsystems = CopyFromBooleanField( source_column='CI_NewMitigationSystems', ) ci_revisederplan = CopyFromBooleanField(source_column='CI_RevisedERPlan', ) ci_changedprocess = CopyFromBooleanField( source_column='CI_ChangedProcess', ) ci_reducedinventory = CopyFromBooleanField( source_column='CI_ReducedInventory', ) ci_none = CopyFromBooleanField(source_column='CI_None', ) ci_othertype = CopyFromCharField( source_column='CI_OtherType', max_length=200, blank=True, ) cbi_flag = CopyFromBooleanField(source_column='CBI_Flag', ) class Meta: verbose_name = 'Accident History' verbose_name_plural = 'Accident History'
class tblS4FlammablesWorstCase(BaseRMPModel): flammableid = CopyFromIntegerField( source_column='FlammableID', primary_key=True, ) processchemicalid = CopyFromForeignKey( 'tblS1ProcessChemicals', source_column='ProcessChemicalID', on_delete=models.PROTECT, ) analyticalbasis = CopyFromCharField( source_column='AnalyticalBasis', max_length=255, blank=True, ) quantityreleased = CopyFromFloatField( source_column='QuantityReleased', null=True, ) endpoint_distance = CopyFromFloatField( source_column='Distance2Endpoint', null=True, ) residentialpopulation = CopyFromCharField( source_column='ResidentialPopulation', max_length=9, blank=True, ) pr_schools = CopyFromBooleanField(source_column='PR_Schools', ) pr_residences = CopyFromBooleanField(source_column='PR_Residences', ) pr_hospitals = CopyFromBooleanField(source_column='PR_Hospitals', ) pr_prisons = CopyFromBooleanField(source_column='PR_Prisons', ) pr_publicrecreation = CopyFromBooleanField( source_column='PR_PublicRecreation', ) pr_comm_ind = CopyFromBooleanField(source_column='PR_Comm_Ind', ) pr_othertype = CopyFromCharField( source_column='PR_OtherType', max_length=200, blank=True, ) er_natlstateparks = CopyFromBooleanField( source_column='ER_NatlStateParks', ) er_wildlifesactuary = CopyFromBooleanField( source_column='ER_WildlifeSactuary', ) er_fedwilderness = CopyFromBooleanField(source_column='ER_FedWilderness', ) er_othertype = CopyFromCharField( source_column='ER_OtherType', max_length=200, blank=True, ) pm_blastwalls = CopyFromBooleanField(source_column='PM_BlastWalls', ) pm_othertype = CopyFromCharField( source_column='PM_OtherType', max_length=200, blank=True, ) ptrgraphic = CopyFromCharField( source_column='ptrGraphic', max_length=12, blank=True, ) cbi_flag = CopyFromBooleanField(source_column='CBI_Flag', ) class Meta: verbose_name = 'Flammables: Worst Case Scenario'
class tblS2ToxicsWorstCase(BaseRMPModel): ToxicID = CopyFromIntegerField(primary_key=True, ) ProcessChemicalID = CopyFromForeignKey( 'tblS1ProcessChemicals', on_delete=models.PROTECT, ) PercentWeight = CopyFromFloatField(null=True, ) PhysicalState = CopyFromCharField( source_column='PhysicalState', max_length=1, blank=True, ) AnalyticalBasis = CopyFromCharField( max_length=255, blank=True, ) Scenario = CopyFromBooleanField(null=True, ) QuantityReleased = CopyFromFloatField(null=True, ) ReleaseDuration = CopyFromFloatField(null=True, ) ReleaseRate = CopyFromFloatField(null=True, ) WindSpeed = CopyFromFloatField() StabilityClass = CopyFromCharField( max_length=1, blank=True, ) Topography = CopyFromForeignKey( 'tlkpTopographyCode', db_column='Topography', on_delete=models.PROTECT, blank=True, ) Distance2Endpoint = CopyFromFloatField(null=True, ) ResidentialPopulation = CopyFromBigIntegerField(null=True, ) PR_Schools = CopyFromBooleanField() PR_Residences = CopyFromBooleanField() PR_Hospitals = CopyFromBooleanField() PR_Prisons = CopyFromBooleanField() PR_PublicRecreation = CopyFromBooleanField() PR_Comm_Ind = CopyFromBooleanField() PR_OtherType = CopyFromCharField( max_length=200, blank=True, ) ER_NatlStateParks = CopyFromBooleanField() ER_WildlifeSactuary = CopyFromBooleanField() ER_FedWilderness = CopyFromBooleanField() ER_OtherType = CopyFromCharField( max_length=200, blank=True, ) PM_Dikes = CopyFromBooleanField() PM_Enclosures = CopyFromBooleanField() PM_Berms = CopyFromBooleanField() PM_Drains = CopyFromBooleanField() PM_Sumps = CopyFromBooleanField() PM_OtherType = CopyFromCharField( max_length=200, blank=True, ) ptrGraphic = CopyFromBooleanField( max_length=12, null=True, ) CBI_Flag = CopyFromBooleanField() class Meta: verbose_name = 'Toxics: Worst Case Scenario' verbose_name_plural = 'Toxics: Worst Case Scenarios'
class tblS5FlammablesAltReleases(BaseRMPModel): flammableid = CopyFromIntegerField( primary_key=True, source_column='FlammableID', ) processchemicalid = CopyFromForeignKey( 'tblS1ProcessChemicals', on_delete=models.PROTECT, source_column='ProcessChemicalID', ) analyticalbasis = CopyFromCharField( source_column='AnalyticalBasis', max_length=255, blank=True, ) scenario = CopyFromCharField( source_column='Scenario', max_length=200, null=True, ) quantityreleased = CopyFromFloatField( source_column='QuantityReleased', null=True, ) endpointused = CopyFromCharField( source_column='EndpointUsed', max_length=30, blank=True, ) lfl_value = CopyFromFloatField( source_column='LFL_Value', null=True, ) distance2endpoint = CopyFromFloatField( source_column='Distance2Endpoint', null=True, ) residentialpopulation = CopyFromBigIntegerField( source_column='ResidentialPopulation', null=True, ) pr_schools = CopyFromBooleanField(source_column='PR_Schools', ) pr_residences = CopyFromBooleanField(source_column='PR_Residences', ) pr_hospitals = CopyFromBooleanField(source_column='PR_Hospitals', ) pr_prisons = CopyFromBooleanField(source_column='PR_Prisons', ) pr_publicrecreation = CopyFromBooleanField( source_column='PR_PublicRecreation', ) pr_comm_ind = CopyFromBooleanField(source_column='PR_Comm_Ind', ) pr_othertype = CopyFromCharField( source_column='PR_OtherType', max_length=200, blank=True, ) er_natlstateparks = CopyFromBooleanField( source_column='ER_NatlStateParks', ) er_wildlifesactuary = CopyFromBooleanField( source_column='ER_WildlifeSactuary', ) er_fedwilderness = CopyFromBooleanField(source_column='ER_FedWilderness', ) er_othertype = CopyFromCharField( source_column='ER_OtherType', max_length=200, blank=True, ) pm_dikes = CopyFromBooleanField(source_column='PM_Dikes', ) pm_firewalls = CopyFromBooleanField(source_column='PM_FireWalls', ) pm_blastwalls = CopyFromBooleanField(source_column='PM_BlastWalls', ) pm_enclosures = CopyFromBooleanField(source_column='PM_Enclosures', ) pm_othertype = CopyFromCharField( source_column='PM_OtherType', max_length=200, blank=True, ) am_sprinklersystems = CopyFromBooleanField( source_column='AM_SprinklerSystems', ) am_delugesystems = CopyFromBooleanField(source_column='AM_DelugeSystems', ) am_watercurtain = CopyFromBooleanField(source_column='AM_WaterCurtain', ) am_excessflowvalve = CopyFromBooleanField( source_column='AM_ExcessFlowValve', ) am_othertype = CopyFromCharField( source_column='AM_OtherType', max_length=200, blank=True, ) ptrgraphic = CopyFromCharField( source_column='ptrGraphic', max_length=12, blank=True, ) cbi_flag = CopyFromBooleanField(source_column='CBI_Flag', ) class Meta: verbose_name = 'Flammables: Alternative Release Scenario'
class Accident(BaseRMPModel): """ Possible additions from Registration: Facility_name, city, county, parent_1? This would turn Process, Accident and Registration into the top level tables. """ id = CopyFromIntegerField( primary_key=True, source_column='accident_id', ) rmp = CopyFromForeignKey( 'Registration', on_delete=models.PROTECT, ) accident_date = CopyFromDateField(null=True, ) accident_time = CopyFromCharField( max_length=4, blank=True, ) naics_code = CopyFromForeignKey( 'NAICS', db_column='naics_code', on_delete=models.PROTECT, ) release_duration = CopyFromCharField(max_length=5) re_gas = CopyFromBooleanField(verbose_name='Gas release', ) re_spill = CopyFromBooleanField(verbose_name='Liquid spills/evaporation', ) re_fire = CopyFromBooleanField(verbose_name='Fire', ) re_explosion = CopyFromBooleanField(verbose_name='Explosion', ) re_reactive_incident = CopyFromBooleanField( verbose_name='Uncontrolled/runaway reaction', ) rs_storage_vessel = CopyFromBooleanField(verbose_name='Storage vessel', ) rs_piping = CopyFromBooleanField(verbose_name='Piping', ) rs_process_vessel = CopyFromBooleanField(verbose_name='Process vessel', ) rs_transfer_hose = CopyFromBooleanField(verbose_name='Transfer hose', ) rs_valve = CopyFromBooleanField(verbose_name='Valve', ) rs_pump = CopyFromBooleanField(verbose_name='Pump', ) rs_joint = CopyFromBooleanField(verbose_name='Joint', ) other_release_source = CopyFromCharField(max_length=200, blank=True) wind_speed = CopyFromFloatField(null=True, ) wind_speed_unit = CopyFromForeignKey( 'WindCd', null=True, on_delete=models.PROTECT, db_column='wind_speed_unit', ) wind_direction = CopyFromCharField(max_length=3, blank=True) temperature = CopyFromDecimalField( max_digits=5, decimal_places=2, null=True, ) stability_class = CopyFromCharField(max_length=1, blank=True) precipitation = CopyFromBooleanField() unknown_weather = CopyFromBooleanField() deaths_workers = CopyFromIntegerField(null=True) deaths_responders = CopyFromIntegerField(null=True) deaths_public = CopyFromIntegerField(null=True) injuries_workers = CopyFromIntegerField(null=True) injuries_responders = CopyFromIntegerField(null=True) injuries_public = CopyFromIntegerField(null=True) onsite_damage = CopyFromIntegerField(null=True) offsite_deaths = CopyFromIntegerField(null=True) hospitalization = CopyFromIntegerField(null=True) offsite_medical = CopyFromIntegerField(null=True) offsite_evacuated = CopyFromIntegerField(null=True) offsite_shelter = CopyFromIntegerField(null=True) offsite_damage = CopyFromIntegerField(null=True) ed_kills = CopyFromBooleanField(verbose_name='Fish or animal kills', ) ed_defoliation = CopyFromBooleanField( verbose_name='Tree, lawn, shrub, or crop damage', ) ed_water_contamination = CopyFromBooleanField( verbose_name='Water contamination', ) ed_soil_contamination = CopyFromBooleanField( verbose_name='Soil Contamination', ) ed_other = CopyFromCharField(max_length=200, blank=True) initiating_event = CopyFromForeignKey( 'EventsCd', null=True, blank=True, on_delete=models.PROTECT, db_column='initiating_event', ) cf_equipment_failure = CopyFromBooleanField( verbose_name='Equipment failure', ) cf_human_error = CopyFromBooleanField(verbose_name='Human error', ) cf_improper_procedure = CopyFromBooleanField( verbose_name='Improper procedure', ) cf_overpressure = CopyFromBooleanField(verbose_name='Overpressurization', ) cf_upset_condition = CopyFromBooleanField(verbose_name='Upset condition', ) cf_bypass_condition = CopyFromBooleanField( verbose_name='By-pass condition', ) cf_maintenance = CopyFromBooleanField( verbose_name='Maintenance activity/inactivity', ) cf_process_design_failure = CopyFromBooleanField( verbose_name='Process design failure', ) cf_unsuitable_equipment = CopyFromBooleanField( verbose_name='Unsuitable equipment', ) cf_unusual_weather = CopyFromBooleanField( verbose_name='Unusual weather conditions', ) cf_management_error = CopyFromBooleanField( verbose_name='Management error', ) cf_other = CopyFromCharField( max_length=200, blank=True, ) offsite_responders_notify = CopyFromCharField( max_length=25, blank=True, ) ci_improved_equipment = CopyFromBooleanField( verbose_name='Improved/upgraded equipment', ) ci_revised_maintenance = CopyFromBooleanField( verbose_name='Revised maintenance', ) ci_revised_training = CopyFromBooleanField( verbose_name='Revised training', ) ci_revised_op_procedures = CopyFromBooleanField( verbose_name='Revised operating procedures', ) ci_new_process_controls = CopyFromBooleanField( verbose_name='New process controls', ) ci_new_mitigation_systems = CopyFromBooleanField( verbose_name='New mitigation systems', ) ci_response_plan = CopyFromBooleanField( verbose_name='Revised emergency response plan', ) ci_changed_process = CopyFromBooleanField(verbose_name='Changed process', ) ci_reduced_inventory = CopyFromBooleanField( verbose_name='Reduced inventory', ) ci_none = CopyFromBooleanField(verbose_name='None', ) ci_other = CopyFromCharField(max_length=200, blank=True) cbi_flag = CopyFromBooleanField() num_acc_chem = CopyFromIntegerField(null=True) flam_total = CopyFromIntegerField(null=True) toxic_total = CopyFromIntegerField(null=True) quantity_total = CopyFromIntegerField(null=True) num_deaths = CopyFromIntegerField(null=True) num_injuries = CopyFromIntegerField(null=True) num_evacuated = CopyFromIntegerField(null=True) property_damage = CopyFromIntegerField(null=True) @classmethod def get_transform_queryset(self): """ This is the top level containing information about accidents at different facilities. Aggregated fields: num_acc_chem = Counts AccidentIDs in tblS6AccidentChemicals flam_total, tox_total = Sums QuantityReleased column in accident chemicals depending on whether the ChemicalType flag is 'T' or 'F' quantity_total = Sum of flam_total and tox_total for each accident num_deaths = Sum of worker, public responder, and citizen deaths num_injuries = Sum of worker, public responder, and citizen injuries. These fields already exist on the raw models. property_damage = Sum of onsite and offsite property damage. Again, these fields already exist on the raw models. """ qs = raw_models.tblS6AccidentHistory.objects.values( 'AccidentHistoryID', 'FacilityID', 'AccidentDate', 'AccidentTime', 'NAICSCode', 'AccidentReleaseDuration', 'RE_Gas', 'RE_Spill', 'RE_Fire', 'RE_Explosion', 'RE_ReactiveIncident', 'RS_StorageVessel', 'RS_Piping', 'RS_ProcessVessel', 'RS_TransferHose', 'RS_Valve', 'RS_Pump', 'RS_Joint', 'OtherReleaseSource', 'WindSpeed', 'WindSpeedUnitCode', 'WindDirection', 'Temperature', 'StabilityClass', 'Precipitation', 'WeatherUnknown', 'DeathsWorkers', 'DeathsPublicResponders', 'DeathsPublic', 'InjuriesWorkers', 'InjuriesPublicResponders', 'InjuriesPublic', 'OnsitePropertyDamage', 'OffsiteDeaths', 'Hospitalization', 'MedicalTreatment', 'Evacuated', 'ShelteredInPlace', 'OffsitePropertyDamage', 'ED_Kills', 'ED_MinorDefoliation', 'ED_WaterContamination', 'ED_SoilContamination', 'ED_Other', 'InitiatingEvent', 'CF_EquipmentFailure', 'CF_HumanError', 'CF_ImproperProcedure', 'CF_Overpressurization', 'CF_UpsetCondition', 'CF_BypassCondition', 'CF_Maintenance', 'CF_ProcessDesignFailure', 'CF_UnsuitableEquipment', 'CF_UnusualWeather', 'CF_ManagementError', 'CF_Other', 'OffsiteRespondersNotify', 'CI_ImprovedEquipment', 'CI_RevisedMaintenance', 'CI_RevisedTraining', 'CI_RevisedOpProcedures', 'CI_NewProcessControls', 'CI_NewMitigationSystems', 'CI_RevisedERPlan', 'CI_ChangedProcess', 'CI_ReducedInventory', 'CI_None', 'CI_OtherType', 'CBI_Flag', ).annotate( accident_id=F('AccidentHistoryID'), rmp_id=F('FacilityID'), accident_date=F('AccidentDate'), accident_time=F('AccidentTime'), naics_code=F('NAICSCode'), release_duration=F('AccidentReleaseDuration'), re_gas=F('RE_Gas'), re_spill=F('RE_Spill'), re_fire=F('RE_Fire'), re_explosion=F('RE_Explosion'), re_reactive_incident=F('RE_ReactiveIncident'), rs_storage_vessel=F('RS_StorageVessel'), rs_piping=F('RS_Piping'), rs_process_vessel=F('RS_ProcessVessel'), rs_transfer_hose=F('RS_TransferHose'), rs_valve=F('RS_Valve'), rs_pump=F('RS_Pump'), rs_joint=F('RS_Joint'), other_release_source=F('OtherReleaseSource'), wind_speed=F('WindSpeed'), wind_speed_unit=F('WindSpeedUnitCode'), wind_direction=F('WindDirection'), temperature=F('Temperature'), stability_class=F('StabilityClass'), precipitation=F('Precipitation'), unknown_weather=F('WeatherUnknown'), deaths_workers=F('DeathsWorkers'), deaths_responders=F('DeathsPublicResponders'), deaths_public=F('DeathsPublic'), injuries_workers=F('InjuriesWorkers'), injuries_responders=F('InjuriesPublicResponders'), injuries_public=F('InjuriesPublic'), onsite_damage=F('OnsitePropertyDamage'), offsite_deaths=F('OffsiteDeaths'), hospitalization=Cast('Hospitalization', CopyFromIntegerField()), offsite_medical=Cast('MedicalTreatment', CopyFromIntegerField()), offsite_evacuated=Cast('Evacuated', CopyFromIntegerField()), offsite_shelter=Cast('ShelteredInPlace', CopyFromIntegerField()), offsite_damage=F('OffsitePropertyDamage'), ed_kills=F('ED_Kills'), ed_defoliation=F('ED_MinorDefoliation'), ed_water_contamination=F('ED_WaterContamination'), ed_soil_contamination=F('ED_SoilContamination'), ed_other=F('ED_Other'), initiating_event=F('InitiatingEvent'), cf_equipment_failure=F('CF_EquipmentFailure'), cf_human_error=F('CF_HumanError'), cf_improper_procedure=F('CF_ImproperProcedure'), cf_overpressure=F('CF_Overpressurization'), cf_upset_condition=F('CF_UpsetCondition'), cf_bypass_condition=F('CF_BypassCondition'), cf_maintenance=F('CF_Maintenance'), cf_process_design_failure=F('CF_ProcessDesignFailure'), cf_unsuitable_equipment=F('CF_UnsuitableEquipment'), cf_unusual_weather=F('CF_UnusualWeather'), cf_management_error=F('CF_ManagementError'), cf_other=F('CF_Other'), offsite_responders_notify=F('OffsiteRespondersNotify'), ci_improved_equipment=F('CI_ImprovedEquipment'), ci_revised_maintenance=F('CI_RevisedMaintenance'), ci_revised_training=F('CI_RevisedTraining'), ci_revised_op_procedures=F('CI_RevisedOpProcedures'), ci_new_process_controls=F('CI_NewProcessControls'), ci_new_mitigation_systems=F('CI_NewMitigationSystems'), ci_response_plan=F('CI_RevisedERPlan'), ci_changed_process=F('CI_ChangedProcess'), ci_reduced_inventory=F('CI_ReducedInventory'), ci_none=F('CI_None'), ci_other=F('CI_OtherType'), cbi_flag=F('CBI_Flag'), num_acc_chem=Count('tbls6accidentchemicals'), flam_total=Sum( Case(When(tbls6accidentchemicals__ChemicalID__ChemType='F', then=('tbls6accidentchemicals__QuantityReleased')), default=Value(0))), toxic_total=Sum( Case(When(tbls6accidentchemicals__ChemicalID__ChemType='T', then=('tbls6accidentchemicals__QuantityReleased')), default=Value(0))), quantity_total=F('flam_total') + F('toxic_total'), num_deaths=F('DeathsWorkers') + F('DeathsPublicResponders') + F('DeathsPublic'), num_injuries=F('InjuriesPublic') + F('InjuriesWorkers') + F('InjuriesPublicResponders'), num_evacuated=F('Evacuated'), property_damage=F('OnsitePropertyDamage') + F('OffsitePropertyDamage'), ) return qs @property def formatted_time(self): try: self._formatted_time except AttributeError: if self.accident_time == '': self._formatted_time = 'unspecified time' else: self._formatted_time = '{0}:{1}'.format( self.accident_time[0:2], self.accident_time[2:4], ) return self._formatted_time @property def formatted_duration(self): try: self._formatted_duration except AttributeError: if self.release_duration != '': hrs = int(self.release_duration[0:3]) mins = int(self.release_duration[3:6]) if hrs > 0 and mins > 0: self._formatted_duration = '{0} hours and {1} minutes'.format( hrs, mins) elif hrs > 0: self._formatted_duration = '{0} hours'.format(hrs) elif mins > 0: self._formatted_duration = '{0} minutes'.format(mins) else: self._formatted_duration = self.release_duration return self._formatted_duration @property def release_events(self): try: self._release_events except AttributeError: self._release_events = [ f.verbose_name for f in self._meta.model.get_prefixed_boolean_fields('re_') if self.__dict__[f.name] ] return self._release_events @property def release_sources(self): try: self._release_sources except AttributeError: self._release_sources = [ f.verbose_name for f in self._meta.model.get_prefixed_boolean_fields('rs_') if self.__dict__[f.name] ] if self.other_release_source != '': self._release_sources.append(self.other_release_source) return self._release_sources @property def environmental_damages(self): try: self._environmental_damages except AttributeError: self._environmental_damages = [ f.verbose_name for f in self._meta.model.get_prefixed_boolean_fields('ed_') if self.__dict__[f.name] ] if self.ed_other != '': self._environmental_damages.append(self.ed_other) return self._environmental_damages @property def contributing_factors(self): try: self._contributing_factors except AttributeError: self._contributing_factors = [ f.verbose_name for f in self._meta.model.get_prefixed_boolean_fields('cf_') if self.__dict__[f.name] ] if self.cf_other != '': self._contributing_factors.append(self.cf_other) return self._contributing_factors @property def changes_introduced(self): try: self._changes_introduced except AttributeError: self._changes_introduced = [ f.verbose_name for f in self._meta.model.get_prefixed_boolean_fields('ci_') if self.__dict__[f.name] ] if self.ci_other != '': self._changes_introduced.append(self.ci_other) return self._changes_introduced class Meta: ordering = ['rmp_id', '-accident_date']
class tblS5FlammablesAltReleases(BaseRMPModel): FlammableID = CopyFromIntegerField(primary_key=True, ) ProcessChemicalID = CopyFromForeignKey( 'tblS1ProcessChemicals', db_column='ProcessChemicalID', on_delete=models.PROTECT, ) AnalyticalBasis = CopyFromCharField( max_length=255, blank=True, ) Scenario = CopyFromCharField( max_length=200, blank=True, ) QuantityReleased = CopyFromFloatField(null=True, ) EndpointUsed = CopyFromCharField( max_length=30, blank=True, ) LFL_Value = CopyFromFloatField(null=True, verbose_name='LFL Value (% Volume)') Distance2Endpoint = CopyFromFloatField(null=True, ) ResidentialPopulation = CopyFromBigIntegerField(null=True, ) PR_Schools = CopyFromBooleanField() PR_Residences = CopyFromBooleanField() PR_Hospitals = CopyFromBooleanField() PR_Prisons = CopyFromBooleanField() PR_PublicRecreation = CopyFromBooleanField() PR_Comm_Ind = CopyFromBooleanField() PR_OtherType = CopyFromCharField( max_length=200, blank=True, ) ER_NatlStateParks = CopyFromBooleanField() ER_WildlifeSactuary = CopyFromBooleanField() ER_FedWilderness = CopyFromBooleanField() ER_OtherType = CopyFromCharField( max_length=200, blank=True, ) PM_Dikes = CopyFromBooleanField() PM_FireWalls = CopyFromBooleanField() PM_BlastWalls = CopyFromBooleanField() PM_Enclosures = CopyFromBooleanField() PM_OtherType = CopyFromCharField( max_length=200, blank=True, ) AM_SprinklerSystems = CopyFromBooleanField() AM_DelugeSystems = CopyFromBooleanField() AM_WaterCurtain = CopyFromBooleanField() AM_ExcessFlowValve = CopyFromBooleanField() AM_OtherType = CopyFromCharField( max_length=200, blank=True, ) ptrGraphic = CopyFromCharField( max_length=12, blank=True, ) CBI_Flag = CopyFromBooleanField() class Meta: verbose_name = 'Flammables: Alternative Release Scenario'
class tblS3ToxicsAltReleases(BaseRMPModel): toxicid = CopyFromIntegerField( source_column='ToxicID', primary_key=True, ) processchemicalid = CopyFromForeignKey( 'tblS1ProcessChemicals', on_delete=models.PROTECT, source_column='ProcessChemicalID', ) percentweight = CopyFromFloatField( source_column='PercentWeight', null=True, ) physicalstate = CopyFromForeignKey( 'tlkpPhysicalStateCodes', on_delete=models.PROTECT, source_column='PhysicalState', blank=True, ) analyticalbasis = CopyFromCharField( source_column='AnalyticalBasis', max_length=255, blank=True, ) scenario = CopyFromCharField( source_column='Scenario', max_length=200, blank=True, ) quantityreleased = CopyFromFloatField( source_column='QuantityReleased', null=True, ) releaseduration = CopyFromFloatField( source_column='ReleaseDuration', null=True, ) releaserate = CopyFromFloatField( source_column='ReleaseRate', null=True, ) windspeed = CopyFromFloatField( source_column='WindSpeed', null=True, ) stabilityclass = CopyFromCharField( source_column='StabilityClass', max_length=1, blank=True, ) topography = CopyFromForeignKey( 'tlkpTopographyCode', on_delete=models.PROTECT, source_column='Topography', blank=True, ) endpoint_distance = CopyFromFloatField( source_column='Distance2Endpoint', null=True, ) residentialpopulation = CopyFromBigIntegerField( source_column='ResidentialPopulation', null=True, ) pr_schools = CopyFromBooleanField(source_column='PR_Schools', ) pr_residences = CopyFromBooleanField(source_column='PR_Residences', ) pr_hospitals = CopyFromBooleanField(source_column='PR_Hospitals', ) pr_prisons = CopyFromBooleanField(source_column='PR_Prisons', ) pr_publicrecreation = CopyFromBooleanField( source_column='PR_PublicRecreation', ) pr_comm_ind = CopyFromBooleanField(source_column='PR_Comm_Ind', ) pr_othertype = CopyFromCharField( source_column='PR_OtherType', max_length=200, blank=True, ) er_natlstateparks = CopyFromBooleanField( source_column='ER_NatlStateParks', ) er_wildlifesactuary = CopyFromBooleanField( source_column='ER_WildlifeSactuary', ) er_fedwilderness = CopyFromBooleanField(source_column='ER_FedWilderness', ) er_othertype = CopyFromCharField( source_column='ER_OtherType', max_length=200, blank=True, ) pm_dikes = CopyFromBooleanField(source_column='PM_Dikes', ) pm_enclosures = CopyFromBooleanField(source_column='PM_Enclosures', ) pm_berms = CopyFromBooleanField(source_column='PM_Berms', ) pm_drains = CopyFromBooleanField(source_column='PM_Drains', ) pm_sumps = CopyFromBooleanField(source_column='PM_Sumps', ) pm_othertype = CopyFromCharField( source_column='PM_OtherType', max_length=200, blank=True, ) am_sprinklersystems = CopyFromBooleanField( source_column='AM_SprinklerSystems', ) am_delugesystems = CopyFromBooleanField(source_column='AM_DelugeSystems', ) am_watercurtain = CopyFromBooleanField(source_column='AM_WaterCurtain', ) am_neutralization = CopyFromBooleanField( source_column='AM_Neutralization', ) am_excessflowvalve = CopyFromBooleanField( source_column='AM_ExcessFlowValve', ) am_flares = CopyFromBooleanField(source_column='AM_Flares', ) am_scrubbers = CopyFromBooleanField(source_column='AM_Scrubbers', ) am_emergencyshutdown = CopyFromBooleanField( source_column='AM_EmergencyShutdown', ) am_othertype = CopyFromCharField( source_column='AM_OtherType', max_length=200, blank=True, ) ptrgraphic = CopyFromCharField( source_column='ptrGraphic', max_length=12, blank=True, ) cbi_flag = CopyFromBooleanField(source_column='CBI_Flag', ) class Meta: verbose_name = 'Toxics: Alternative Release Scenario'