Skip to content

Commit

Permalink
Add Field instances and delete extra biographical fields
Browse files Browse the repository at this point in the history
  • Loading branch information
linguistcrg committed Jul 7, 2024
1 parent 941ea7e commit 61b0b24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
22 changes: 10 additions & 12 deletions edpop_explorer/readers/kvcs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import csv
from pathlib import Path
from typing import List
from edpop_explorer import Reader, ReaderError, BiographicalRecord
from edpop_explorer import Reader, ReaderError, Field, BiographicalRecord, BIOGRAPHICAL
from rdflib import URIRef


Expand All @@ -15,21 +15,19 @@ class KVCSReader(Reader):
FETCH_ALL_AT_ONCE = True
SHORT_NAME = "KVCS"
DESCRIPTION = "Drukkers & Uitgevers in KVCS"
#CHECK LATER AND MODIFY
READERTYPE = BIOGRAPHICAL

@classmethod
def _convert_record(cls, rawrecord: dict) -> BiographicalRecord:
record = BiographicalRecord(from_reader=cls)
record.data = rawrecord
record.identifier = rawrecord['ID']
record.name = rawrecord['Name']
record.gender = rawrecord['Gender']
record.relations = rawrecord['Relations']
record.lifespan = rawrecord['Years of life']
record.places_of_activity = rawrecord['City']
record.printed_location = rawrecord['Location as mentioned on print products']
record.timespan = rawrecord['Years of activity']
record.activities = rawrecord['Kind of print and sales activities']
record.alternative_id = rawrecord['KVCS-ID']
record.identifier = Field(rawrecord['ID'])
record.name = Field(rawrecord['Name'])
record.gender = Field(rawrecord['Gender'])
record.lifespan = Field(rawrecord['Years of life'])
record.places_of_activity = Field(rawrecord['City'])
record.activity_timespan = Field(rawrecord['Years of activity'])
record.activities = Field(rawrecord['Kind of print and sales activities'])
return record

@classmethod
Expand Down
12 changes: 3 additions & 9 deletions edpop_explorer/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,10 @@ class BiographicalRecord(Record):
place_of_birth: Optional[Field] = None
place_of_death: Optional[Field] = None
places_of_activity: Optional[List[Field]] = None
timespan: Optional[Field] = None
activity_timespan: Optional[Field] = None
activities: Optional[List[Field]] = None
gender: Optional[List[Field]] = None
relations: Optional[List[Field]] = None
gender: Optional[Field] = None
lifespan: Optional[Field] = None
printed_location: Optional[List[Field]] = None
alternative_id: Optional[Field] = None

def __init__(self, from_reader: Type["Reader"]):
super().__init__(from_reader)
Expand All @@ -258,13 +255,10 @@ def __init__(self, from_reader: Type["Reader"]):
('place_of_birth', EDPOPREC.placeOfBirth, Field),
('place_of_death', EDPOPREC.placeOfDeath, Field),
('places_of_activity', EDPOPREC.placeOfActivity, Field),
('timespan', EDPOPREC.timespan, Field),
('activity_timespan', EDPOPREC.timespan, Field),
('activities', EDPOPREC.activity, Field),
('gender', EDPOPREC.gender, Field),
('relations', EDPOPREC.relations, Field),
('lifespan', EDPOPREC.lifespan, Field),
('printed_location', EDPOPREC.printedLocation, Field),
('alternative_id', EDPOPREC.alternativeId, Field),
]

def __str__(self) -> str:
Expand Down

0 comments on commit 61b0b24

Please sign in to comment.