Skip to content

Commit

Permalink
More models documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejcorey committed Jul 9, 2024
1 parent b834f50 commit e5bfd78
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/zoon/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@


class ZooniverseWorkflow(models.Model):
'''The main shell that keeps each project separate from others. Generally, each county will require a separate ZooniverseWorkflow object.'''
zoon_id = models.IntegerField(null=True, blank=True, db_index=True)
workflow_name = models.CharField(max_length=100, db_index=True)
# version = models.FloatField(null=True, blank=True)
Expand Down Expand Up @@ -156,7 +157,7 @@ def get_queryset(self):


class ZooniverseSubject(models.Model):
'''Future: Assign an id to correspond to a deed image pre-Zooniverse'''
'''This is the main model representing an individual suspected covenant coming back from Zooniverse transcription. Each subject should have five individual transcription responses, which will be aggregated to be displayed with each ZooniverseSubject. Possible future task: Assign an id to correspond to a deed image pre-Zooniverse'''
workflow = models.ForeignKey(ZooniverseWorkflow, on_delete=models.CASCADE)
zoon_subject_id = models.IntegerField(db_index=True)

Expand Down Expand Up @@ -419,6 +420,7 @@ def save(self, *args, **kwargs):


class ZooniverseResponseRaw(models.Model):
'''Information imported after Zooniverse transcription in its natural state after Zooniverse's panoptes-aggregation scripts. Most useful data is still contained inside annotations and subject_data fields, which will be further processed to produce a ZooniverseResponseProcessed.'''
classification_id = models.IntegerField()
user_name = models.CharField(max_length=100, blank=True, db_index=True)
user_id = models.IntegerField(null=True)
Expand All @@ -443,6 +445,7 @@ class ZooniverseResponseRaw(models.Model):


class ZooniverseResponseProcessed(models.Model):
'''Information about an individual transcription that will show up under a ZooniverseSubject during manual review. A more fully processed version of ZooniverseResponseRaw.'''
workflow = models.ForeignKey(ZooniverseWorkflow, on_delete=models.CASCADE)
classification_id = models.IntegerField()
user_name = models.CharField(max_length=100, blank=True, db_index=True)
Expand Down Expand Up @@ -772,6 +775,7 @@ def manual_cov_post_save(sender, instance=None, created=False, **kwargs):


class ManualSupportingDocument(models.Model):
'''An uploaded document that provides evidence of a racial covenant, which is attached to a ManualCovenant object.'''
workflow = models.ForeignKey(
ZooniverseWorkflow, on_delete=models.CASCADE, null=True)
manual_covenant = models.ForeignKey(ManualCovenant, on_delete=models.CASCADE)
Expand Down
3 changes: 3 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ The Deed Machine was created at Mapping Prejudice at the University of Minnesota
modules/uploading-files.rst
modules/ingesting-hits.rst
modules/uploading-to-zooniverse.rst
modules/uploading-parcel-data.rst
modules/downloading-new-results.rst
modules/manual-data-cleaning.rst

Expand All @@ -49,7 +50,9 @@ The Deed Machine was created at Mapping Prejudice at the University of Minnesota
:maxdepth: 2
:caption: Models

modules/django-models.rst
modules/apps-deed-models.rst
modules/apps-zoon-models.rst

Indices and tables
==================
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/apps-zoon-models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apps.zoon.models.py
===================
.. automodule:: apps.zoon.models
:members:
114 changes: 114 additions & 0 deletions docs/modules/django-models.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
Django model structure
======================

Core concepts
-------------

The Django component of the Deed Machine is divided up into apps, and within each app, models.

The four Django apps are ``deed``, ``parcel``, ``plat``, and ``zoon``.

Main models that end users will interact with:
::

