Gnumed.business.gmPerson.gmCurrentPatient

Package Gnumed :: Package business :: Module gmPerson :: Class gmCurrentPatient |
[frames] | no frames]

# Class gmCurrentPatient

source code

               object --+
                        |
    pycommon.gmBorg.cBorg --+
                            |
                           gmCurrentPatient

    Patient Borg to hold the currently active patient.

    There may be many instances of this but they all share state.

    The underlying dem.identity row must have .deleted set to FALSE.

    The sequence of events when changing the active patient:

            1) Registered callbacks are run.
                    Those are run synchronously. If a callback
                    returns False or throws an exception the
                    patient switch is aborted. Callback code
                    can rely on the patient still being active
                    and to not go away until it returns. It
                    is not passed any arguments and must return
                    False or True.

            2) Signal "pre_patient_unselection" is sent.
                    This does not wait for nor check results.
                    The keyword pk_identity contains the
                    PK of the person being switched away
                    from.

            3) the current patient is unset (gmNull.cNull)

            4) Signal "current_patient_unset" is sent
                    At this point resetting GUI fields to
                    empty should be done. The active patient
                    is not there anymore.

                    This does not wait for nor check results.

            5) The current patient is set to the new value.
                    The new patient can also remain gmNull.cNull
                    in case the calling code explicitely unset
                    the current patient.

            6) Signal "post_patient_selection" is sent.
                    Code listening to this signal can
                    assume that the new patient is
                    already active.

Instance Methods
__init__(self, patient=None, forced_reload=False) Change or get currently active patient. | source code
register_before_switching_from_patient_callback(self, callback=None) | source code
force_unlock(self) | source code
__getattr__(self, attribute) | source code
__getitem__(self, attribute=None) Return any attribute if known how to retrieve it by proxy. | source code
__setitem__(self, attribute, value) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Static Methods
Inherited from `pycommon.gmBorg.cBorg`: `__new__`

Class Variables
| connected = `property(_get_connected, lambda x: x)`
| locked = `property(_get_locked, _set_locked)`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, patient=None, forced_reload=False) (Constructor) | source code
Change or get currently active patient. patient: * None: get currently active patient * -1: unset currently active patient * cPatient instance: set active patient if possible Overrides: object.__init__