Skip to content

About

Just fun weekend side project just to explore rails and care, I will make this a DPG one day

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

CARE Medicine Reminder

A Rails 8.1 app that turns a CARE medication request prescription into clock-time reminders, then notifies the patient when a dose is due.

This is the first increment: import CARE JSON → create reminders → web push. Later increments can add native Android/iOS push (Rails 8.1 Action Push Native), alarms, phone calls, SMS, WhatsApp, and an in-person visit — those channels will reuse the same schedules.

Planning, CARE mapping research, and design decisions for this increment are in docs/design.md. Rails concepts, product thinking, and decision-making notes for Yaswanth are in docs/learnings-for-yaswanth.md.

What v1 does

  1. Upload or paste a CARE prescription retrieve payload (the JSON with a medications array).
  2. Read each medication’s FHIR dosage_instruction, including CARE M-A-N patterns such as 1-1-1, 1-0-1, and 1-0-0.
  3. Create reminder slots for morning / noon / evening / night (defaults 9:00, 13:00, 18:00, 21:00, Asia/Kolkata). Times are editable per patient and per medicine.
  4. Generate dose occurrences for the prescribed window. If that window has already ended, the importer starts the same duration from today.
  5. Send web push (PWA service worker) when a dose is due. Native iOS/Android is stubbed for the next increment.

CARE mapping

Imported from CARE backend MedicationRequest / MedicationRequestPrescription and the frontend helpers in care_fe/src/types/emr/medicationRequest/medicationRequest.ts:

CARE frequency Reminder slots
1-0-0 / AM Morning
0-1-0 / NOON Noon
0-0-1 / PM / BED / HS Night
1-0-1 / BID Morning + night
1-1-0 Morning + noon
0-1-1 Noon + night
1-1-1 / TID / AC / PC Morning + noon + night
1-1-1-1 / QID Morning + noon + evening + night
1/2-0-1 (and other custom M-A-N) Non-zero slots only; slot value × dose quantity
SOS / as_needed_boolean No clock times
Q1H–Q12H Interval from the morning time
STAT One reminder immediately

Duration uses the same rules as CARE’s getMedicationActiveWindow: bounds_duration / bounds_range / bounds_period, anchored at authored_on.

Setup

Ruby 3.3.4, PostgreSQL, and Bundler:

bundle install
bin/rails db:prepare
bin/dev

Open http://localhost:3000, go to Import, and paste a CARE prescription JSON (see test/fixtures/files/care_prescription.json).

Enable notifications under Settings (HTTPS or localhost). Due reminders are sent automatically every minute while bin/dev (or bin/rails s) is running. To send immediately:

bin/rails reminders:dispatch

In production, Solid Queue runs DispatchDueRemindersJob every minute (config/recurring.yml). Local development uses the same schedule, with the Solid Queue supervisor started inside Puma.

Optional environment variables: DB_HOST, DB_USERNAME, DB_PASSWORD, VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY, VAPID_SUBJECT. Development generates VAPID keys into tmp/vapid.yml.

Roadmap (not in this increment)

  • Native Android + iOS push via Action Push Native
  • Alarm / clock reminder
  • Phone call, SMS, WhatsApp
  • A person or robot visiting at dose time

About

Just fun weekend side project just to explore rails and care, I will make this a DPG one day

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages