# Elderly Support

Phase 3 adds the [follow-up monitoring checklist and management flow](PHASE_3.md), linked to registrations with the same offline password and parent-first synchronization. Use **Follow-up** and **Manage Follow-up**, or **Follow up** / **Visits** from Manage Registration.

Phase 2 implements registration, registration management, dedicated backend storage/access, encrypted offline entry and synchronization, and a separate PWA for `elderly.mam-app.org`.

Deployed to [elderly.mam-app.org](https://elderly.mam-app.org) on 16 October 2026. Use the familiar MAM [login page](https://elderly.mam-app.org/login) with the existing `ElderlyEntry@MAM` account (user type 21). The three Elderly registration/sync tables are migrated on `MAM_NAP`; unrelated migrations were not run.

Read the [phase 2 implementation guide](PHASE_2.md), [deployment record](DEPLOYMENT.md), and [registration image comparison](SOURCE_COMPARISON.md) for behavior, verification, backups and remaining scope. Automated write tests use a disposable local database and synthetic records; live smoke checks are read-only.

Phase 1 completed on 16 October 2026 and remains below as the source-review snapshot.

This folder uses the requested spelling and case, `Elderly_support`. Future Laravel view references must use `Elderly_support.*` on this Linux deployment.

## Read the phase 1 package

| File | Contents |
| --- | --- |
| [Source review](phase-1/SOURCE_REVIEW.md) | Workbook and photo inventory, registration/follow-up mapping, differences and monthly-report definitions |
| [Field dictionary](phase-1/FIELD_DICTIONARY.md) | All 49 registration and 35 follow-up source columns, exact Burmese labels, proposed keys/types, choices, conditions and paper additions |
| [Workflow and sync plan](phase-1/WORKFLOW_AND_SYNC.md) | Proposed screens, field flow, offline queue, upload/download, conflict and deletion handling |
| [Database and subdomain plan](phase-1/DATABASE_AND_SUBDOMAIN.md) | Proposed tables, relationships, routes, authentication, module isolation and implementation sequence |
| [Decisions and acceptance](phase-1/DECISIONS_AND_ACCEPTANCE.md) | Questions the sources cannot answer, recommendations and checks for the later working version |
| [Dictionary JSON](phase-1/field-dictionary.json) | Machine-readable field proposals with exact source cells and option provenance |
| [Source inventory JSON](phase-1/source-inventory.json) | Source checksums, worksheet structures, validations, lookup values and report formulas |

## Confirmed scope

- Build inside this existing `artcare` Laravel project, taking design and workflow ideas from `resources/views/child_support`.
- The intended application is a PWA on its own subdomain. The hostname was confirmed during phase 2 as `elderly.mam-app.org`.
- Images 1–3 are the registration form. Images 4–5 are the follow-up form, as confirmed by the user.
- The workbook adds data columns and a monthly report. No separate Elderly Support release form was supplied.
- At the end of phase 1, only planning artifacts existed. Phase 2 adds the working registration module described in the implementation guide; follow-up and monthly reporting remain later work.

## Implementation stages

1. Establish the agreed field decisions, module configuration, domain/login entry and database schema.
2. Build registration and register management using the existing card, section, queue and table patterns.
3. Build linked follow-up and follow-up management, with parent UUIDs that also work offline.
4. Complete independent PWA installation, encrypted local storage, synchronization, exports and monthly reporting, then run the acceptance scenarios.

Phase 2 delivers the foundation, registration/management and registration PWA/sync portions. Phase 3 adds follow-up/management and shared sync; monthly reports and source-compatible Excel exports remain later work.

The confirmed program ID format is `HTY-26-00001`: clinic selection (`HTY`, `SPT`, `SDG`, `TL`), year `26`, and a manually entered five-digit serial. Leading zeros are preserved and duplicate combined IDs are rejected.

## Reproduce the metadata

From the project root, with Python, `openpyxl` and Pillow available:

```bash
python3 scripts/elderly-support/build-phase-one.py
```

The script reads source definitions and image metadata, never photographed handwriting or patient data rows. It rewrites only `FIELD_DICTIONARY.md`, `field-dictionary.json` and `source-inventory.json` within `phase-1`. Field interpretations are declared in the script and should be revised when decisions change. It never edits the original workbook or images. A changed column count stops generation so the mapping can be reviewed.
