77 RelationshipTo ,
88 RelationshipFrom ,
99 DateProperty ,
10- UniqueIdProperty
10+ UniqueIdProperty ,
11+ ZeroOrOne
1112)
1213
1314
@@ -19,36 +20,58 @@ class RecordType(str, PropertyEnum):
1920
2021
2122# Neo4j Models
22- class BaseSourceRel (StructuredRel , JsonSerializable ):
23+ class ComplaintSourceRel (StructuredRel , JsonSerializable ):
24+ uid = UniqueIdProperty ()
2325 record_type = StringProperty (
2426 choices = RecordType .choices (),
2527 required = True
2628 )
29+ date_published = DateProperty ()
2730
28-
29- class LegalSourceRel (BaseSourceRel ):
31+ # Legal Source Properties
3032 court = StringProperty ()
3133 judge = StringProperty ()
3234 docket_number = StringProperty ()
33- date_of_action = DateProperty ()
34-
35+ case_event_date = DateProperty ()
3536
36- class NewsSourceRel ( BaseSourceRel ):
37+ # News Source Properties
3738 publication_name = StringProperty ()
38- publication_date = DateProperty ()
3939 publication_url = StringProperty ()
4040 author = StringProperty ()
4141 author_url = StringProperty ()
4242 author_email = StringProperty ()
4343
44-
45- class GovernmentSourceRel (BaseSourceRel ):
44+ # Government Source Properties
4645 reporting_agency = StringProperty ()
4746 reporting_agency_url = StringProperty ()
4847 reporting_agency_email = StringProperty ()
4948
5049
50+ class Location (StructuredNode , JsonSerializable ):
51+ __property_order__ = [
52+ "location_type" , "location_description" ,
53+ "address" , "city" , "state" , "zip" ,
54+ "responsibility" , "responsibility_type"
55+ ]
56+
57+ location_type = StringProperty ()
58+ loocation_description = StringProperty ()
59+ address = StringProperty ()
60+ city = StringProperty ()
61+ state = StringProperty ()
62+ zip = StringProperty ()
63+ responsibility = StringProperty ()
64+ responsibility_type = StringProperty ()
65+
66+
5167class Complaint (StructuredNode , JsonSerializable ):
68+ __property_order__ = [
69+ "uid" , "record_id" , "category" ,
70+ "incident_date" , "recieved_date" ,
71+ "closed_date" , "reason_for_contact" ,
72+ "outcome_of_contact"
73+ ]
74+
5275 uid = UniqueIdProperty ()
5376 record_id = StringProperty ()
5477 category = StringProperty ()
@@ -59,22 +82,33 @@ class Complaint(StructuredNode, JsonSerializable):
5982 outcome_of_contact = StringProperty ()
6083
6184 # Relationships
62- source_org = RelationshipFrom ("Source" , "REPORTED" , model = BaseSourceRel )
85+ source_org = RelationshipFrom (
86+ "Source" , "REPORTED" , model = ComplaintSourceRel )
6387 location = RelationshipTo ("Location" , "OCCURRED_AT" )
6488 civlian_witnesses = RelationshipFrom ("Civilian" , "WITNESSED" )
6589 police_witnesses = RelationshipFrom ("Officer" , "WITNESSED" )
66- attachments = RelationshipTo ("Attachment" , "ATTACHED_TO" )
90+ attachments = RelationshipTo (
91+ 'backend.database.models.attachment.Attachment' , "REFERENCED_IN" )
92+ articles = RelationshipTo (
93+ 'backend.database.models.attachment.Article' , "MENTIONED_IN" )
6794 allegations = RelationshipTo ("Allegation" , "ALLEGED" )
6895 investigations = RelationshipTo ("Investigation" , "EXAMINED_BY" )
6996 penalties = RelationshipTo ("Penalty" , "RESULTS_IN" )
70- civilian_review_board = RelationshipFrom ("CivilianReviewBoard" , "REVIEWED" )
97+ # civilian_review_board = RelationshipFrom(
98+ # "CivilianReviewBoard", "REVIEWED")
7199
72100 def __repr__ (self ):
73101 """Represent instance as a unique string."""
74102 return f"<Complaint { self .uid } >"
75103
76104
77- class Allegation (StructuredNode ):
105+ class Allegation (StructuredNode , JsonSerializable ):
106+ __property_order__ = [
107+ "uid" , "record_id" , "allegation" ,
108+ "type" , "subtype" , "recommended_finding" ,
109+ "recommended_outcome" , "finding" , "outcome"
110+ ]
111+
78112 uid = UniqueIdProperty ()
79113 record_id = StringProperty ()
80114 allegation = StringProperty ()
@@ -86,36 +120,53 @@ class Allegation(StructuredNode):
86120 outcome = StringProperty ()
87121
88122 # Relationships
89- complainant = RelationshipFrom ("Civilian" , "COMPLAINED_OF" )
123+ complainant = RelationshipFrom (
124+ "Civilian" , "COMPLAINED_OF" , Cadinality = ZeroOrOne )
125+ complaint = RelationshipFrom (
126+ "Complaint" , "ALLEGED" , Cadinality = ZeroOrOne )
90127 accused = RelationshipFrom ("Officer" , "ACCUSED_OF" )
91- complaint = RelationshipFrom ("Complaint" , "ALLEGED" )
92128
93129 def __repr__ (self ):
94130 """Represent instance as a unique string."""
95131 return f"<Allegation { self .uid } >"
96132
97133
98- class Investigation (StructuredNode ):
134+ class Investigation (StructuredNode , JsonSerializable ):
135+ __property_order__ = [
136+ "uid" , "start_date" , "end_date"
137+ ]
138+
99139 uid = UniqueIdProperty ()
100140 start_date = DateProperty ()
101141 end_date = DateProperty ()
102142
103143 # Relationships
104- investigator = RelationshipFrom ("Officer" , "LED_BY" )
144+ investigator = RelationshipFrom (
145+ "Officer" , "LED_BY" , Cadinality = ZeroOrOne )
105146 complaint = RelationshipFrom ("Complaint" , "EXAMINED_BY" )
106147
107148 def __repr__ (self ):
108149 """Represent instance as a unique string."""
109150 return f"<Investigation { self .uid } >"
110151
111152
112- class Penalty (StructuredNode ):
153+ class Penalty (StructuredNode , JsonSerializable ):
154+ __property_order__ = [
155+ "uid" , "penalty" , "date_assessed" ,
156+ "crb_plea" , "crb_case_status" ,
157+ "crb_disposition" , "agency_disposition"
158+ ]
159+
113160 uid = UniqueIdProperty ()
114- description = StringProperty ()
161+ penalty = StringProperty ()
115162 date_assessed = DateProperty ()
163+ crb_plea = StringProperty ()
164+ crb_case_status = StringProperty ()
165+ crb_disposition = StringProperty ()
166+ agency_disposition = StringProperty ()
116167
117168 # Relationships
118- officer = RelationshipFrom ("Officer" , "RECEIVED" )
169+ officer = RelationshipFrom ("models.officer. Officer" , "RECEIVED" )
119170 complaint = RelationshipFrom ("Complaint" , "RESULTS_IN" )
120171
121172 def __repr__ (self ):
0 commit comments