biometrics_tracker.main.core module

class biometrics_tracker.main.core.CoreLogic(config_info: ConfigInfo, queue_mgr: Queues)

Bases: object

This class is intended to be subclassed by classes that will add and/or update Datapoints

check_completion_queue()

Check the completion queue, invoke the Callable in the message’s destination property is it or the message object is not None

Returns

None

check_response_queue()

Check the database response queue, invoke the Callable in the message’s destination property is it or the message object is not None

Returns

None

close_db()

Send a database request message to close the database and end the persistence thread

Returns

None

config_info: ConfigInfo
self.config_info.help_url = pathlib.Path(sys.path[-1:][0], ‘biometrics_tracker’, ‘help’,

‘user-doc-index.html’).as_uri()

delete_datapoint(datapoint: biometrics_tracker.model.datapoints.BodyWeightDP | biometrics_tracker.model.datapoints.BodyTemperatureDP | biometrics_tracker.model.datapoints.BloodPressureDP | biometrics_tracker.model.datapoints.BloodGlucoseDP | biometrics_tracker.model.datapoints.PulseDP)

Send a database request message to delete a specified datapoint

Parameters

datapoint (a subclass of biometrics_tracker.model.datapoint.DataPoint) – the data point to be deleted

Returns

None

abstract exit_app(msg: CompletionMsg) None

An abstract method that must be overridden to end the GUI event loop

Parameters

msg – a Completion message, usually a response to a Close Database request

Returns

None

save_datapoint(person: Person, taken: datetime, widget: Union[BloodPressureWidget, PulseWidget, BloodGlucoseWidget, BodyWeightWidget, BodyTempWidget], delete_if_zero: bool, db_operation: DBOperation, key_timestamp: Optional[datetime] = None)

Inserts or updates the database with datapoint property of the provided datapoint widget if the value fields(s) of the widget are non-zero. If the value field(s) are zero and the delete_if_zero parameter is True, the datapoint is deleted from the database

Parameters
  • person (biometrics_tracker.model.datapoints.Person) – the person associated with the datapoint

  • taken (datetime.datetime) – the datetime associated withe datapoint

  • widget (biometrics_tracker.gui.widgets.widget_union) – the widget containing the datapoint

  • delete_if_zero (bool) – if True delete the datapoint if the widget’s value field(s) are zero This allows the user to delete an existing datapoint by changing it’s value field(s) to zero.

  • db_operation (biometrics_tracker.ipc.messages.DBOperation) – controls whether the datapoint database row is inserted or updated

  • key_timestamp (datetime) – for DataPoint updates only: the Taken datetime prior to possible change by user

Returns

None

class biometrics_tracker.main.core.DataPointSelection(parent: CoreLogic, people_list: list[tuple[str, str]], sel_date_rng: bool, sel_dp_type: bool, action: Callable, get_date_range: Callable, get_dp_type_selection: Callable)

Bases: object

A GUI framework agnostic class to act as a container for the selection criteria collected by in inheriting class the implements the selection GUI in a particular GUI framework