<commit_before>/*
 * @progname       cron.ll
 * @version        1.0
 * @author         <NAME>
 * @category       
 * @output         HTML
 * @description    

Generate calendar of birth, death, marriage events arranged by the year, month 
and day that they occured.  Generates a top level index by year, with actual
events stored in a separate html file for each decade.
Warning, this report requires lifelines version 3.0.27 or later.

         by <NAME> (<EMAIL>)
         Version 1,  March 2003  

This program was inspired by similar efforts by <NAME> (<EMAIL>)
but without ever seeing the code he used to do a similar thing.

Before using, there are a few variables that need to be customized for your
own environment.  The changes need to be made in set_static_html_globals() 
below. Note: name and email address are obtained with getproperty() so add
them to your .linesrc (or for windows lines.cfg) file.

By default, program tries to write data files in the directory 
./html/<name of database> -- you must create this directory before running
the program.
*/

/* customization globals - modify values in set_static_html_globals below */
char_encoding("ASCII")
options(explicitvars)
global(base_filename)	/* where to store the results */
global(background)	/* path of background image relative to final html
			 * location, or "" */
global(hi_bg_color)	/* highlighted year background color */
global(lo_bg_color)	/* non-highlighted year background color */
global(db_owner)
global(owner_email)
global(events)
global(dates)
global(month_name)

proc set_static_html_globals() {
    /* customize these globals to customize the output to your taste */
    set(background,"../images/crink2.jpg")  /* set to "" if you have none */
    set(hi_bg_color,"\"#ddb99f\"")
    set(lo_bg_color,"\"#e5d3c5\"")
    set(base_filename, concat("./html/",database(),"/"))  

    /* other globals*/
    set(db_owner, getproperty("user.fullname"))
    set(owner_email, concat("mailto:",getproperty("user.email")))
    list(month_name)
    enqueue(month_name,"January")
    enqueue(month_name,"February")
    enqueue(month_name,"March")
    enqueue(month_name,"April")
    enqueue(month_name,"May")
    enqueue(month_name,"June")
    enqueue(month_name,"July")
    enqueue(month_name,"August")
    enqueue(month_name,"September")
    enqueue(month_name,"October")
    enqueue(month_name,"November")
    enqueue(month_name,"December")
}

/* end of customization globals - customize values assigned in main */

