Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature #313 - Add Statewide IDs #314

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Adds a StateID model as a child of the officer table. This allow the …
…index to track statewide Officer IDs such as Tax ID or TCOLE PID numbers.
  • Loading branch information
DMalone87 committed Jan 4, 2024
commit 96c0100d6880ffb6b60c1340daf31349ec0c1ec4
20 changes: 17 additions & 3 deletions backend/database/models/officer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,30 @@ class Rank(str, enum.Enum):
CHIEF = "CHIEF"


class StateID(db.Model):
"""
Represents a Statewide ID that follows an offcier even as they move between
law enforcement agencies. for an officer. For example, in New York, this
would be the Tax ID Number.
"""
id = db.Column(db.Integer, primary_key=True)
officer_id = db.Column(
db.Integer, db.ForeignKey("officer.id"))
id_name = db.Column(db.Text) # e.g. "Tax ID Number"
state = db.Column(db.Text) # e.g. "NY"
DMalone87 marked this conversation as resolved.
Show resolved Hide resolved
value = db.Column(db.Text) # e.g. "958938"

def __repr__(self):
return f"<StateID {self.id}>"


class Officer(db.Model):
id = db.Column(db.Integer, primary_key=True) # officer id
first_name = db.Column(db.Text)
last_name = db.Column(db.Text)
race = db.Column(db.Text)
ethnicity = db.Column(db.Text)
gender = db.Column(db.Text)
# Note: rank at time of incident
Copy link
Collaborator Author

@DMalone87 DMalone87 Jan 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rank and Star are removed since those are dependent on the Law Enforcement Agency the officer is employed by and are not unique to the officer in all cases. Those values can still be found in the association table for Officers and Agencies.

rank = db.Column(db.Enum(Rank))
star = db.Column(db.Text) # type?
date_of_birth = db.Column(db.Date)

def __repr__(self):
Expand Down
4 changes: 3 additions & 1 deletion backend/database/models/perpetrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class Perpetrator(db.Model):
unit = db.Column(db.Text) # type?
# Note: rank at time of incident
rank = db.Column(db.Enum(Rank))
star = db.Column(db.Text) # type?
state_id_val = db.Column(db.Text)
state_id_state = db.Column(db.Text)
state_id_name = db.Column(db.Text)
role = db.Column(db.Text)
suspects = db.relationship(
"Officer", secondary=perpetrator_officer, backref="accusations")
Expand Down
Loading