PillRegimen

public class PillRegimen

The domain object representing a pill regimen. This is the top level entity in this module.

Constructors

PillRegimen

public PillRegimen()

Constructs a pill regimen without setting any fields.

PillRegimen

public PillRegimen(String externalId, Set<Dosage> dosages, DailyScheduleDetails scheduleDetails)

Constructs a pill regimen.

Parameters:
  • externalId – the external ID tied to this pill regimen, used for tying patients with the regimen.
  • dosages – medicine dosages belonging to this pill regimen
  • scheduleDetails – the schedule details for this pill regimen

Methods

getDosage

public Dosage getDosage(Long dosageId)

Retrieves the dosage with given ID belonging to this regimen.

Parameters:
  • dosageId – the id of the dosage to retrieve
Returns:

the matching dosage, or null if this regimen does not have a dosage with such an ID

getDosages

public Set<Dosage> getDosages()

Gets medicine dosages belonging to this pill regimen. Each dosage can have multiple medicines.

Returns:medicine dosages belonging to this pill regimen

getExternalId

public String getExternalId()
Returns:the external ID tied to this pill regimen, used for tying patients with the regimen

getId

public Long getId()
Returns:the unique identifier of the pill regimen

getScheduleDetails

public DailyScheduleDetails getScheduleDetails()
Returns:the schedule details for this pill regimen

isFirstReminderFor

public boolean isFirstReminderFor(Dosage dosage)

Checks if there were no reminders yet set for the given dosage.

Parameters:
  • dosage – the dosage to check
Returns:

true if no reminder was yet set for this dosage, false otherwise

numberOfTimesPillRemindersSentFor

public int numberOfTimesPillRemindersSentFor(Dosage dosage)

Returns the number of times a pill reminder was set for the given dosage. This is done using only a calculation based on the schedule for this regimen and the details from the dosage.

Parameters:
  • dosage – the dosage to check
Returns:

the number of time a pill reminder was sent for the dosage

setDosages

public void setDosages(Set<Dosage> dosages)

Sets medicine dosages belonging to this pill regimen. Each dosage can have multiple medicines.

Parameters:
  • dosages – medicine dosages belonging to this pill regimen

setExternalId

public void setExternalId(String externalId)
Parameters:
  • externalId – the external ID tied to this pill regimen, used for tying patients with the regimen

setId

public void setId(Long id)
Parameters:
  • id – the unique identifier of the pill regimen

setScheduleDetails

public void setScheduleDetails(DailyScheduleDetails scheduleDetails)
Parameters:
  • scheduleDetails – the schedule details for this pill regimen

timesPillRemainderWillBeSent

public int timesPillRemainderWillBeSent()

Calculates the total number of times the pill reminder for this regimen will be sent, in case the patient does not provide an adherence response.

Returns:the maximum number of reminders that will be sent for this regimen

validate

public void validate()

Validates the dosages for this regimen. Will call Dosage.validate() on every medicine dosage in this regimen.

Throws: