4
4
5
5
from neomodel import (
6
6
StructuredNode ,
7
- RelationshipTo , RelationshipFrom , Relationship ,
8
- StringProperty , DateProperty ,
9
- UniqueIdProperty , One
7
+ RelationshipTo ,
8
+ RelationshipFrom ,
9
+ Relationship ,
10
+ StringProperty ,
11
+ DateProperty ,
12
+ UniqueIdProperty ,
13
+ One ,
10
14
)
11
15
12
16
@@ -16,20 +20,26 @@ class StateID(StructuredNode, JsonSerializable):
16
20
law enforcement agencies. For example, in New York, this would be
17
21
the Tax ID Number.
18
22
"""
23
+
19
24
id_name = StringProperty () # e.g. "Tax ID Number"
20
25
state = StringProperty (choices = State .choices ()) # e.g. "NY"
21
26
value = StringProperty () # e.g. "958938"
22
- officer = RelationshipFrom (' Officer' , "HAS_STATE_ID" , cardinality = One )
27
+ officer = RelationshipFrom (" Officer" , "HAS_STATE_ID" , cardinality = One )
23
28
24
29
def __repr__ (self ):
25
30
return f"<StateID: Officer { self .officer_id } , { self .state } >"
26
31
27
32
28
33
class Officer (StructuredNode , JsonSerializable ):
29
34
__property_order__ = [
30
- "uid" , "first_name" , "middle_name" ,
31
- "last_name" , "suffix" , "ethnicity" ,
32
- "gender" , "date_of_birth"
35
+ "uid" ,
36
+ "first_name" ,
37
+ "middle_name" ,
38
+ "last_name" ,
39
+ "suffix" ,
40
+ "ethnicity" ,
41
+ "gender" ,
42
+ "date_of_birth" ,
33
43
]
34
44
__hidden_properties__ = ["citations" ]
35
45
@@ -43,19 +53,23 @@ class Officer(StructuredNode, JsonSerializable):
43
53
date_of_birth = DateProperty ()
44
54
45
55
# Relationships
46
- state_ids = RelationshipTo (' StateID' , "HAS_STATE_ID" )
56
+ state_ids = RelationshipTo (" StateID" , "HAS_STATE_ID" )
47
57
units = Relationship (
48
- 'backend.database.models.agency.Unit' , "MEMBER_OF_UNIT" )
58
+ "backend.database.models.agency.Unit" , "MEMBER_OF_UNIT"
59
+ )
49
60
litigation = Relationship (
50
- 'backend.database.models.litigation.Litigation' , "NAMED_IN" )
61
+ "backend.database.models.litigation.Litigation" , "NAMED_IN"
62
+ )
51
63
allegations = Relationship (
52
- 'backend.database.models.complaint.Allegation' , "ACCUSED_OF" )
64
+ "backend.database.models.complaint.Allegation" , "ACCUSED_OF"
65
+ )
53
66
investigations = Relationship (
54
- ' backend.database.models.complaint.Investigation' , "LEAD_BY" )
55
- commands = Relationship (
56
- ' backend.database.models.agency.Unit' , "COMMANDS" )
67
+ " backend.database.models.complaint.Investigation" , "LEAD_BY"
68
+ )
69
+ commands = Relationship ( " backend.database.models.agency.Unit" , "COMMANDS" )
57
70
citations = RelationshipTo (
58
- 'backend.database.models.source.Source' , "UPDATED_BY" , model = Citation )
71
+ "backend.database.models.source.Source" , "UPDATED_BY" , model = Citation
72
+ )
59
73
60
74
def __repr__ (self ):
61
75
return f"<Officer { self .element_id } >"
0 commit comments