-
Notifications
You must be signed in to change notification settings - Fork 0
/
census1860.py
84 lines (77 loc) · 3.86 KB
/
census1860.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
#imports
import csv
from func_defs import *
def writeName1860 (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
Name_Writer_No_Relation(row, '3-name', the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#Call SexWriter Function
SexWriter(row,'5-Sex',the_file,idn)
#Call YBdateWriter function
YBdateWriter (row,'4-Age','1860',the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call BPlaceWriter function
BPlaceWriter(row,'10-POB',the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call CensusYearWriter function
CensusYearWriter(the_file, '1860')
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call OccupationWriter function
if config_dict["Occupation"] == 1:
OccupationWriter(row, config_dict["occupTag"], '7-Occupation', the_file, '1860', idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call RaceWriter function
if config_dict["Race"] == 1:
RaceWriter(row,'6-Color', config_dict["raceTag"], the_file, '1860', idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call LiteracyWriter1860 function
if config_dict["Literacy"] == 1:
Literacy_Writer_1860 (row, '13-cannot-R&W', '4-Age', config_dict["literTag"], the_file, '1860', idn )
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call Disabled Writer 1870 function
if config_dict["Disability"] == 1:
Disabled_Writer_1870(row, '14-Deaf', config_dict["disiTag"], the_file, idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#call property writer 1860 function
if config_dict["Property"] == 1:
Property_Writer_1860(row, '8-Real-Estate', '9-Personal-Estate', config_dict["propTag"],the_file , '1860', idn)
try:
SourceWriter1870(row, the_file, source_dict, '1-Dwelling-house', '2-Family','3-name', 'M653')
except:
pass
#write the source
MainSourceWriter1900(row, the_file, source_dict, '1860')
#call endfile function
EndFile(the_file,g,idn)