-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcensus1850.py
85 lines (77 loc) · 3.79 KB
/
census1850.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
#imports
import csv
from func_defs import *
def writeName1850 (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, 'Name', the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#Call SexWriter Function
SexWriter(row,'Sex',the_file,idn)
#Call YBdateWriter function
YBdateWriter (row,'Age','1850',the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call BPlaceWriter function
BPlaceWriter(row,'POB',the_file,idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call CensusYearWriter function
CensusYearWriter(the_file, '1850')
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call OccupationWriter function
if config_dict["Occupation"] == 1:
OccupationWriter(row, config_dict["occupTag"], 'Occupation', the_file, '1850', idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call RaceWriter function
if config_dict["Race"] == 1:
RaceWriter(row,'Color', config_dict["raceTag"], the_file, '1850', idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call LiteracyWriter1860 function
if config_dict["Literacy"] == 1:
Literacy_Writer_1860 (row, 'Read-Write', 'Age', config_dict["literTag"], the_file, '1850', idn )
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call Disabled Writer 1870 function
if config_dict["Disability"] == 1:
Disabled_Writer_1870(row, 'Deaf-Dumb-Blind-Etc.',config_dict["disiTag"], the_file, idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#call Property writer 1850 function
if config_dict["Property"] == 1:
Property_Writer_1850(row, 'Real-Estate', the_file, config_dict["propTag"], '1850', idn)
try:
SourceWriter1870(row, the_file, source_dict, 'Dwelling-House', 'Family','Name', 'M432')
except:
pass
#write the source
MainSourceWriter1900(row, the_file, source_dict, '1850')
#call endfile function
EndFile(the_file,g,idn)