Debian Codegraph @

reports/ssdi_aid.ll

raw
1 /*
2 * @progname ssdi_aid.ll
3 * @version 3
4 * @author Jim Eggert ([email protected])
5 * @category
6 * @output Text
7 * @description
8
9 This LifeLines report program generates a text file that lists
10 people who are likely to be in the Social Security Death Index.
11 The SSDI starts in 1962 and is periodically updated to include
12 more recent years. This program guesses birth and death years
13 to make its determinations. If it finds a person likely to be
14 in the SSDI, it searches for the string SSDI in their notes to
15 indicate that an SSDI entry has already been found. If not, it
16 outputs a line about that person.
17
18 The output persons are in database order. Women are output in
19 with their last married name. To alphabetize the names in the text
20 report, you can use Unix sort:
21
22 sort -b +1 ss.out > ss.sort
23
24 The program optionally generates HTML output with buttons to search
25 the Rootsweb online SSDI database.
26
27 ssdi_aid - a LifeLines program to aid in the use of the U.S. Social
28 Security Death Index
29 by Jim Eggert ([email protected])
30 Version 1, 28 June 1995
31 Version 2, 22 November 1996
32 Version 3, 11 January 2005 (changed to Rootsweb site)
33
34 */
35
36 global(byear_delta)
37 global(byear_est)
38 global(byear_est_delta)
39
40 global(mother_age)
41 global(father_age)
42 global(years_between_kids)
43 global(oldage)
44
45 proc main() {
46 indiset(pset)
47
48 set(mother_age,23) /* assumed age of first motherhood */
49 set(father_age,25) /* assumed age of first fatherhood */
50 set(years_between_kids,2) /* assumed years between children */
51 set(oldage,90) /* normal maximum death age */
52 set(byearstart,1850) /* no one born before then can be in the SSDI */
53
54 set(unknownname,"<") /* for women, any spouse whose surname contains this
55 is considered to have an unknown surname */
56
57 getindi(person)
58 while(person) {
59 addtoset(pset,person,1)
60 getindi(person)
61 }
62
63 getintmsg(minage,"Enter minimum age for listing:")
64
65 getintmsg(html,"Enter 0 for text, 1 for html output:")
66
67 if (html) {
68 getintmsg(includebyears,"Enter 1 to include birth years in database query")
69 "<HTML>\n"
70 "<HEAD>\n"
71 "<TITLE> SSDI Aid Report </TITLE>\n"
72 "</HEAD>\n"
73 "<BODY>\n"
74 "Press a button to query Rootsweb's online SSDI database
75 for that individual."
76 "<HR>\n"
77 }
78
79 set(namewidth,50) /* change this value as needed */
80 "key" col(8) "@LAST, First Middle [MAIDEN]"
81 set(bcol,add(8,namewidth))
82 col(bcol) "Birthdate"
83 set(dcol,add(25,namewidth))
84 col(dcol) "Death\n"
85
86 print("Finding descendants")
87 set(pset,union(pset,spouseset(pset)))
88 set(pset,union(pset,descendantset(pset)))
89 print("' spouses")
90 set(pset,union(pset,spouseset(pset)))
91 print("' descendants")
92 set(pset,union(pset,descendantset(pset)))
93 print("... done.\n")
94
95 set(thisyear,atoi(year(gettoday())))
96 set(byearend,sub(thisyear,minage))
97
98 print("Traversing individuals...")
99 forindiset(pset,person,pval,pnum) {
100 set(star,1)
101 fornotes(inode(person),note) {
102 if (index(note,"SSDI:",1)) { set(star,0) }
103 }
104 if (star) {
105 set(byear,0)
106 set(bdate,"")
107 if (b,birth(person)) {
108 extractdate(b,bday,bmonth,byear)
109 set(bdate,date(b))
110 }
111 if (not(byear)) {
112 if (b,baptism(person)) {
113 set(bdate,date(b))
114 }
115 }
116 call estimate_byear(person)
117 /* set(byear,sub(byear_est,byear_est_delta)) */
118 if(and(byear_est,not(strlen(bdate)))) {
119 set(bdate,save(concat("c ",d(byear_est))))
120 }
121
122 set(dyear,0)
123 if (d,death(person)) {
124 extractdate(d,dday,dmonth,dyear)
125 }
126 if (not(dyear)) {
127 if(d,burial(person)) {
128 extractdate(d,dday,dmonth,dyear)
129 }
130 }
131 if (dyear) {
132 if (or(index(date(d),"ABT",1),eq(dmonth,0))) { set(dyear,add(dyear,5)) }
133 if (index(date(d),"AFT",1)) {
134 set(oldyear,add(byear,oldage))
135 if (gt(oldyear,dyear)) { set(dyear,oldyear) }
136 }
137 }
138
139 if (or(ge(dyear,1940),
140 and(not(dyear),le(byear,byearend),ge(byear,byearstart)))) {
141 set(nfam,nfamilies(person))
142 set(myname,fullname(person,1,0,namewidth))
143 set(mysurname,surname(person))
144 if (and(female(person),ne(nfam,0))) {
145 set(maidenname,save(concat(", ",fullname(person,1,1,100))))
146 families(person,fam,spouse,famnum) {
147 if (spousesurname,surname(spouse)) {
148 if (strlen(spousesurname)) {
149 if (not(index(spousesurname,unknownname,1))) {
150 set(mysurname,spousesurname)
151 set(myname,
152 trim(concat(upper(spousesurname),maidenname),namewidth))
153 if (ne(famnum,nfam)) {
154 set(myname,
155 trim(concat("+",myname),namewidth))
156 }
157 }
158 }
159 }
160 }
161 }
162 if (html) {
163 "<form method=post action=" qt()
164 "http://ssdi.rootsweb.com/cgi-bin/ssdi.cgi" qt()
165 "><input type=hidden name=lastname value=" qt()
166 mysurname qt()
167 "><input type=hidden name=firstname value=" qt()
168 list(givennamelist)
169 extracttokens(givens(person),givennamelist,nnames," ")
170 dequeue(givennamelist) qt() ">"
171 if (includebyears) {
172 if (lt(byear_est_delta,2)) {
173 "<input type=hidden name=birth value=" qt()
174 d(byear) qt() ">"
175 }
176 }
177 "<input type=submit name=submit value=" qt() key(person) qt()
178 "><input type=hidden name=nt value=" qt() "exact" qt() ">"
179 } else {
180 key(person) col(8)
181 }
182 myname
183 if (html) {
184 " " bdate " " long(d) "</form>"
185 }
186 else {
187 col(bcol) bdate col(dcol) long(d)
188 }
189 nl()
190 }
191 }
192 }
193 if (html) {
194 "</BODY>\n"
195 "</HTML>\n"
196 }
197 }
198
199 proc estimate_byear(person) {
200 set(byear_est,0)
201 set(byear_est_delta,neg(1))
202 if (byear,get_byear(person)) {
203 set(byear_est,byear)
204 set(byear_est_delta,byear_delta)
205 }
206 else { /* estimate from siblings */
207 set(older,person)
208 set(younger,person)
209 set(yeardiff,0)
210 set(border,0)
211 set(this_uncertainty,1)
212 while (and(not(byear_est),or(older,younger))) {
213 set(older,prevsib(older))
214 set(younger,nextsib(younger))
215 set(yeardiff,add(yeardiff,years_between_kids))
216 set(this_uncertainty,add(this_uncertainty,1))
217 if (older) {
218 set(border,add(border,1))
219 if (byear,get_byear(older)) {
220 set(byear_est,add(byear,yeardiff))
221 set(byear_est_delta,this_uncertainty)
222 }
223 }
224 if (and(not(byear_est),younger)) {
225 if (byear,get_byear(younger)) {
226 set(byear_est,sub(byear,yeardiff))
227 set(byear_est_delta,this_uncertainty)
228 }
229 }
230 }
231 }
232 if (not(byear_est)) { /* estimate from parents' marriage */
233 if (m,marriage(parents(person))) { extractdate(m,bd,bm,my) }
234 if (my) {
235 set(byear_est,add(add(my,mul(years_between_kids,border)),1))
236 set(byear_est_delta,add(border,1))
237 }
238 }
239 if (not(byear_est)) { /* estimate from first marriage */
240 families(person,fam,spouse,fnum) {
241 if (eq(fnum,1)) {
242 if (b,birth(spouse)) { extractdate(b,bd,bm,by) }
243 if (m,marriage(fam)) { extractdate(m,bd,bm,my) }
244 if (by) {
245 if (female(person)) {
246 set(byear_est,add(by,sub(father_age,mother_age)))
247 }
248 else {
249 set(byear_est,sub(by,sub(father_age,mother_age)))
250 }
251 set(byear_est_delta,5)
252 }
253 elsif (my) {
254 if (female(person)) { set(byear_est,sub(my,mother_age)) }
255 else { set(byear_est,sub(my,father_age)) }
256 set(byear_est_delta,5)
257 }
258 else {
259 children(fam,child,cnum) {
260 if (not(byear_est)) {
261 if (byear,get_byear(child)) {
262 if (female(person)) {
263 set(byear_est,sub(sub(byear,
264 mul(sub(cnum,1),years_between_kids)),
265 mother_age))
266 }
267 else {
268 set(byear_est,sub(sub(byear,
269 mul(sub(cnum,1),years_between_kids)),
270 father_age))
271 }
272 set(byear_est_delta,add(5,cnum))
273 }
274 }
275 }
276 }
277 }
278 }
279 }
280 if (not(byear_est)) { /* estimate from parents' birthyear */
281 if (byear,get_byear(mother(person))) {
282 set(byear_est,add(byear,mother_age))
283 }
284 else {
285 if (byear,get_byear(father(person))) {
286 set(byear_est,add(byear,father_age))
287 }
288 }
289 if (byear) {
290 set(byear_est_delta,5)
291 set(older,person)
292 while(older,prevsib(older)) {
293 set(byear_est,add(byear_est,years_between_kids))
294 set(byear_est_delta,add(byear_est_delta,1))
295 }
296 }
297 }
298 }
299
300 func get_byear(person) {
301 set(byear,0)
302 if (person) {
303 if (b,birth(person)) { extractdate(b,day,month,byear) }
304 if (byear) {
305 set(byear_delta,0)
306 set(dstring,trim(date(b),3))
307 if (not(strcmp(dstring,"BEF"))) { set(byear_delta,3) }
308 elsif (not(strcmp(dstring,"AFT"))) { set(byear_delta,3) }
309 elsif (not(strcmp(dstring,"ABT"))) { set(byear_delta,2) }
310 }
311 else {
312 if (b,baptism(person)) { extractdate(b,day,month,byear) }
313 if (byear) {
314 set(byear_delta,1)
315 set(dstring,trim(date(b),3))
316 if (not(strcmp(dstring,"BEF"))) { set(byear_delta,3) }
317 elsif (not(strcmp(dstring,"AFT"))) { set(byear_delta,3) }
318 elsif (not(strcmp(dstring,"ABT"))) { set(byear_delta,2) }
319 }
320 }
321 }
322 return(byear)
323 }