-
Notifications
You must be signed in to change notification settings - Fork 0
/
complaint.py
36 lines (28 loc) · 1.07 KB
/
complaint.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
"""Module for defining the Complaint class."""
from pydantic import BaseModel
from datetime import datetime
class Complaint(BaseModel):
"""Abstract base class for the complaint object."""
# primary information
id: int
description: str
country: str
# metadata
date_received: datetime
date_occurred: datetime
owned_by: str
def region_from_country(country: str, tracer: dict) -> str:
"""Return the region from the country."""
if country in tracer:
return tracer[country]
class ParentRecord(Complaint):
"""A subclass to represent the parent record object."""
def __init__(self, id, description, country, date_received, date_occurred, owned_by):
self.parent_id = id
self.event_description = description
self.country_of_origin = country
self.region = self.region_from_country(country)
self.receipt_date = date_received
self.event_date = date_occurred
self.assigned_to = owned_by
#super().__init__(id, description, country, date_received, date_occurred, owned_by)