def read_detail(self): """Read all detail information for each person, and modify the instaces accordigly""" dd = get_indi(self.working_path, self.filename) for i in dd.keys(): for j in range(len(dd[i])): if dd[i][j].startswith('1|NAME|'): self.People[i].add_name(dd[i][j].split('|')[3]) elif dd[i][j].startswith('1|SEX|'): self.People[i].add_sex(dd[i][j].split('|')[3]) elif dd[i][j].startswith('1|BIRT|'): self.People[i].add_bday(dd[i][j + 1].split('|')[3]) elif dd[i][j].startswith('1|DEAT|'): self.People[i].add_dday(dd[i][j + 1].split('|')[3]) elif dd[i][j].startswith('1|FAMS|'): self.People[i].add_spouse(dd[i][j].split('|')[3]) elif dd[i][j].startswith('1|FAMC|'): self.People[i].add_child(dd[i][j].split('|')[3]) self.People[i].get_age()
def read_indi(self): """Read through file, combine information for each person and create a istance of Individual""" dd = get_indi(self.working_path, self.filename) for i in dd.keys(): self.People[i] = Individual(i)