[Babase] Members not pulling in census rows, only interpolation rows

Karl O. Pinc kop at meme.com
Wed May 19 13:15:11 EDT 2010


On 05/19/2010 09:59:27 AM, Niki Learn wrote:

> 
> Remember last week when I said Amok was weird because he was the only
> baboon
> with more than one entry where the interp column = 0?  This is why. 
> Amok's
> census data we just added for when he was Billy (1995-1997) is in
> members
> (each census line gets interp = 0) but his later census data when he
> entered
> a study group is not in members so there are no rows there with 
> origin
> C or
> interp = 0.

> Or does rebuilding it from scratch not pull in the existing
> census
> data (which would be another bug)?

The rebuild_members() function was incorrectly documented.
Rebuild_members actually assumes that the (non-absent) CENSUS 
rows are already in the MEMBERS table and the program re-does all the 
interpolated rows.  From what was written it looked like MEMBERS
could be empty and it would be re-constructed.  (I can write
a function that does that too, but haven't.)

So, what broke things were emptying out MEMBERS and re-building.

I've corrected the documentation and copied all the CENSUS rows
into MEMBERS.  So, things should be fixed now.  I think so
but somebody besides me should also verify this.  Please pay particular
attention to the birthdate and statdate.

FYI, here is the code used to fix things:

begin;
delete from members where origin != 'I';
insert into members (sname, date, grp, origin, interp)
  select census.sname, census.date, census.grp, census.status, 0
    from census
    where census.status != 'A';
commit;


Karl <kop at meme.com>
Free Software:  "You don't pay back, you pay forward."
                 -- Robert A. Heinlein




More information about the Babase mailing list