diff options
author | Ido Ivri <ido@zencity.io> | 2016-10-30 19:47:28 +0200 |
---|---|---|
committer | Ido Ivri <ido@zencity.io> | 2016-10-30 19:47:28 +0200 |
commit | cfed90c1096a92c4c9e622dfe2d55d892595b2ff (patch) | |
tree | df8a996130a7ad199ede2312412d798147576d84 /entities/location.py |
initial commit of work done in DataHack
Diffstat (limited to 'entities/location.py')
-rwxr-xr-x | entities/location.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/entities/location.py b/entities/location.py new file mode 100755 index 0000000..cdec3a6 --- /dev/null +++ b/entities/location.py @@ -0,0 +1,27 @@ +import json + +from entities.basic_entity import BasicEntity + + +class Location(BasicEntity): + def __init__(self, name, types_of_place, name_in_langs, comments_list, viaf): + self.name = name + self.types_of_place = types_of_place + self.name_in_langs = name_in_langs + self.comments_list = comments_list + self.viaf = viaf + + # CSV_FIELDS = ["name", "comments"] + CSV_FIELDS = ["viaf", "name", "types_of_place", "name_in_langs", "comments_list"] + TYPE = "LOCATION" + + + def print_entity(self): + print("Name = " + self.name) + print("Name in langs = " + str(self.name_in_langs)) + print("Types = " + str(self.types_of_place)) + print("Comments = " + str(self.comments_list)) + + def to_csv_dict(self): + return {'name': self.name, + 'comments': json.dumps(self.comments_list, ensure_ascii=False)} |