Debian Codegraph @

reports/infant_mortality.ll

raw
1 /*
2 * @progname infant_mortality.ll
3 * @version 1
4 * @author Eggert
5 * @category
6 * @output Text
7 * @description
8
9 This program finds families that have lost multiple children.
10 You give it the threshold for the number of young deaths, and the
11 threshold for the age at death, and it finds all the appropriate
12 families.
13
14 infant_mortality - a LifeLines program
15 by Jim Eggert ([email protected])
16 Version 1, 19 September 1994
17
18 */
19
20
21 global(yob)
22 global(yod)
23
24 proc main() {
25 getintmsg(numthresh,"Enter threshold for number of young deaths")
26 getintmsg(agethresh,"Enter threshold for age at death")
27 forfam(family,fnum) {
28 if (ge(nchildren(family),numthresh)) {
29 set(countdeaths,0)
30 set(maxageatdeath,0)
31 children(family,child,cnum) {
32 call get_dyear(child)
33 if (yod) {
34 call get_byear(child)
35 if (yob) {
36 set(ageatdeath,sub(yod,yob))
37 if (le(ageatdeath,agethresh)) {
38 set(countdeaths,add(countdeaths,1))
39 if (gt(ageatdeath,maxageatdeath)) {
40 set(maxageatdeath,ageatdeath)
41 }
42 }
43 }
44 }
45 }
46 if (ge(countdeaths,numthresh)) {
47 key(family) " "
48 name(husband(family)) " and " name(wife(family))
49 "\nlost " d(countdeaths)
50 " children by the age of " d(maxageatdeath)
51 ".\n"
52 children(family,child,cnum) {
53 call get_byear(child)
54 call get_dyear(child)
55 name(child) " ("
56 if (yob) { d(yob) }
57 "-"
58 if (yod) { d(yod) }
59 ") "
60 if (and(yob,yod)) { d(sub(yod,yob)) }
61 "\n"
62 }
63 "\n"
64 }
65 }
66 }
67 }
68
69 proc get_dyear(person) {
70 set(yod,0)
71 if (d,death(person)) { extractdate(d,dod,mod,yod) }
72 if (not(yod)) {
73 if (d,burial(person)) { extractdate(d,dod,mod,yod) }
74 }
75 }
76
77 proc get_byear(person) {
78 set(yob,0)
79 if (b,birth(person)) { extractdate(b,dob,mob,yob) }
80 if (not(yob)) {
81 if (b,baptism(person)) { extractdate(b,dob,mob,yob) }
82 }
83 }