Refactor patient reporting functions

Description

There are currently jxpath functions for patients under the following namespaces:

  • party:

  • reminder:

  • history:

There is no naming or behaviour convention. E.g.,:

  • some of the party functions return formatted strings, and some don't.

  • Some functions return null if a string is empty, others return an empty string

  • some functions will accept an act to determine the patient to use, and use the act start time to filter time-based records. Others ignore the time.

E.g.

  • party:getWeight() returns the numeric weight, which is required for calculations, whereas the party:getPatientWeight() returns a string.

  • party:getMicrochip() returns an entityIdentity.microchip whereas party:getPatientMicrochip() returns a string.

To improve this, a new set of functions are required that provide a consistent API:

  • implicit support for acts won't be provided. Where a date is required, this must be supplied as an argument

  • the approach of using openvpms:get(., 'patient.entity') will be simplified with a patient:get(act) function

  • functions will return null if there is no object

  • formatting support won't be provided except in the case of patient ages; formatting can be done via the existing expr:, list: and openvpms: functions

The existing functions will be retained for backwards compatibility.

Initial functions will be:

  • patient:age(patient) - replaces party:getPatientAge()

  • patient:age(patient, date) - patient age as at date

  • patient:appointments(patient) - replace party:getAppointments()

  • patient:get(object) - use in place of openvpms:get(., 'patient.entity')

  • patient:location(patient) - replaces party:getPatientLocation()

  • patient:owner(patient) - replaces party:getPatientOwner()

  • patient:owner(patient, date) - patient owner as at date

  • patient:referral(patient) - replaces party:getPatientReferralVet()

  • patient:referral(patient, boolean) - replaces party:getPatientReferralVetPractice()

  • patient:referral(patient, boolean, date) - patient referral as at date

  • patient:microchip(patient) - replaces party:getMicrochip()

  • patient:microchips(patient) - a list of entityIdentity.microchip

  • patient:tag(patient) - returns entityIdentity.petTag()

  • patient:rabiesTag(patient) - returns entityIdentity.rabiesTag

  • patient:weight(patient) - replaces party:getWeight()

  • patient:weight(patient, units) - replaces party:getWeight()

  • patient:visit(patient) - returns the most recent visit for a patient

  • patient:reminders(patient, date) - all reminders after date

  • patient:reminders(patient, from, to) - all reminders between two dates

  • patient:reminders(patient, productType, from, to) - all reminders between two dates for a product type

  • patient:charges(patient, date) - all invoice items for a patient after date

  • patient:charges(patient, from, to) - all invoice items for a patient between the specified dates

  • patient:charges(patient, productType) - all invoice items for a patient for a particular product type

  • patient:charges(patient, productType, date) - all invoice items for a patient for a particular product type after date

  • patient:charges(patient, productType, from, to - all invoice items for a patient for a particular product type between two dates

  • patient:medication(patient) - all medication for a patient

  • patient:medication(patient, date) - all medication for a patient from date

  • patient:medication(patient, from, to) - all medication for a patient between two dates

  • patient:medication(patient, productType, from, to) - all medication for a patient between two dates

 

Environment

None

Status

Assignee

Tim Anderson

Reporter

Tim Anderson

Labels

None

Components

Fix versions

Priority

Minor
Configure