Skip to content

Commit

Permalink
Adds a StateID model as a child of the officer table. This allow the …
Browse files Browse the repository at this point in the history
…index to track statewide Officer IDs such as Tax ID or TCOLE PID numbers.
  • Loading branch information
DMalone87 committed Jan 4, 2024
1 parent b887249 commit 96c0100
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
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"
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
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

0 comments on commit 96c0100

Please sign in to comment.