Models¶
Submodules¶
AuditLog¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
Columns¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
- class seed.models.columns.Column(*args, **kwargs)¶
Bases:
django.db.models.base.Model
The name of a column for a given organization.
- COLUMN_EXCLUDE_FIELDS = ['bounding_box', 'centroid', 'created', 'data_state', 'extra_data', 'geocoding_confidence', 'id', 'import_file', 'long_lat', 'merge_state', 'source_type', 'updated', 'hash_object', 'normalized_address', 'source_eui_modeled_orig', 'site_eui_orig', 'occupied_floor_area_orig', 'site_eui_weather_normalized_orig', 'site_eui_modeled_orig', 'source_eui_orig', 'gross_floor_area_orig', 'conditioned_floor_area_orig', 'source_eui_weather_normalized_orig']¶
- COLUMN_MERGE_FAVOR_EXISTING = 1¶
- COLUMN_MERGE_FAVOR_NEW = 0¶
- COLUMN_MERGE_PROTECTION = [(0, 'Favor New'), (1, 'Favor Existing')]¶
- DATABASE_COLUMNS = [{'column_name': 'pm_property_id', 'table_name': 'PropertyState', 'display_name': 'PM Property ID', 'column_description': 'PM Property ID', 'data_type': 'string'}, {'column_name': 'pm_parent_property_id', 'table_name': 'PropertyState', 'display_name': 'PM Parent Property ID', 'column_description': 'PM Parent Property ID', 'data_type': 'string'}, {'column_name': 'jurisdiction_tax_lot_id', 'table_name': 'TaxLotState', 'display_name': 'Jurisdiction Tax Lot ID', 'column_description': 'Jurisdiction Tax Lot ID', 'data_type': 'string'}, {'column_name': 'jurisdiction_property_id', 'table_name': 'PropertyState', 'display_name': 'Jurisdiction Property ID', 'column_description': 'Jurisdiction Property ID', 'data_type': 'string'}, {'column_name': 'ulid', 'table_name': 'TaxLotState', 'display_name': 'ULID', 'column_description': 'ULID', 'data_type': 'string'}, {'column_name': 'ubid', 'table_name': 'PropertyState', 'display_name': 'UBID', 'column_description': 'UBID', 'data_type': 'string'}, {'column_name': 'custom_id_1', 'table_name': 'PropertyState', 'display_name': 'Custom ID 1', 'column_description': 'Custom ID 1', 'data_type': 'string'}, {'column_name': 'custom_id_1', 'table_name': 'TaxLotState', 'display_name': 'Custom ID 1', 'column_description': 'Custom ID 1', 'data_type': 'string'}, {'column_name': 'audit_template_building_id', 'table_name': 'PropertyState', 'display_name': 'Audit Template Building ID', 'column_description': 'Audit Template Building ID', 'data_type': 'string'}, {'column_name': 'address_line_1', 'table_name': 'PropertyState', 'display_name': 'Address Line 1', 'column_description': 'Address Line 1', 'data_type': 'string'}, {'column_name': 'address_line_1', 'table_name': 'TaxLotState', 'display_name': 'Address Line 1', 'column_description': 'Address Line 1', 'data_type': 'string'}, {'column_name': 'address_line_2', 'table_name': 'PropertyState', 'display_name': 'Address Line 2', 'column_description': 'Address Line 2', 'data_type': 'string'}, {'column_name': 'address_line_2', 'table_name': 'TaxLotState', 'display_name': 'Address Line 2', 'column_description': 'Address Line 2', 'data_type': 'string'}, {'column_name': 'city', 'table_name': 'PropertyState', 'display_name': 'City', 'column_description': 'City', 'data_type': 'string'}, {'column_name': 'city', 'table_name': 'TaxLotState', 'display_name': 'City', 'column_description': 'City', 'data_type': 'string'}, {'column_name': 'state', 'table_name': 'PropertyState', 'display_name': 'State', 'column_description': 'State', 'data_type': 'string'}, {'column_name': 'state', 'table_name': 'TaxLotState', 'display_name': 'State', 'column_description': 'State', 'data_type': 'string'}, {'column_name': 'normalized_address', 'table_name': 'PropertyState', 'display_name': 'Normalized Address', 'column_description': 'Normalized Address', 'data_type': 'string'}, {'column_name': 'normalized_address', 'table_name': 'TaxLotState', 'display_name': 'Normalized Address', 'column_description': 'Normalized Address', 'data_type': 'string'}, {'column_name': 'postal_code', 'table_name': 'PropertyState', 'display_name': 'Postal Code', 'column_description': 'Postal Code', 'data_type': 'string'}, {'column_name': 'postal_code', 'table_name': 'TaxLotState', 'display_name': 'Postal Code', 'column_description': 'Postal Code', 'data_type': 'string'}, {'column_name': 'lot_number', 'table_name': 'PropertyState', 'display_name': 'Associated Tax Lot ID', 'column_description': 'Associated Tax Lot ID', 'data_type': 'string'}, {'column_name': 'property_name', 'table_name': 'PropertyState', 'display_name': 'Property Name', 'column_description': 'Property Name', 'data_type': 'string'}, {'column_name': 'latitude', 'table_name': 'PropertyState', 'display_name': 'Latitude', 'column_description': 'Latitude', 'data_type': 'number'}, {'column_name': 'longitude', 'table_name': 'PropertyState', 'display_name': 'Longitude', 'column_description': 'Longitude', 'data_type': 'number'}, {'column_name': 'latitude', 'table_name': 'TaxLotState', 'display_name': 'Latitude', 'column_description': 'Latitude', 'data_type': 'number'}, {'column_name': 'longitude', 'table_name': 'TaxLotState', 'display_name': 'Longitude', 'column_description': 'Longitude', 'data_type': 'number'}, {'column_name': 'geocoding_confidence', 'table_name': 'PropertyState', 'display_name': 'Geocoding Confidence', 'column_description': 'Geocoding Confidence', 'data_type': 'string'}, {'column_name': 'geocoding_confidence', 'table_name': 'TaxLotState', 'display_name': 'Geocoding Confidence', 'column_description': 'Geocoding Confidence', 'data_type': 'string'}, {'column_name': 'property_footprint', 'table_name': 'PropertyState', 'display_name': 'Property Footprint', 'column_description': 'Property Footprint', 'data_type': 'geometry'}, {'column_name': 'taxlot_footprint', 'table_name': 'TaxLotState', 'display_name': 'Tax Lot Footprint', 'column_description': 'Tax Lot Footprint', 'data_type': 'geometry'}, {'column_name': 'campus', 'table_name': 'Property', 'display_name': 'Campus', 'column_description': 'Campus', 'data_type': 'boolean'}, {'column_name': 'updated', 'table_name': 'PropertyState', 'display_name': 'Updated', 'column_description': 'Updated', 'data_type': 'datetime'}, {'column_name': 'created', 'table_name': 'PropertyState', 'display_name': 'Created', 'column_description': 'Created', 'data_type': 'datetime'}, {'column_name': 'updated', 'table_name': 'TaxLotState', 'display_name': 'Updated', 'column_description': 'Updated', 'data_type': 'datetime'}, {'column_name': 'created', 'table_name': 'TaxLotState', 'display_name': 'Created', 'column_description': 'Created', 'data_type': 'datetime'}, {'column_name': 'gross_floor_area', 'table_name': 'PropertyState', 'display_name': 'Gross Floor Area', 'column_description': 'Gross Floor Area', 'data_type': 'area'}, {'column_name': 'use_description', 'table_name': 'PropertyState', 'display_name': 'Use Description', 'column_description': 'Use Description', 'data_type': 'string'}, {'column_name': 'energy_score', 'table_name': 'PropertyState', 'display_name': 'ENERGY STAR Score', 'column_description': 'ENERGY STAR Score', 'data_type': 'integer'}, {'column_name': 'property_notes', 'table_name': 'PropertyState', 'display_name': 'Property Notes', 'column_description': 'Property Notes', 'data_type': 'string'}, {'column_name': 'property_type', 'table_name': 'PropertyState', 'display_name': 'Property Type', 'column_description': 'Property Type', 'data_type': 'string'}, {'column_name': 'year_ending', 'table_name': 'PropertyState', 'display_name': 'Year Ending', 'column_description': 'Year Ending', 'data_type': 'date'}, {'column_name': 'owner', 'table_name': 'PropertyState', 'display_name': 'Owner', 'column_description': 'Owner', 'data_type': 'string'}, {'column_name': 'owner_email', 'table_name': 'PropertyState', 'display_name': 'Owner Email', 'column_description': 'Owner Email', 'data_type': 'string'}, {'column_name': 'owner_telephone', 'table_name': 'PropertyState', 'display_name': 'Owner Telephone', 'column_description': 'Owner Telephone', 'data_type': 'string'}, {'column_name': 'building_count', 'table_name': 'PropertyState', 'display_name': 'Building Count', 'column_description': 'Building Count', 'data_type': 'integer'}, {'column_name': 'year_built', 'table_name': 'PropertyState', 'display_name': 'Year Built', 'column_description': 'Year Built', 'data_type': 'integer'}, {'column_name': 'recent_sale_date', 'table_name': 'PropertyState', 'display_name': 'Recent Sale Date', 'column_description': 'Recent Sale Date', 'data_type': 'datetime'}, {'column_name': 'conditioned_floor_area', 'table_name': 'PropertyState', 'display_name': 'Conditioned Floor Area', 'column_description': 'Conditioned Floor Area', 'data_type': 'area'}, {'column_name': 'occupied_floor_area', 'table_name': 'PropertyState', 'display_name': 'Occupied Floor Area', 'column_description': 'Occupied Floor Area', 'data_type': 'area'}, {'column_name': 'owner_address', 'table_name': 'PropertyState', 'display_name': 'Owner Address', 'column_description': 'Owner Address', 'data_type': 'string'}, {'column_name': 'owner_city_state', 'table_name': 'PropertyState', 'display_name': 'Owner City/State', 'column_description': 'Owner City/State', 'data_type': 'string'}, {'column_name': 'owner_postal_code', 'table_name': 'PropertyState', 'display_name': 'Owner Postal Code', 'column_description': 'Owner Postal Code', 'data_type': 'string'}, {'column_name': 'home_energy_score_id', 'table_name': 'PropertyState', 'display_name': 'Home Energy Score ID', 'column_description': 'Home Energy Score ID', 'data_type': 'string'}, {'column_name': 'generation_date', 'table_name': 'PropertyState', 'display_name': 'PM Generation Date', 'column_description': 'PM Generation Date', 'data_type': 'datetime'}, {'column_name': 'release_date', 'table_name': 'PropertyState', 'display_name': 'PM Release Date', 'column_description': 'PM Release Date', 'data_type': 'datetime'}, {'column_name': 'site_eui', 'table_name': 'PropertyState', 'display_name': 'Site EUI', 'column_description': 'Site EUI', 'data_type': 'eui'}, {'column_name': 'site_eui_weather_normalized', 'table_name': 'PropertyState', 'display_name': 'Site EUI Weather Normalized', 'column_description': 'Site EUI Weather Normalized', 'data_type': 'eui'}, {'column_name': 'site_eui_modeled', 'table_name': 'PropertyState', 'display_name': 'Site EUI Modeled', 'column_description': 'Site EUI Modeled', 'data_type': 'eui'}, {'column_name': 'source_eui', 'table_name': 'PropertyState', 'display_name': 'Source EUI', 'column_description': 'Source EUI', 'data_type': 'eui'}, {'column_name': 'source_eui_weather_normalized', 'table_name': 'PropertyState', 'display_name': 'Source EUI Weather Normalized', 'column_description': 'Source EUI Weather Normalized', 'data_type': 'eui'}, {'column_name': 'source_eui_modeled', 'table_name': 'PropertyState', 'display_name': 'Source EUI Modeled', 'column_description': 'Source EUI Modeled', 'data_type': 'eui'}, {'column_name': 'energy_alerts', 'table_name': 'PropertyState', 'display_name': 'Energy Alerts', 'column_description': 'Energy Alerts', 'data_type': 'string'}, {'column_name': 'space_alerts', 'table_name': 'PropertyState', 'display_name': 'Space Alerts', 'column_description': 'Space Alerts', 'data_type': 'string'}, {'column_name': 'building_certification', 'table_name': 'PropertyState', 'display_name': 'Building Certification', 'column_description': 'Building Certification', 'data_type': 'string'}, {'column_name': 'number_properties', 'table_name': 'TaxLotState', 'display_name': 'Number Properties', 'column_description': 'Number Properties', 'data_type': 'integer'}, {'column_name': 'block_number', 'table_name': 'TaxLotState', 'display_name': 'Block Number', 'column_description': 'Block Number', 'data_type': 'string'}, {'column_name': 'district', 'table_name': 'TaxLotState', 'display_name': 'District', 'column_description': 'District', 'data_type': 'string'}, {'column_name': 'egrid_subregion_code', 'table_name': 'PropertyState', 'display_name': 'eGRID Subregion Code', 'column_description': 'eGRID Subregion Code', 'data_type': 'string'}, {'column_name': 'total_ghg_emissions', 'table_name': 'PropertyState', 'display_name': 'Total GHG Emissions', 'column_description': 'Total GHG Emissions', 'data_type': 'number'}, {'column_name': 'total_marginal_ghg_emissions', 'table_name': 'PropertyState', 'display_name': 'Total Marginal GHG Emissions', 'column_description': 'Total Marginal GHG Emissions', 'data_type': 'number'}, {'column_name': 'total_ghg_emissions_intensity', 'table_name': 'PropertyState', 'display_name': 'Total GHG Emissions Intensity', 'column_description': 'Total GHG Emissions Intensity', 'data_type': 'number'}, {'column_name': 'total_marginal_ghg_emissions_intensity', 'table_name': 'PropertyState', 'display_name': 'Total Marginal GHG Emissions Intensity', 'column_description': 'Total Marginal GHG Emissions Intensity', 'data_type': 'number'}, {'column_name': 'property_timezone', 'table_name': 'PropertyState', 'display_name': 'Property Time Zone', 'column_description': 'Time zone of the property', 'data_type': 'string'}]¶
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- EXCLUDED_API_FIELDS = ['normalized_address']¶
- EXCLUDED_COLUMN_RETURN_FIELDS = ['hash_object', 'normalized_address', 'source_eui_modeled_orig', 'site_eui_orig', 'occupied_floor_area_orig', 'site_eui_weather_normalized_orig', 'site_eui_modeled_orig', 'source_eui_orig', 'gross_floor_area_orig', 'conditioned_floor_area_orig', 'source_eui_weather_normalized_orig']¶
- EXCLUDED_MAPPING_FIELDS = ['created', 'extra_data', 'lot_number', 'normalized_address', 'updated']¶
- EXCLUDED_RENAME_FROM_FIELDS = ['campus', 'lot_number', 'year_built', 'property_footprint', 'taxlot_footprint', 'bounding_box', 'centroid', 'created', 'data_state', 'extra_data', 'geocoding_confidence', 'id', 'import_file', 'long_lat', 'merge_state', 'source_type', 'updated', 'hash_object', 'normalized_address', 'source_eui_modeled_orig', 'site_eui_orig', 'occupied_floor_area_orig', 'site_eui_weather_normalized_orig', 'site_eui_modeled_orig', 'source_eui_orig', 'gross_floor_area_orig', 'conditioned_floor_area_orig', 'source_eui_weather_normalized_orig']¶
- EXCLUDED_RENAME_TO_FIELDS = ['lot_number', 'latitude', 'longitude', 'year_built', 'property_footprint', 'campus', 'created', 'updated', 'bounding_box', 'centroid', 'created', 'data_state', 'extra_data', 'geocoding_confidence', 'id', 'import_file', 'long_lat', 'merge_state', 'source_type', 'updated', 'hash_object', 'normalized_address', 'source_eui_modeled_orig', 'site_eui_orig', 'occupied_floor_area_orig', 'site_eui_weather_normalized_orig', 'site_eui_modeled_orig', 'source_eui_orig', 'gross_floor_area_orig', 'conditioned_floor_area_orig', 'source_eui_weather_normalized_orig']¶
- INTERNAL_TYPE_TO_DATA_TYPE = {'BooleanField': 'boolean', 'CharField': 'string', 'DateField': 'date', 'DateTimeField': 'datetime', 'FloatField': 'double', 'IntegerField': 'integer', 'JSONField': 'string', 'PointField': 'geometry', 'PolygonField': 'geometry', 'TextField': 'string'}¶
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- PINNED_COLUMNS = [('PropertyState', 'pm_property_id'), ('TaxLotState', 'jurisdiction_tax_lot_id')]¶
- QUANTITY_UNIT_COLUMNS = [('PropertyState', 'gross_floor_area'), ('PropertyState', 'occupied_floor_area'), ('PropertyState', 'conditioned_floor_area'), ('PropertyState', 'site_eui'), ('PropertyState', 'site_eui_modeled'), ('PropertyState', 'site_eui_weather_normalized'), ('PropertyState', 'source_eui'), ('PropertyState', 'source_eui_modeled'), ('PropertyState', 'source_eui_weather_normalized'), ('PropertyState', 'total_ghg_emissions'), ('PropertyState', 'total_marginal_ghg_emissions'), ('PropertyState', 'total_ghg_emissions_intensity'), ('PropertyState', 'total_marginal_ghg_emissions_intensity')]¶
- SHARED_FIELD_TYPES = ((0, 'None'), (1, 'Public'))¶
- SHARED_NONE = 0¶
- SHARED_PUBLIC = 1¶
- UNMAPPABLE_PROPERTY_FIELDS = ['campus', 'created', 'geocoding_confidence', 'lot_number', 'updated']¶
- UNMAPPABLE_TAXLOT_FIELDS = ['created', 'geocoding_confidence', 'updated']¶
- clean()¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- column_description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- column_list_profiles¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- column_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- columnlistprofilecolumn_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- comstock_mapping¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- static create_mappings(mappings, organization, user, import_file_id=None)¶
Create the mappings for an organization and a user based on a simple array of array object.
- Parameters
mappings – dict, dictionary containing mapping information
organization – inst, organization object
user – inst, User object
import_file_id – integer, If passed, will cache the column mappings data into the import_file_id object.
:return Boolean, True is data are saved in the ColumnMapping table in the database
- static create_mappings_from_file(filename, organization, user, import_file_id=None)¶
Load the mappings in from a file in a very specific file format. The columns in the file must be:
raw field
table name
field name
field display name
field data type
field unit type
- Parameters
filename – string, absolute path and name of file to load
organization – id, organization id
user – id, user id
import_file_id – Integer, If passed, will cache the column mappings data into the import_file_id object.
- Returns
ColumnMapping, True
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- data_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- static delete_all(organization)¶
Delete all the columns for an organization. Note that this will invalidate all the data that is in the extra_data fields of the inventory and is irreversible.
- Parameters
organization – instance, Organization
- Returns
[int, int] Number of columns, column_mappings records that were deleted
- derived_column¶
Accessor to the related object on the forward side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Restaurant.place
is aForwardOneToOneDescriptor
instance.
- derived_column_id¶
- derivedcolumn_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- derivedcolumnparameter_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- display_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- geocoding_order¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_merge_protection_display(*, field=<django.db.models.fields.IntegerField: merge_protection>)¶
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django.db.models.fields.DateTimeField: modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- import_file¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- import_file_id¶
- is_extra_data¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- is_matching_criteria¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- mapped_mappings¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- merge_protection¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- modified¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- raw_mappings¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- recognize_empty¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- rename_column(new_column_name, force=False)¶
Rename the column and move all the data to the new column. This can move the data from a canonical field to an extra data field or vice versa. By default the column.
- Parameters
new_column_name – string new name of column
force – boolean force the overwrite of data in the column?
- Returns
- static retrieve_all(org_id: int, inventory_type: Optional[Literal[property, taxlot]] = None, only_used: bool = False, include_related: bool = True) → list¶
Retrieve all the columns for an organization. This method will query for all the columns in the database assigned to the organization. It will then go through and cleanup the names to ensure that there are no duplicates. The name column is used for uniquely labeling the columns for UI Grid purposes.
- Parameters
org_id – Organization ID
inventory_type – Inventory Type (property|taxlot) from the requester. This sets the related columns if requested.
only_used – View only the used columns that exist in the Column’s table
include_related – Include related columns (e.g., if inventory type is Property, include Taxlot columns)
- static retrieve_all_by_tuple(org_id)¶
Return list of all columns for an organization as a tuple.
[ ('PropertyState', 'address_line_1'), ('PropertyState', 'address_line_2'), ('PropertyState', 'building_certification'), ('PropertyState', 'building_count'), ('TaxLotState', 'address_line_1'), ('TaxLotState', 'address_line_2'), ('TaxLotState', 'block_number'), ('TaxLotState', 'city'), ('TaxLotState', 'jurisdiction_tax_lot_id'), ]
- Parameters
org_id – int, Organization ID
- Returns
list of tuples
- static retrieve_db_field_name_for_hash_comparison()¶
Names only of the columns in the database (fields only, not extra data), independent of inventory type. These fields are used for generating an MD5 hash to quickly check if the data are the same across multiple records. Note that this ignores extra_data. The result is a superset of all the fields that are used in the database across all of the inventory types of interest.
- Returns
list, names of columns, independent of inventory type.
- static retrieve_db_field_table_and_names_from_db_tables()¶
Similar to keys, except it returns a list of tuples of the columns that are in the database
[ ('PropertyState', 'address_line_1'), ('PropertyState', 'address_line_2'), ('PropertyState', 'building_certification'), ('PropertyState', 'building_count'), ('TaxLotState', 'address_line_1'), ('TaxLotState', 'address_line_2'), ('TaxLotState', 'block_number'), ('TaxLotState', 'city'), ('TaxLotState', 'jurisdiction_tax_lot_id'), ]
:return:list of tuples
- static retrieve_db_fields(org_id)¶
return the fields in the database regardless of properties or taxlots. For example, there is an address_line_1 in both the TaxLotState and the PropertyState. The command below will take the set to remove the duplicates.
[ “address_line_1”, “gross_floor_area”, … ] :param org_id: int, Organization ID :return: list
- static retrieve_db_fields_from_db_tables()¶
Return the list of database fields that are in the models. This is independent of what are in the Columns table.
- Returns
- static retrieve_db_types()¶
Return the data types for the database columns in the format of:
{ "field_name": "data_type", "field_name_2": "data_type_2", "address_line_1": "string", }
- Returns
dict
- static retrieve_mapping_columns(org_id, inventory_type=None)¶
Retrieve all the columns that are for mapping for an organization in a dictionary.
- Parameters
org_id – org_id, Organization ID
inventory_type – Inventory Type (property|taxlot) from the requester. This sets the related columns if requested.
- Returns
list, list of dict
- static retrieve_priorities(org_id)¶
Return the list of priorities for the columns. Result will be in the form of:
{ 'PropertyState': { 'lot_number': 'Favor New', 'owner_address': 'Favor New', 'extra_data': { 'data_007': 'Favor New' } 'TaxLotState': { 'custom_id_1': 'Favor New', 'block_number': 'Favor New', 'extra_data': { 'data_008': 'Favor New' } }
- Parameters
org_id – organization with the columns
- Returns
dict
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- static save_column_names(model_obj)¶
Save unique column names for extra_data in this organization.
This is a record of all the extra_data keys we have ever seen for a particular organization.
- Parameters
model_obj – model_obj instance (either PropertyState or TaxLotState).
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- table_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- unit¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- unit_id¶
- units_pint¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- seed.models.columns.validate_model(sender, **kwargs)¶
Cycles¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved.
- class seed.models.cycles.Cycle(id, organization, user, name, start, end, created)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- analysispropertyview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- end¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=True, **kwargs)¶
- get_next_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=True, **kwargs)¶
- classmethod get_or_create_default(organization)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_end(*, field=<django.db.models.fields.DateTimeField: end>, is_next=False, **kwargs)¶
- get_previous_by_start(*, field=<django.db.models.fields.DateTimeField: start>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- importfile_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- propertyview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- start¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- taxlotproperty_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- user¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- user_id¶
Joins¶
Generic Models¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
- class seed.models.models.Compliance(id, created, modified, compliance_type, start_date, end_date, deadline_date, project)¶
Bases:
django_extensions.db.models.TimeStampedModel
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- compliance_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- deadline_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- end_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_compliance_type_display(*, field=<django.db.models.fields.CharField: compliance_type>)¶
- get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- start_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- to_dict()¶
- class seed.models.models.StatusLabel(id, created, modified, name, color, super_organization, show_in_list)¶
Bases:
django_extensions.db.models.TimeStampedModel
- BLUE_CHOICE = 'blue'¶
- COLOR_CHOICES = (('red', 'red'), ('blue', 'blue'), ('light blue', 'light blue'), ('green', 'green'), ('white', 'white'), ('orange', 'orange'), ('gray', 'gray'))¶
- DEFAULT_LABELS = ['Residential', 'Non-Residential', 'Violation', 'Compliant', 'Missing Data', 'Questionable Report', 'Update Bldg Info', 'Call', 'Email', 'High EUI', 'Low EUI', 'Exempted', 'Extension', 'Change of Ownership']¶
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- GRAY_CHOICE = 'gray'¶
- GREEN_CHOICE = 'green'¶
- LIGHT_BLUE_CHOICE = 'light blue'¶
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- ORANGE_CHOICE = 'orange'¶
- RED_CHOICE = 'red'¶
- WHITE_CHOICE = 'white'¶
- color¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_color_display(*, field=<django.db.models.fields.CharField: color>)¶
- get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- propertyview_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- rule_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- show_in_list¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- super_organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- super_organization_id¶
- taxlotview_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- to_dict()¶
- class seed.models.models.Unit(*args, **kwargs)¶
Bases:
django.db.models.base.Model
Unit of measure for a Column Value.
- DATE = 4¶
- DATETIME = 5¶
- DECIMAL = 2¶
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- FLOAT = 3¶
- INTEGER = 6¶
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- STRING = 1¶
- UNIT_TYPES = ((1, 'String'), (6, 'Integer'), (3, 'Float'), (4, 'Date'), (5, 'Datetime'))¶
- column_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_unit_type_display(*, field=<django.db.models.fields.IntegerField: unit_type>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- unit_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- unit_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
Projects¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
- class seed.models.projects.Project(id, created, modified, name, slug, owner, last_modified_by, super_organization, description, status)¶
Bases:
django_extensions.db.models.TimeStampedModel
- ACTIVE_STATUS = 1¶
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- INACTIVE_STATUS = 0¶
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- PROJECT_NAME_MAX_LENGTH = 255¶
- STATUS_CHOICES = ((0, 'Inactive'), (1, 'Active'))¶
- property adding_buildings_status_percentage_cache_key¶
- compliance_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_compliance()¶
- get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)¶
- get_status_display(*, field=<django.db.models.fields.IntegerField: status>)¶
- property has_compliance¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- last_modified_by¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- last_modified_by_id¶
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- property organization¶
For compliance with organization names in new data model.
- owner¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- owner_id¶
- project_property_views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- project_taxlot_views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property property_count¶
- property_views¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property removing_buildings_status_percentage_cache_key¶
- slug¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- status¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- super_organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- super_organization_id¶
- property taxlot_count¶
- taxlot_views¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- to_dict()¶
- class seed.models.projects.ProjectPropertyView(id, created, modified, property_view, project, compliant, approved_date, approver)¶
Bases:
django_extensions.db.models.TimeStampedModel
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- approved_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- approver¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- approver_id¶
- compliant¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- property_view¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- property_view_id¶
- class seed.models.projects.ProjectTaxLotView(id, created, modified, taxlot_view, project, compliant, approved_date, approver)¶
Bases:
django_extensions.db.models.TimeStampedModel
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- approved_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- approver¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- approver_id¶
- compliant¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- project¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- project_id¶
- taxlot_view¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- taxlot_view_id¶
Properties¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
- class seed.models.properties.Property(*args, **kwargs)¶
Bases:
django.db.models.base.Model
The Property is the parent property that ties together all the views of the property. For example, if a building has multiple changes overtime, then this Property will always remain the same. The PropertyView will point to the unchanged property as the PropertyState and Property view are updated.
If the property can be a campus. The property can also reference a parent property.
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- analysispropertyview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- campus¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- copy_meters(source_property_id, source_persists=True)¶
Copies meters from a source Property to the current Property.
It’s most efficient if the persistence of the source Property’s readings aren’t needed as bulk reassignments can then be used.
The cases and logic are described in comments throughout.
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- data_loggers¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- inventory_documents¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- meters¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- parent_property¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent_property_id¶
- property_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class seed.models.properties.PropertyAuditLog(id, organization, parent1, parent2, parent_state1, parent_state2, state, view, name, description, import_filename, record_type, created)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_record_type_display(*, field=<django.db.models.fields.IntegerField: record_type>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- import_filename¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- parent1¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent1_id¶
- parent2¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent2_id¶
- parent_state1¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent_state1_id¶
- parent_state2¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent_state2_id¶
- propertyauditlog_parent1¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- propertyauditlog_parent2¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- record_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- state¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- state_id¶
- view¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- view_id¶
- class seed.models.properties.PropertyState(*args, **kwargs)¶
Bases:
django.db.models.base.Model
Store a single property. This contains all the state information about the property
For property_timezone, use the pytz timezone strings. The US has the following and a full list can be created by calling pytz.all_timezones in Python:
US/Alaska
US/Aleutian
US/Arizona
US/Central
US/East-Indiana
US/Eastern
US/Hawaii
US/Indiana-Starke
US/Michigan
US/Mountain
US/Pacific
US/Samoa
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- address_line_1¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- address_line_2¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- analysispropertyview¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- audit_template_building_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bounding_box¶
- building_certification¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- building_count¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- building_files¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- centroid¶
- city¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- clean()¶
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
- conditioned_floor_area¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- conditioned_floor_area_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod coparent(state_id)¶
Return the coparent of the PropertyState. This will query the PropertyAuditLog table to determine if there is a coparent and return it if it is found. The state_id needs to be the base ID of when the original record was imported
- Parameters
state_id – integer, state id to find coparent.
- Returns
dict
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- custom_id_1¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- data_state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- egrid_subregion_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- energy_alerts¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- energy_score¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- extra_data¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- generation_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- geocoding_confidence¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_data_state_display(*, field=<django.db.models.fields.IntegerField: data_state>)¶
- get_merge_state_display(*, field=<django.db.models.fields.IntegerField: merge_state>)¶
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- gross_floor_area¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- gross_floor_area_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- hash_object¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- history()¶
Return the history of the property state by parsing through the auditlog. Returns only the ids of the parent states and some descriptions.
main / / parent1 parent2
In the records, parent2 is most recent, so make sure to navigate parent two first since we are returning the data in reverse over (that is most recent changes first)
- Returns
list, history as a list, and the main record
- home_energy_score_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- import_file¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- import_file_id¶
- jurisdiction_property_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- latitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- long_lat¶
- longitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- lot_number¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- measure_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- measures¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- classmethod merge_relationships(merged_state, state1, state2)¶
Merge together the old relationships with the new.
- merge_state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- normalized_address¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- occupied_floor_area¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- occupied_floor_area_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- owner¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- owner_address¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- owner_city_state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- owner_email¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- owner_postal_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- owner_telephone¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- parent_state1¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- parent_state2¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- pm_parent_property_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- pm_property_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- postal_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- promote(cycle, property_id=None)¶
Promote the PropertyState to the view table for the given cycle
- Args:
cycle: Cycle to assign the view property_id: Optional ID of a canonical property model object to retain instead of creating a new property
- Returns:
The resulting PropertyView (note that it is not returning the PropertyState)
- property_footprint¶
- property_name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property_notes¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property_timezone¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- propertyauditlog_state¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- propertymeasure_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- propertyview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- recent_sale_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- release_date¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- scenarios¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- simulation¶
Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
Place.restaurant
is aReverseOneToOneDescriptor
instance.
- site_eui¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site_eui_modeled¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site_eui_modeled_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site_eui_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site_eui_weather_normalized¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- site_eui_weather_normalized_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui_modeled¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui_modeled_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui_weather_normalized¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_eui_weather_normalized_orig¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- source_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- space_alerts¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- to_dict(fields=None, include_related_data=True)¶
Returns a dict version of the PropertyState, either with all fields or masked to just those requested.
- total_ghg_emissions¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- total_ghg_emissions_intensity¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- total_marginal_ghg_emissions¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- total_marginal_ghg_emissions_intensity¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- ubid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- use_description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- year_built¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- year_ending¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class seed.models.properties.PropertyView(*args, **kwargs)¶
Bases:
django.db.models.base.Model
Similar to the old world of canonical building.
A PropertyView contains a reference to a property (which should not change) and to a cycle (time period), and a state (characteristics).
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- cycle¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- cycle_id¶
- gapauditlog_view¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- greenassessmentproperty_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property import_filename¶
Get the import file name form the audit logs
- initialize_audit_logs(**kwargs)¶
- labels¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- notes¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>¶
- project_property_views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- project_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- property_id¶
- propertyauditlog_view¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- state¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- state_id¶
- tax_lot_states()¶
Return a list of TaxLotStates associated with this PropertyView and Cycle
- Returns
list of TaxLotStates
- tax_lot_views()¶
Return a list of TaxLotViews that are associated with this PropertyView and Cycle
- Returns
list of TaxLotViews
- taxlotproperty_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- seed.models.properties.post_save_property_view(sender, **kwargs)¶
When changing/saving the PropertyView, go ahead and touch the Property (if linked) so that the record receives an updated datetime
- seed.models.properties.pre_delete_state(sender, **kwargs)¶
- seed.models.properties.sync_latitude_longitude_and_long_lat(sender, instance, **kwargs)¶
TaxLots¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author
- class seed.models.tax_lots.TaxLot(id, organization, created, updated)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- class seed.models.tax_lots.TaxLotAuditLog(id, organization, parent1, parent2, parent_state1, parent_state2, state, view, name, description, import_filename, record_type, created)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- description¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_record_type_display(*, field=<django.db.models.fields.IntegerField: record_type>)¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- import_filename¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- name¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- parent1¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent1_id¶
- parent2¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent2_id¶
- parent_state1¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent_state1_id¶
- parent_state2¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- parent_state2_id¶
- record_type¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- state¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- state_id¶
- taxlotauditlog_parent1¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotauditlog_parent2¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- view¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- view_id¶
- class seed.models.tax_lots.TaxLotState(id, import_file, organization, data_state, merge_state, custom_id_1, jurisdiction_tax_lot_id, block_number, district, address_line_1, address_line_2, normalized_address, city, state, postal_code, number_properties, extra_data, hash_object, latitude, longitude, long_lat, centroid, bounding_box, taxlot_footprint, ulid, geocoding_confidence, created, updated)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- address_line_1¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- address_line_2¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- block_number¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- bounding_box¶
- centroid¶
- city¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod coparent(state_id)¶
Return the coparent of the TaxLotState. This will query the TaxLotAuditLog table to determine if there is a coparent and return it if it is found. The state_id needs to be the base ID of when the original record was imported
- Parameters
state_id – integer, state id to find coparent.
- Returns
dict
- created¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- custom_id_1¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- data_state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- district¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- extra_data¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- geocoding_confidence¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- get_data_state_display(*, field=<django.db.models.fields.IntegerField: data_state>)¶
- get_merge_state_display(*, field=<django.db.models.fields.IntegerField: merge_state>)¶
- get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)¶
- get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)¶
- get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)¶
- get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)¶
- hash_object¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- history()¶
Return the history of the taxlot state by parsing through the auditlog. Returns only the ids of the parent states and some descriptions.
main
/ / parent1 parent2
In the records, parent2 is most recent, so make sure to navigate parent two first since we are returning the data in reverse over (that is most recent changes first)
- Returns
list, history as a list, and the main record
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- import_file¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- import_file_id¶
- jurisdiction_tax_lot_id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- latitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- long_lat¶
- longitude¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod merge_relationships(merged_state, state1, state2)¶
Stub to implement if merging TaxLotState relationships is needed
- merge_state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- normalized_address¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- number_properties¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- objects = <django.db.models.manager.Manager object>¶
- organization¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- organization_id¶
- postal_code¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- promote(cycle)¶
Promote the TaxLotState to the view table for the given cycle
- Args:
cycle: Cycle to assign the view
- Returns:
The resulting TaxLotView (note that it is not returning the TaxLotState)
- save(*args, **kwargs)¶
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- state¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- taxlot_footprint¶
- taxlotauditlog_parent_state1¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotauditlog_parent_state2¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotauditlog_state¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotview_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- to_dict(fields=None, include_related_data=True)¶
Returns a dict version of the TaxLotState, either with all fields or masked to just those requested.
- ulid¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- updated¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class seed.models.tax_lots.TaxLotView(id, taxlot, state, cycle)¶
Bases:
django.db.models.base.Model
- exception DoesNotExist¶
Bases:
django.core.exceptions.ObjectDoesNotExist
- exception MultipleObjectsReturned¶
Bases:
django.core.exceptions.MultipleObjectsReturned
- cycle¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- cycle_id¶
- id¶
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- property import_filename¶
Get the import file name form the audit logs
- initialize_audit_logs(**kwargs)¶
- labels¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- notes¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- objects = <django.db.models.manager.Manager object>¶
- project_set¶
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings
andTopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- project_taxlot_views¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- property_states()¶
Return a list of PropertyStates associated with this TaxLotView and Cycle
- Returns
list of PropertyStates
- property_views()¶
Return a list of PropertyViews that are associated with this TaxLotView and Cycle
- Returns
list of PropertyViews
- state¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- state_id¶
- taxlot¶
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent
is aForwardManyToOneDescriptor
instance.
- taxlot_id¶
- taxlotauditlog_view¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- taxlotproperty_set¶
Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
- seed.models.tax_lots.post_save_taxlot_view(sender, **kwargs)¶
When changing/saving the TaxLotView, go ahead and touch the TaxLot (if linked) so that the record receives an updated datetime
- seed.models.tax_lots.sync_latitude_longitude_and_long_lat(sender, instance, **kwargs)¶
Module contents¶
:copyright (c) 2014 - 2022, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from the U.S. Department of Energy) and contributors. All rights reserved. :author