[Babase] New SEXSKINS rules
Karl O. Pinc
kop at meme.com
Thu Jan 25 15:34:32 EST 2007
Hi Tabby,
I've changed the SEXSKINS rules so that you can have
sexskin measurements associated with a female's
first cycle -- we now recognise that the first cycle
does not have a Mdate.
Note that there are some sexskin related errors that
are not checked for as the database is updated.
For instance, the "static" error checks include
the statement below and it finds 607 sexskins
errors.
We don't need to worry about these errors as far
as the conversion is concerned, and for that matter
they'll probably go away anyway as gaps get corrected
and we make sure that all cycles really do have a
Mdate, a Tdate, and a Ddate, but I figured it's
worth mentioning.
Anyhow, I think I'm ready to run another conversion when
you are.
SELECT cycles.sname, sexskins.date, sexskins.size
, 'Error: Cannot have SEXSKINS in a cycle with no Mdate unless
the cycle resumes a pregnancy or is at menarche or there is a gap
(CYCGAPS)'
FROM cycles, sexskins
WHERE cycles.cid = sexskins.cid
AND NOT EXISTS (SELECT 1 -- no Mdate
FROM cycpoints
WHERE cycpoints.cid = sexskins.cid
AND cycpoints.code = 'M'
LIMIT 1)
AND NOT EXISTS (SELECT 1 -- not a resumption of pregnancy
FROM pregs
WHERE pregs.resume = sexskins.cid
LIMIT 1)
AND NOT EXISTS (SELECT 1 -- not first cycle
FROM cycpoints, maturedates
WHERE cycpoints.cid = sexskins.cid
AND cycpoints.code = 'T'
AND maturedates.sname = cycles.sname
AND maturedates.matured =
cycpoints.date
AND maturedates.mstatus = 'O'
LIMIT 1)
AND NOT EXISTS (SELECT 1 -- there is no gap
FROM cycpoints as cp
, cycles as cy
, cycpoints as thiscp
WHERE cy.sname = cycles.sname
AND cp.cid = cy.cid
AND thiscp.cid = sexskins.cid
AND cp.date < thiscp.date
AND cp.cid != sexskins.cid
AND cp.date > (SELECT cycgapdays.date
FROM cycgapdays
WHERE cycgapdays.sname =
cycles.sname
AND cycgapdays.date <
thiscp.date
ORDER BY cycgapdays.date DESC
LIMIT 1))
ORDER BY cycles.sname, sexskins.date;
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