racial_covenants_processor
├── apps
├── deed
├── DeedPage
├── parcel
├── Parcel
├── ParcelJoinCandidate
├── ShpExport/CSVExport/GeoJSONExport
├── UnmappedCSVExport
├── AllCovenantedDocsCSVExport
├── plat
├── Plat
├── PlatAlternateName
├── Subdivision
├── SubdivisionAlternateName
├── zoon
├── ZooniverseWorkflow
├── ZooniverseSubject
├── ManualCorrection
├── ExtraParcelCandidate
├── ManualCovenant
├── ManualSupportingDocument


The Deed app
------------

The Deed app houses information about historical property record images provided by records custodians to be searched for racial covenants.

After :ref:`_initial-processing`, management commands in the Deed app ingest metadata about these raw documents and whether or not they have been identified as potential racial covenants (i.e. the "hits") into the Django/postgresql database.

See :ref:`_ingesting-hits` for more about this process.

The Parcel app
--------------

The Parcel app is used to house information about modern, GIS-enabled property records, which are used to map historical racial covenants. The Deed Machine uses transcribed information about each historical covenant to try to link the addition, block and lot of each covenant to matching information in modern parcel records stored in the Parcel app. The Parcel app is populated by uploading parcel shapefiles into the GeoDjango Parcel model, with or without preprocessing.

See :ref:`_uploading-parcel-data`.

Mapping Prejudice counts racial covenants by identifying the earliest racial covenant document that is associated with a modern property. Thus, each row in Mapping Prejudice's covenants exports represents one modern property, as opposed to each row representing one document, as the same racial covenant was often repeated in subsequent sales of the same property.

Logic for aggregation and export of racial covenants is mostly contained in the Parcel app through the CovenantsParcelManager.

The Plat app
------------

The Plat app is used to organize information about historical plat or modern subdivision records provided by records custodians or county GIS offices. By uploading information about plats/subdivisions and by adding alternative spellings of plat/subdivision names, users can generate additional join candidates that may help to map covenants with unusual spelling variations in their addition names.

Though they are somewhat interchangeable terms in the larger property world, in the Deed Machine, the Plat model is for historical plat maps, while the Subdivision model is for modern, GIS-enabled data, which is more likely to be available, and can be used to spatially associate Parcel records with additional subdivision names.

The Zoon app
------------

The Zoon app contains information related to Zooniverse transcription, including uploading of hits to zooniverse, and the processing of data coming back from Zooniverse Transcription.

Manual correction work is done by browsing the ZooniverseSubject list, using a combination of ManualCorrection and ExtraParcelCandidate objects that are generated by manual edits.

Covenants entered manually (not through Zooniverse transcription) are stored in the ManualCovenant model of the Zoon app.

Full list of Apps/Models
------------------------

::

racial_covenants_processor
├── apps
├── deed
├── DeedPage
├── SearchHitReport
├── parcel
├── Parcel
├── ParcelJoinCandidate
├── JoinReport
├── ShpExport
├── CSVExport
├── UnmappedCSVExport
├── ValidationCSVExport
├── AllCovenantedDocsCSVExport
├── GeoJSONExport
├── plat
├── Plat
├── PlatMapPage
├── PlatAlternateName
├── Subdivision
├── SubdivisionAlternateName
├── zoon
├── ZooniverseWorkflow
├── UnmappedZooniverseManager
├── AllCovenantedDocsZooniverseManager
├── ValidationZooniverseManager
├── ZooniverseSubject
├── ZooniverseResponseRaw
├── ZooniverseResponseProcessed
├── ZooniverseUser
├── ReducedResponse_Question
├── ReducedResponse_Text
├── ManualCorrection
├── ExtraParcelCandidate
├── ManualCovenant
├── ManualSupportingDocument
2 changes: 2 additions & 0 deletions docs/modules/uploading-files.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _initial-processing:

Uploading images/initial processing
===================================

Expand Down
9 changes: 9 additions & 0 deletions docs/modules/uploading-parcel-data.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _uploading-parcel-data:

Uploading modern parcel data for mapping
========================================

TK TK TK
---------

TK.

0 comments on commit e5bfd78

Please sign in to comment.