proc main ()
{
    call set_static_html_globals()
    getindi(person,"Enter person to find descendants of (return for all)")
    indiset(thisgen)
    indiset(allgen)
    list(events)
    list(dates)
    /* if a person is entered, the generated list of people include
     * person and spouse, and all the children of either
     * and then recursively the people, their spouses and all the children
     * thereof
    */
    if (person) {
	addtoset(thisgen, person, 0)
	addtoset(allgen, person, 0)
	print("Computing descendents ")
	set(thisgensize,1)
	set(gen,neg(1))
	while(thisgensize) {
	    set(gen,add(gen,1))
	    print(d(gen)," ")
	    indiset(spouse)
	    set(spouse,spouseset(thisgen))
	    set(thisgen,childset(union(thisgen,spouse)))
	    set(allgen,union(allgen,spouse))
	    set(allgen,union(allgen,thisgen))
	    set(thisgensize,lengthset(thisgen))
	}
	print (nl(), "Total of ",d(lengthset(allgen))," individuals",nl())
	forindiset(allgen,indi,val,i) {
	    if (not(mod(i,100))) {
	        print(".")
	    }
	    call add_indi(indi)
	}
    } else {
	print("Traversing all individuals ")
        forindi (indi, val) {
	    if (not(mod(val,100))) {
	        print(".")
	    }
	    call add_indi(indi)
	    set(max,val)
	}
	print (nl(), "Total of ",d(max)," individuals",nl())
    }
    print( d(length(dates))," events generated",nl())
    
    print("sorting data")
    sort(events,dates)
    
    /* Now print out all the data for each year
     */
    print(nl())

    list(yearmask)
    set(lastyear,-1)
    set(lastmonth,-1)
    set(lastdecade,-1)
    set(in_year,0)
    print( d(length(dates))," events",nl()) 
    while(length(dates)) {
        set(val,pop(dates))
	set(event,pop(events))
	set(year,div(val,10000))
	set(mon, mod(val,10000))
	set(day, mod(mon,100))
	set(mon, div(mon,100))
	set(decade, div(year,10))
	/* print(d(mon),"/",d(day),"/",d(year)," ", event, nl())  debug */<commit_msg>fix sort order<commit_after>/*
 * @progname       cron.ll
 * @version        1.0
 * @author         <NAME>
 * @category       
 * @output         HTML
 * @description    

Generate calendar of birth, death, marriage events arranged by the year, month 
and day that they occured.  Generates a top level index by year, with actual
events stored in a separate html file for each decade.
Warning, this report requires lifelines version 3.0.27 or later.

         by <NAME> (<EMAIL>)
         Version 1,  March 2003  

This program was inspired by similar efforts by <NAME> (<EMAIL>)
but without ever seeing the code he used to do a similar thing.

Before using, there are a few variables that need to be customized for your
own environment.  The changes need to be made in set_static_html_globals() 
below. Note: name and email address are obtained with getproperty() so add
them to your .linesrc (or for windows lines.cfg) file.

By default, program tries to write data files in the directory 
./html/<name of database> -- you must create this directory before running
the program.
*/

/* customization globals - modify values in set_static_html_globals below */
char_encoding("ASCII")
options(explicitvars)
global(base_filename)	/* where to store the results */
global(background)	/* path of background image relative to final html
			 * location, or "" */
global(hi_bg_color)	/* highlighted year background color */
global(lo_bg_color)	/* non-highlighted year background color */
global(db_owner)
global(owner_email)
global(events)
global(dates)
global(month_name)

proc set_static_html_globals() {
    /* customize these globals to customize the output to your taste */
    set(background,"../images/crink2.jpg")  /* set to "" if you have none */
    set(hi_bg_color,"\"#ddb99f\"")
    set(lo_bg_color,"\"#e5d3c5\"")
    set(base_filename, concat("./html/",database(),"/"))  

    /* other globals*/
    set(db_owner, getproperty("user.fullname"))
    set(owner_email, concat("mailto:",getproperty("user.email")))
    list(month_name)
    enqueue(month_name,"January")
    enqueue(month_name,"February")
    enqueue(month_name,"March")
    enqueue(month_name,"April")
    enqueue(month_name,"May")
    enqueue(month_name,"June")
    enqueue(month_name,"July")
    enqueue(month_name,"August")
    enqueue(month_name,"September")
    enqueue(month_name,"October")
    enqueue(month_name,"November")
    enqueue(month_name,"December")
}

/* end of customization globals - customize values assigned in main */

proc main ()
{
    call set_static_html_globals()
    getindi(person,"Enter person to find descendants of (return for all)")
    indiset(thisgen)
    indiset(allgen)
    list(events)
    list(dates)
    /* if a person is entered, the generated list of people include
     * person and spouse, and all the children of either
     * and then recursively the people, their spouses and all the children
     * thereof
    */
    if (person) {
	addtoset(thisgen, person, 0)
	addtoset(allgen, person, 0)
	print("Computing descendents ")
	set(thisgensize,1)
	set(gen,neg(1))
	while(thisgensize) {
	    set(gen,add(gen,1))
	    print(d(gen)," ")
	    indiset(spouse)
	    set(spouse,spouseset(thisgen))
	    set(thisgen,childset(union(thisgen,spouse)))
	    set(allgen,union(allgen,spouse))
	    set(allgen,union(allgen,thisgen))
	    set(thisgensize,lengthset(thisgen))
	}
	print (nl(), "Total of ",d(lengthset(allgen))," individuals",nl())
	forindiset(allgen,indi,val,i) {
	    if (not(mod(i,100))) {
	        print(".")
	    }
	    call add_indi(indi)
	}
    } else {
	print("Traversing all individuals ")
        forindi (indi, val) {
	    if (not(mod(val,100))) {
	        print(".")
	    }
	    call add_indi(indi)
	    set(max,val)
	}
	print (nl(), "Total of ",d(max)," individuals",nl())
    }
    print( d(length(dates))," events generated",nl())
    
    print("sorting data")
    rsort(events,dates)
    
    /* Now print out all the data for each year
     */
    print(nl())

    list(yearmask)
    set(lastyear,-1)
    set(lastmonth,-1)
    set(lastdecade,-1)
    set(in_year,0)
    print( d(length(dates))," events",nl()) 
    while(length(dates)) {
        set(val,pop(dates))
	set(event,pop(events))
	set(year,div(val,10000))
	set(mon, mod(val,10000))
	set(day, mod(mon,100))
	set(mon, div(mon,100))
	set(decade, div(year,10))
	/* print(d(mon),"/",d(day),"/",d(year)," ", event, nl())  debug */
{'fraction_non_alphanumeric': 0.13446712018140589, 'fraction_numerical': 0.011337868480725623, 'mean_word_length': 3.654881266490765, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4069421', 'n_tokens_mistral': 3024, 'n_tokens_neox': 2863, 'n_words': 778}