Adding new genders for "spayed" veterinary med patients - it worked?

Maria Scappini <[email protected]> Fri, 28 Mar 2025 18:32:22 -0300
Newsgroups gmane.comp.gnu.medical.devel
Message-ID <[email protected]>
Hello!

In vet medicine, most of my patients are (thankfully) spayed. I wanted 
to register this, and thought maybe adding to the db new genders "female 
spayed" and "male spayed" would be the best approach:
- would let me sort and distinguish my patients by their spayed-or-not 
status
- would make it very straightforward for any not-me-user to use this
- would maybe let me get statistics of patients' neutering state and 
even linked pathologies in the future?

This topic was already (briefly) discussed here back in 2009, from what 
I could find through googling:
https://lists.gnu.org/archive/html/gnumed-devel/2009-11/msg00019.html

And indeed, 15+ years later, here I am actually trying to modify the 
database with some low-level effort to include spayed/neutered 
patients!! :)  I really, really love the internet and all things 
opensource. This is simply awesome

So, playing around with my for-testing-and-breaking-database, I googled, 
asked some LLMs, re-asked, checked that instructions were valid with my 
(still very basic) knowledge of sql databases, checked that I would not 
hopefully really break in a very big way my database, and executed the 
steps below.

It seems I didn't break anything and it works?

These were the steps:

1. Identified dem.gender_label table as the one containing the genders 
available
2. In postgresql, as gm-dbo:

         BEGIN TRANSACTION READ WRITE;

         ALTER TABLE dem.gender_label DROP CONSTRAINT 
gender_label_tag_check;

         ALTER TABLE dem.gender_label ADD CONSTRAINT gender_label_tag_check
         CHECK (tag = ANY (ARRAY[
            'm', 'f', 'h', 'tm', 'tf', 'fs', 'ms'
         ]));

         INSERT INTO dem.gender_label (row_version, tag, label, 
sort_weight, comment)
         VALUES (0, 'fs', 'female spayed', 2, 'fs - (f)emale (s)payed'),
         (0, 'ms', 'male spayed',   2, 'ms - (m)ale (s)payed');

... and when asking for...

         SELECT * FROM dem.gender_label;

... returned the updated table no problem:

         COMMIT;

After, from the GUI, "female spayed" and "male spayed" appeared as 
gender options!! :,)

Apart from sharing how to do this in case anyone else is interested, I 
just wanted to ask for confirmation: is what I did correct? Would this 
potentially break other unknown-to-me database operations/tables?

Thanks,

MJ