-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcensus1880.py
114 lines (107 loc) · 5.39 KB
/
census1880.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#imports
import csv
from func_defs import *
def writeName1880 (c , g, config_dict, source_dict):
idn = 0
with open(g, 'a') as the_file:
with open(c) as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
#print "0 @I(unique 3 digit number)@ INDI"
idn += 1
the_file.write('0 ' + '@I' + "{0:0=3d}".format(idn) + '@' + ' INDI\n')
#Call NameWriter Function
NameWriter(row,'3-Name','8-Relationship', the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#Call SexWriter Function
SexWriter(row,'5-Sex',the_file,idn)
#Call YBdateWriter function
YBdateWriter (row,'6-Age','1880',the_file,idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call BPlaceWriter function
BPlaceWriter(row,'24-POB',the_file,idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call CensusYearWriter function
CensusYearWriter(the_file, '1880')
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call OccupationWriter function
if config_dict["Occupation"] == 1:
OccupationWriter(row, config_dict["occupTag"], '13-Occupation', the_file, '1880', idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call RaceWriter function
if config_dict["Race"] == 1:
RaceWriter(row,'4-Color', config_dict["raceTag"], the_file, '1880',idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call LiteracyWriter1880 function
if config_dict["Literacy"] == 1:
LiteracyWriter1880(row,'22-Cannot read','23-Cannot write', '6-Age',config_dict["literTag"], the_file, '1880', idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call DeafWriter1880 function
if config_dict["Disability"] == 1:
DeafWriter1880(row, '17-Deaf and Dumb',config_dict["disiTag"], the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call BlindWriter function
if config_dict["Disability"] == 1:
BlindWriter(row,'16-Blind', config_dict["disiTag"],the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call SickOrDisabledWriter function
if config_dict["Disability"] == 1:
SickOrDisabledWriter(row,'15-sick or disabled', config_dict["disiTag"],the_file, idn )
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call IdioticWriter function
if config_dict["Disability"] == 1:
IdioticWriter(row, '18-Idiotic', config_dict["disiTag"],the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call InsaneWriter function
if config_dict["Disability"] == 1:
InsaneWriter(row, '19-Insane', config_dict["disiTag"],the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call MaimedWriter function
if config_dict["Disability"] == 1:
MaimedWriter(row,'20-Maimed etc.' ,config_dict["disiTag"],the_file, idn)
try:
SourceWriter1900(row, the_file, source_dict, '1-Dwelling', '2-Family','3-Name', 'T9')
except:
pass
#call FamilyWriter1880 function
FamilyWriter1880(row, '8-Relationship', '12-Married in Year.', the_file,idn, '1880')
#write the source
MainSourceWriter1900(row, the_file, source_dict, '1880')
#call endfile function
EndFile(the_file,g, idn)