gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnumed-devel] value objects/clin_root_item classes


From: Karsten Hilbert
Subject: [Gnumed-devel] value objects/clin_root_item classes
Date: Sun, 11 Apr 2004 13:24:01 +0200
User-agent: Mutt/1.3.22.1i

Carlos and all,

I have checked in business/gmClinItem.py and gmVaccination.py.
They contain a base class for clinical items and a vaccination
time derivative thereof.

- clinical items need not correspond to clin_root_item
  descendants 1:1, eg. cVaccination represents v_pat_vacc4ind
  but knows how to store updatable data in the respective base
  tables (eg vaccination)

- most heavy lifting is done generically in cClinItem,
  cVaccination all but defines class level variables
  _cmd_fetch_payload, _cmds_store_payload, _udpatable_fields

- _cmds_store_payload is a *list* of cmds that will be passed
  to run_commit(), self._payload values will be added in a
  parameter dict, hence the SQL cmds need to use the
  %(arg_name)s substitution format, arg_name must be in
  _updatable_fields

For diagnostic dumps __str__ has been added so that
 print cClinItem
works.

Where:
vacc = cVaccination(1)

val = vacc[attribute]
 will yield the attribute value

vacc.get_fields()
 yields a list of attributes

vacc[attribute] = val
 will set the attribute (if possible)

vacc.save_payload()
 will persist the attributes if _is_modified

vacc.refetch_payload()
 will refetch the attributes
 (this can be used to force updates after a DB level notify)

Things like vacc.format_for_ascii_export() need to be added
and lots of cClinItem descendants need to be written.

Is this what people can comfortably work with ?

Anyone keen to write a dev guide snippet based on this mail
plus the comments in the code ?

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346




reply via email to

[Prev in Thread] Current Thread [Next in Thread]