-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
officer.py
99 lines (88 loc) · 1.95 KB
/
officer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import enum
from .. import db
class Rank(str, enum.Enum):
# TODO: Is this comprehensive?
TECHNICIAN = "TECHNICIAN"
OFFICER = "OFFICER"
DETECTIVE = "DETECTIVE"
CORPORAL = "CORPORAL"
SERGEANT = "SERGEANT"
LIEUTENANT = "LIEUTENANT"
CAPTAIN = "CAPTAIN"
DEPUTY = "DEPUTY"
CHIEF = "CHIEF"
class State(str, enum.Enum):
AL = "AL"
AK = "AK"
AZ = "AZ"
AR = "AR"
CA = "CA"
CO = "CO"
CT = "CT"
DE = "DE"
FL = "FL"
GA = "GA"
HI = "HI"
ID = "ID"
IL = "IL"
IN = "IN"
IA = "IA"
KS = "KS"
KY = "KY"
LA = "LA"
ME = "ME"
MD = "MD"
MA = "MA"
MI = "MI"
MN = "MN"
MS = "MS"
MO = "MO"
MT = "MT"
NE = "NE"
NV = "NV"
NH = "NH"
NJ = "NJ"
NM = "NM"
NY = "NY"
NC = "NC"
ND = "ND"
OH = "OH"
OK = "OK"
OR = "OR"
PA = "PA"
RI = "RI"
SC = "SC"
SD = "SD"
TN = "TN"
TX = "TX"
UT = "UT"
VT = "VT"
VA = "VA"
WA = "WA"
WV = "WV"
WI = "WI"
WY = "WY"
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.Enum(State)) # 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)
date_of_birth = db.Column(db.Date)
def __repr__(self):
return f"<Officer {self.id}>"