apps.parcel.models.py
- class apps.parcel.models.AllCovenantedDocsCSVExport(*args, **kwargs)
A CSV export of all documents that have confirmed racial covenants, whether they have been mapped or not. Note that the count of these rows will differ from the main Deed Machine exports because this is a list of all documents, not all parcels with covenants. (Racial covenants on a propery are often repeated in subsequent sales.) This export is useful for determining which documents may need to be flagged in property records for racial language. Generated by dump_all_covenanted_docs management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
csv (FileField) – Csv
doc_count (IntegerField) – Doc count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:allcovenanteddocscsvexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.CSVExport(*args, **kwargs)
One of the Deed Machine’s main public data exports. A CSV export of modern properties that have confirmed racial covenants. Generated by dump_covenants_csv management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
csv (FileField) – Csv
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:csvexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.CovenantedParcel(*args, **kwargs)
This is a holder model to hopefully speed up export of flattened covenants data produced by the Parcel.covenanted_objects manager.
- Parameters:
id (BigAutoField) – Primary key: ID
cnty_name (CharField) – Cnty name
cnty_fips (CharField) – Cnty fips
doc_num (CharField) – Doc num
main_image (CharField) – Main image
deed_year (IntegerField) – Deed year
deed_date (DateField) – Deed date
cov_text (TextField) – Cov text
seller (CharField) – Seller
buyer (CharField) – Buyer
street_add (CharField) – Street add
city (CharField) –
City
The city name where the parcel is located. (Not taxpayer city.)
state (CharField) –
State
The 2-digit state abbreviation where the parcel is located. (Not taxpayer state.)
zip_code (CharField) –
Zip code
The zip code where the parcel is located. (Not taxpayer zip.)
add_cov (CharField) – Add cov
block_cov (CharField) – Block cov
lot_cov (CharField) – Lot cov
map_book (CharField) – Map book
map_page (CharField) – Map page
cnty_pin (CharField) – Cnty pin
add_mod (CharField) – Add mod
block_mod (CharField) – Block mod
lot_mod (CharField) – Lot mod
ph_dsc_mod (TextField) – Ph dsc mod
join_strgs (JSONField) – Join strgs
cov_type (CharField) – Cov type
match_type (CharField) – Match type
manual_cx (BooleanField) – Manual cx
dt_updated (DateField) – Dt updated
zn_subj_id (IntegerField) – Zn subj id
zn_dt_ret (DateField) – Zn dt ret
image_ids (JSONField) – Image ids
med_score (FloatField) – Med score
plat_dbid (IntegerField) – Plat dbid
subd_dbid (IntegerField) – Subd dbid
geom_4326 (MultiPolygonField) –
Geom 4326
Multipolygon geometry of the parcel, in SRID:4326 coordinate reference system (WGS-84). Make sure that your shapefile has been correctly transformed to SRID:4326 if it was originally projected to another coordinate system. If you experience import errors due to invalid geometries, try using “Repair geometries” in the QGIS Processing Toolbox or equivalent tool.
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:covenantedparcel)parcel (
ForeignKeytoParcel) –Parcel (related name:
covenantedparcel)Foreign key to parcel record this is tied to
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.CovenantsParcelManager(*args, **kwargs)
This is the main heavy-lifter for exports – as much work as possible being done here to tag the parcel with the earliest mention of the covenant and its related attributes. A lot of work gets done here. The oldest_deed line finds the oldest covenant document linked to a parcel, which determines the exported covenant date and which ZooniverseSubject will be used (in case of duplication) to populate things like the covenant text, buyer and seller. This manager also brings together covenants identified via Zooniverse transcription (ZooniverseSubject objects) and covenants entered manually (ManualCovenant.)
- get_queryset()
Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.
- class apps.parcel.models.DischargeCSVExport(*args, **kwargs)
A CSV export of all documents that have confirmed racial covenants, whether they have been mapped or not. Note that the count of these rows will differ from the main Deed Machine exports because this is a list of all documents, not all parcels with covenants. (Racial covenants on a propery are often repeated in subsequent sales.) This export is useful for determining which documents may need to be flagged in property records for racial language. Generated by dump_all_covenanted_docs management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
csv (FileField) – Csv
doc_count (IntegerField) – Doc count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:dischargecsvexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.GeoJSONExport(*args, **kwargs)
One of the Deed Machine’s main public data exports. A GeoJSON export of modern properties that have confirmed racial covenants. Generated by dump_covenants_geojson management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
geojson (FileField) – Geojson
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:geojsonexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.JoinReport(*args, **kwargs)
A CSV report generated in the course of the match_parcels management command to show what racial covenants did and didn’t successfully match to a Parcel record. File saved to S3.
- Parameters:
id (BigAutoField) – Primary key: ID
report_csv (FileField) – Report csv
covenanted_doc_count (IntegerField) – Covenanted doc count
matched_lot_count (IntegerField) – Matched lot count
matched_subject_count (IntegerField) – Matched subject count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:joinreport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.ManualParcelCandidate(*args, **kwargs)
Similar to ExtraParcelCandidate on ZooniverseSubject, this would let you fill out a smart range of lots in combo with addition and block, and would generate additional join strings. To be used where the physical description is difficult to automatically parse, but simple lots are extractable manually.
- Parameters:
id (BigAutoField) – Primary key: ID
parcel_pin_primary (CharField) –
Parcel pin primary
Primary PIN number (not DB ID) of the parcel this candidate is linked to. These are kept separate of the foreign key relationship in case this needs to be reconnected later by import/export process.
workflow_name (CharField) –
Workflow name
Name of workflow. Mostly hidden from user input, used to connect to appropriate workflow on re-import
addition (CharField) –
Addition
User-entered addition/plat/subdivision. Must be filled out to generate join string.
lot (TextField) –
Lot
User-entered lot, which can be any parseable lot value, like “1”, “1-3”, “1,2,3”. Must be filled out to generate join string.
block (CharField) –
Block
User-entered block. One ManualParcelCandidate should be added for each block or addition needed. May be blank.
date_added (DateTimeField) –
Date added
Auto-generated
date_updated (DateTimeField) –
Date updated
Auto-generated
comments (TextField) –
Comments
User comments on why this ManualParcelCandidate has been added.
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:manualparcelcandidate)parcel (
ForeignKeytoParcel) –Parcel (related name:
manualparcelcandidate)Foreign key to parcel record this is tied to
- exception DoesNotExist
- exception MultipleObjectsReturned
- addition
Type:
CharFieldAddition
User-entered addition/plat/subdivision. Must be filled out to generate join string.
- block
Type:
CharFieldBlock
User-entered block. One ManualParcelCandidate should be added for each block or addition needed. May be blank.
- date_added
Type:
DateTimeFieldDate added
Auto-generated
- date_updated
Type:
DateTimeFieldDate updated
Auto-generated
- lot
Type:
TextFieldLot
User-entered lot, which can be any parseable lot value, like “1”, “1-3”, “1,2,3”. Must be filled out to generate join string.
- parcel
Type:
ForeignKeytoParcelParcel (related name:
manualparcelcandidate)Foreign key to parcel record this is tied to
- parcel_pin_primary
Type:
CharFieldParcel pin primary
Primary PIN number (not DB ID) of the parcel this candidate is linked to. These are kept separate of the foreign key relationship in case this needs to be reconnected later by import/export process.
- save(*args, **kwargs)
Saving a ManualParcelCandidate populates values needed for export/import, and also triggers the attached Parcel to run its save routine to re-generate its set of parcel candidates.
- class apps.parcel.models.PMTilesExport(*args, **kwargs)
One of the Deed Machine’s main public data exports. A PMTiles export of modern properties that have confirmed racial covenants. Generated by dump_covenants_shapefile management command with –pmtiles flag. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
pmtiles (FileField) – Pmtiles
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:pmtilesexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.Parcel(*args, **kwargs)
A modern GIS parcel record imported from a shapefile, generally sourced from a county GIS system or open records portal. Imported via load_parcel_shp management command. Racial covenant exports (besides unmapped documents) are aggregated to identify the earliest recorded covenant for each modern parcel, which means each row in covenants exports is equivalent to one Parcel object. By filling out the parcel_shps -> mapping object in the workflow config, users can tell the load_parcel_shp management command which attributes/columns in the original shapefile correspond to the attribute names needed to import into the Parcel table.
- Parameters:
id (BigAutoField) – Primary key: ID
feature_id (IntegerField) –
Feature id
A unique identifier in the original shapefile.
pin_primary (CharField) –
Pin primary
The primary property identification number used by the records custodian to look up the parcel in modern systems. This should be unique for matching purposes.
pin_secondary (CharField) –
Pin secondary
An optional secondary identification number used by the records custodian to look up the parcel in modern systems.
street_address (CharField) –
Street address
The street address of the parcel, e.g. “123 Main Street” Note that many counties have columns for both the address of the parcel AND the address of the responsible taxpayer, so be sure that this is the address of the parcel, often known as the situs address
city (CharField) –
City
The city name where the parcel is located. (Not taxpayer city.)
state (CharField) –
State
The 2-digit state abbreviation where the parcel is located. (Not taxpayer state.)
zip_code (CharField) –
Zip code
The zip code where the parcel is located. (Not taxpayer zip.)
county_name (CharField) –
County name
The county name where the parcel is located. (Usually set statically for whole county at import)
county_fips (CharField) –
County fips
The 5-digit U.S. Census county FIPS where the parcel is located. (Usually set statically for whole county at import). Note that FIPS codes may change with each decenniel census.
plat_name (CharField) –
Plat name
The addition name of this parcel, as it originally appears (not standardized).
plat_standardized (CharField) –
Plat standardized
The addition name of this parcel, standardized by running plat_name through a series of regexes.
block (CharField) –
Block
User-entered block. One ManualParcelCandidate should be added for each block or addition needed. May be blank.
lot (CharField) –
Lot
User-entered lot, which can be any parseable lot value, like “1”, “1-3”, “1,2,3”. Must be filled out to generate join string.
join_description (TextField) –
Join description
The full physical description of this parcel. Not used for matching as yet.
phys_description (TextField) –
Phys description
The full physical description of this parcel, generally a duplicate of join_description. Not well thought out.
township (IntegerField) –
Township
In the PLSS system, the township of this parcel. Not particularly useful currently, but good information to have.
range (IntegerField) –
Range
In the PLSS system, the range of this parcel. Not particularly useful currently, but good information to have.
section (IntegerField) –
Section
In the PLSS system, the section of this parcel. Not particularly useful currently, but good information to have.
orig_data (JSONField) –
Orig data
A JSON field storing the original set of attributes found in the shapefile under their original column names, including values not imported to a Deed Machine field. Can be accessed via Django shell.
orig_filename (CharField) –
Orig filename
The original filename of the imported shapefile.
geom_4326 (MultiPolygonField) –
Geom 4326
Multipolygon geometry of the parcel, in SRID:4326 coordinate reference system (WGS-84). Make sure that your shapefile has been correctly transformed to SRID:4326 if it was originally projected to another coordinate system. If you experience import errors due to invalid geometries, try using “Repair geometries” in the QGIS Processing Toolbox or equivalent tool.
bool_covenant (BooleanField) –
Bool covenant
Has this Parcel been linked to a confirmed racial covenant? Set by match_parcels.py and individual save routines of ZooniverseSubject, ManualCovenant, PlatAlternateName, and SubdivisionAlternateName.
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:parcel)plat (
ForeignKeytoPlat) –Plat (related name:
parcel)Plat refers to a plat map, which is often old, and Subdivision refers to a modern GIS layer
subdivision_spatial (
ForeignKeytoSubdivision) –Subdivision spatial (related name:
parcel)The Subdivision object that this parcel lies inside, geospatially. May not have the same name as plat_name.
Reverse relationships:
- Parameters:
parceljoincandidate (Reverse
ForeignKeyfromParcelJoinCandidate) – All parcel join candidates of this parcel (related name ofparcel)manualparcelcandidate (Reverse
ForeignKeyfromManualParcelCandidate) – All manual parcel candidates of this parcel (related name ofparcel)covenantedparcel (Reverse
ForeignKeyfromCovenantedParcel) – All covenanted parcels of this parcel (related name ofparcel)zooniversesubject (Reverse
ManyToManyFieldfromZooniverseSubject) – All zooniverse subjects of this parcel (related name ofparcel_matches)manualcovenant (Reverse
ManyToManyFieldfromManualCovenant) – All manual covenants of this parcel (related name ofparcel_matches)
- exception DoesNotExist
- exception MultipleObjectsReturned
- bool_covenant
Type:
BooleanFieldBool covenant
Has this Parcel been linked to a confirmed racial covenant? Set by match_parcels.py and individual save routines of ZooniverseSubject, ManualCovenant, PlatAlternateName, and SubdivisionAlternateName.
- county_fips
Type:
CharFieldCounty fips
The 5-digit U.S. Census county FIPS where the parcel is located. (Usually set statically for whole county at import). Note that FIPS codes may change with each decenniel census.
- county_name
Type:
CharFieldCounty name
The county name where the parcel is located. (Usually set statically for whole county at import)
- covenant_objects = <apps.parcel.models.CovenantsParcelManager object>
Django manager to access the ORM Use
Parcel.objects.all()to fetch all objects.Manager used to list only parcels linked to racial covenants See CovenantsParcelManager() for details.
- feature_id
Type:
IntegerFieldFeature id
A unique identifier in the original shapefile.
- geom_4326
Type:
MultiPolygonFieldGeom 4326
Multipolygon geometry of the parcel, in SRID:4326 coordinate reference system (WGS-84). Make sure that your shapefile has been correctly transformed to SRID:4326 if it was originally projected to another coordinate system. If you experience import errors due to invalid geometries, try using “Repair geometries” in the QGIS Processing Toolbox or equivalent tool.
- join_description
Type:
TextFieldJoin description
The full physical description of this parcel. Not used for matching as yet.
- objects = <django.db.models.Manager object>
Django manager to access the ORM Use
Parcel.objects.all()to fetch all objects.Manager used to list all Parcel rows, not just parcels linked to covenants.
- orig_data
Type:
JSONFieldOrig data
A JSON field storing the original set of attributes found in the shapefile under their original column names, including values not imported to a Deed Machine field. Can be accessed via Django shell.
- phys_description
Type:
TextFieldPhys description
The full physical description of this parcel, generally a duplicate of join_description. Not well thought out.
- pin_primary
Type:
CharFieldPin primary
The primary property identification number used by the records custodian to look up the parcel in modern systems. This should be unique for matching purposes.
- pin_secondary
Type:
CharFieldPin secondary
An optional secondary identification number used by the records custodian to look up the parcel in modern systems.
- plat
Type:
ForeignKeytoPlatPlat (related name:
parcel)Plat refers to a plat map, which is often old, and Subdivision refers to a modern GIS layer
- plat_name
Type:
CharFieldPlat name
The addition name of this parcel, as it originally appears (not standardized).
- plat_standardized
Type:
CharFieldPlat standardized
The addition name of this parcel, standardized by running plat_name through a series of regexes.
- range
Type:
IntegerFieldRange
In the PLSS system, the range of this parcel. Not particularly useful currently, but good information to have.
- 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.
- section
Type:
IntegerFieldSection
In the PLSS system, the section of this parcel. Not particularly useful currently, but good information to have.
- state
Type:
CharFieldState
Choices:
ALAKAZARCACOCTDEDCFLand 41 more
The 2-digit state abbreviation where the parcel is located. (Not taxpayer state.)
- street_address
Type:
CharFieldStreet address
The street address of the parcel, e.g. “123 Main Street” Note that many counties have columns for both the address of the parcel AND the address of the responsible taxpayer, so be sure that this is the address of the parcel, often known as the situs address
- subdivision_spatial
Type:
ForeignKeytoSubdivisionSubdivision spatial (related name:
parcel)The Subdivision object that this parcel lies inside, geospatially. May not have the same name as plat_name.
- township
Type:
IntegerFieldTownship
In the PLSS system, the township of this parcel. Not particularly useful currently, but good information to have.
- class apps.parcel.models.ParcelJoinCandidate(*args, **kwargs)
A given parcel can be made up of more than one lot, theoretically. This creates and easily queryable lookup that can be used efficiently when joinable records are updated
- Parameters:
id (BigAutoField) – Primary key: ID
plat_name_standardized (CharField) –
Plat name standardized
Addition/plat name after filtering
join_string (CharField) –
Join string
Join string associated with this candidate, which is what will be used to attempt auto-mapping
metadata (JSONField) –
Metadata
Information about the filtering/processing of this candidate, see parcel_utils.py
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:parceljoincandidate)parcel (
ForeignKeytoParcel) –Parcel (related name:
parceljoincandidate)Foreign key to parcel record this is tied to
- exception DoesNotExist
- exception MultipleObjectsReturned
- join_string
Type:
CharFieldJoin string
Join string associated with this candidate, which is what will be used to attempt auto-mapping
- metadata
Type:
JSONFieldMetadata
Information about the filtering/processing of this candidate, see parcel_utils.py
- parcel
Type:
ForeignKeytoParcelParcel (related name:
parceljoincandidate)Foreign key to parcel record this is tied to
- class apps.parcel.models.ShpExport(*args, **kwargs)
One of the Deed Machine’s main public data exports. A shapefile export of modern properties that have confirmed racial covenants. Generated by dump_covenants_shp management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
shp_zip (FileField) – Shp zip
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:shpexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.UnmappedCSVExport(*args, **kwargs)
One of the Deed Machine’s main public data exports. A CSV export of confirmed racial covenants that have not successfully been matched to a Parcel yet. Generated by dump_unmapped_csv management command. File saved to S3 by default, but can be saved locally as well.
- Parameters:
id (BigAutoField) – Primary key: ID
csv (FileField) – Csv
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:unmappedcsvexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- class apps.parcel.models.ValidationCSVExport(*args, **kwargs)
I don’t remember what this is for.
- Parameters:
id (BigAutoField) – Primary key: ID
csv (FileField) – Csv
covenant_count (IntegerField) – Covenant count
created_at (DateTimeField) – Created at
Relationship fields:
- Parameters:
workflow (
ForeignKeytoZooniverseWorkflow) – Workflow (related name:validationcsvexport)
- exception DoesNotExist
- exception MultipleObjectsReturned
- apps.parcel.models.model_delete(sender, instance, **kwargs)
If ManualParcelCandidate is deleted, re-run the parent Parcel save method to remove it from the list of join candidates used by Parcel