# Elderly Support

New registration IDs are generated automatically from the account clinic area: 71/72/81 → HTY, 73 → SPT, 84 → SDG, 74 → TL. General / clinic ID accepts 10–12 digits and preserves leading zeros. See [automatic IDs](AUTOMATIC_IDS.md).

**Export browser records (Excel)** downloads Register and Fup_Checklist in the source workbook’s column order, with additional paper fields and browser status appended. No report sheet is included. It works offline after the PWA is prepared. See [the export guide](BROWSER_EXPORT.md).

Use **Monthly report** to view and export the source workbook’s 15 indicators by month/year, with All saved or Completed only filters. See [the report guide](MONTHLY_REPORT.md). Sync pending entries before reporting.

All four pages provide **Download data dictionary (Excel)**. The [dictionary guide](DATA_DICTIONARY.md) explains its registration/follow-up fields, codes, conditional rules, offline download and regeneration.

Affirmative/negative answers now use **1 = Yes, 2 = No** in both forms, while the displayed labels remain Burmese/English. See [ANSWER_CODES.md](ANSWER_CODES.md) for existing-record compatibility, conditional fields and exports.

The latest [Burmese source review](SOURCE_COMPARISON.md) adds co-resident relationships and daily activities, corrects caregiver neighbour status, and adds cooking/bathing/laundry choices. Caregiver details now sit together next to the current-caregiver question.

Phase 3 adds the [follow-up monitoring checklist and management flow](PHASE_3.md), linked to registrations with parent-first synchronization. Both forms now open directly after MAM login, with no extra offline password or unlock screen. See [direct entry and offline storage](DIRECT_ENTRY.md). Use **Find registration to edit** in Identity to load the exact full ID from this browser into the registration form. Save draft or Complete & save updates the same registration. Use **Go to follow-up** in the registration Identity card, or open **Follow-up** and enter the exact full program ID in **Select registration**. Selection uses only registrations saved in the current browser account, including unsynced drafts. There is no registration list or source selector. Use **Download** first if the registration is only on the server. **Manage Follow-up** and **Visits** remain available.

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 six Elderly registration/follow-up/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 current program ID format is `EHTY2600001`: E + user-selected area (`HTY`, `SPT`, `SDG`, `TL`) + two-digit year + user-entered serial padded to five digits. It is independent of the account clinic and uses no automatic numbering. Existing IDs stay unchanged and duplicate combined IDs are rejected. See [ID entry](AUTOMATIC_IDS.md).

## 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.

Date entry uses a text field with a calendar chooser. Type DD-MM-YYYY or DD-MM-YY (YY expands to 2000–2099); compact six/eight-digit dates and legacy DD/MM/YYYY are also accepted. Valid entries format as DD-MM-YYYY on leaving the field. Four-digit years preserve the supplied century. Invalid or incomplete dates remain available for correction. Stored/API dates remain YYYY-MM-DD, and the source-based Excel export keeps its existing date format. Changing a date never saves automatically. Follow-up management date filters use the same controls.

Draft saves, completed saves and updates show a dismissible floating response on both forms, visible even at the bottom of a long page. Confirmation appears after the browser write succeeds and distinguishes new records from updates. The response names browser storage and asks for explicit Sync now; server success is shown only after sync completes. Failures show an error response. Editing again removes the prior saved response; the save bar shows a Yangon timestamp.
