{"v":[{"id":2860,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201#issuecomment-2860","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201","user":{"id":3,"login":"connect-bot","login_name":"","source_id":0,"full_name":"","email":"connect-bot@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/68a2723f7ad70dee2e1415be7488d84b","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/connect-bot","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2026-10-01T08:49:35-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"connect-bot"},"original_author":"","original_author_id":0,"body":"**Charles W.** _(via Connect)_\n<!-- connect:user=1 -->\n\nEmail from me to Cassandra and Frank on 10\/20:\r\n\r\nHello,\r\n\r\nThank you for sending the info. In getting the vendor numbers and counties into the system, I've run a report against the current client data to make sure the correct vendor number would be selected.\r\n\r\nThere are two El Paso clients at Legacy Home Care (both active, started Oct 12 2026, on STAR+PLUS, with nothing on the calendar yet). VESTA files them under the El Paso branch but I don't have an El Paso branch for that agency.\r\n\r\nAlso at Legacy Home Care, I show three clients in Victoria County -- one in the Brownsville branch and two in the McAllen branch -- but I don't have a Region 8 number for Legacy Home Care.\r\n\r\nAt Legacy Home Health, I show a client in the San Antonio branch and living in Hays County but I don't have a Region 7 number.\r\n\r\nPlease let me know how those should resolve.\r\n\r\nI also have potential errors in VESTA data.\r\n\r\nLegacy Home Health:\r\n\r\n* A client in the McAllen branch with a McAllen zip code but their record has Travis County.\r\n\r\n* A client in the San Antonio branch with a San Antonio zip code but their record has Smith County.\r\n\r\nCoastal:\r\n\r\n* A client in the Houston branch in Pasadena but their record has San Jacinto County.","assets":[],"created_at":"2026-10-23T13:26:58-05:00","updated_at":"2026-10-23T13:26:58-05:00"},{"id":2861,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201#issuecomment-2861","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201","user":{"id":3,"login":"connect-bot","login_name":"","source_id":0,"full_name":"","email":"connect-bot@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/68a2723f7ad70dee2e1415be7488d84b","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/connect-bot","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2026-10-01T08:49:35-05:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"connect-bot"},"original_author":"","original_author_id":0,"body":"**Charles W.** _(via Connect)_\n<!-- connect:user=1 -->\n\nReply from Cassandra on 10\/22:\r\n\r\nGood morning, Charles,\r\n\r\nFor the two members in McAllen, we recently received the license. I added it to the document I previously submitted to you; it is at the end of the second page. I will also follow up with the scheduling team to confirm who should be entering their visits on the calendar.\r\n\r\nFor the three clients in Victoria, please identify them as Region 11. We are approved to provide services in that area for the MCOs; however, Legacy Home Care Services does not have a TMHP license for that region to provide a different vendor number. This applies only to Legacy Home Care Services.\r\n\r\nI will look into the client in Hays County and get back to you with an update.\r\n\r\nFor the client listed under Travis County, the member profile shows Hidalgo County. @Frank Morales, can you confirm whether the county is being pulled from a source other than the member profile? I am seeing a similar issue with the client listed under Smith County, whose member profile shows Bexar County.\r\n\r\nFor the Coastal client, I updated the county to Harris County because the address falls within Harris County.\r\n\r\nPlease let me know of any discrepancies for my compliance team to address or have the coordination managers address. \r\n\r\nThank you, Cassandra Luna-Garcia","assets":[],"created_at":"2026-10-23T13:27:36-05:00","updated_at":"2026-10-23T13:27:36-05:00"},{"id":2862,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201#issuecomment-2862","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/201","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"**Checked against the 23 Oct data, after Cassandra's reply of 10\/22**\n\n### Done (on dev, not yet committed or on prod)\n- **Victoria is Region 11 for Legacy Home Care Services** (vendor 1019756), as Cassandra asked. This applies to that agency only. There are now **four** Victoria clients, not three; the fourth is a Brownsville-branch client in Bloomington whose address didn't place on the map. All four came off \"County on no vendor list\". Carried in `scripts\/import-vendor-regions.php`. On prod: dry run, then `--apply --overwrite` (only Legacy Home Care should show as changing), or add Victoria on Admin \u2192 Systems \u2192 Vendor Numbers by County.\n- **El Paso is a known branch city** (`normalizeBranch()`), so VESTA's `EL PASO` is stored as `El Paso` like the others.\n- **Coastal \/ San Jacinto is fixed.** Cassandra changed it to Harris, and the only San Jacinto record left is a closed 2023 case.\n\n### Still open with the customer\n- **El Paso branch office.** The vendor number was already in her 10\/20 table (Region 10, 1035798), so the two El Paso clients print a number. Her reply says \"McAllen\" but means these two. What's missing is the **El Paso office address**, so the branch can go on Admin \u2192 Systems (it's needed for \"far from the branch office\" and the branch lists). The PDF we hold is one page; ask her for the updated one she mentions.\n- **Hays County client** (Legacy Home Health, San Antonio branch). She is checking. Still on the list.\n- **New, for her compliance team:**\n  - Coastal, Corpus Christi branch: a client living in Lago Vista (Travis County, no vendor region). Status NEVER STARTED since Dec 2023, so it may only need closing.\n  - **Counties that change the vendor number** (the county in VESTA and the address fall in different regions): 2 at Coastal (VESTA says Bexar but the client lives in Corpus Christi; VESTA says Harris but the client lives in San Antonio) and 4 at Legacy Home Health. One of those has Kenedy County in VESTA for a client in the *city* of Kenedy, which is in Karnes County.\n\n### Answer for Frank: where the county comes from\nNot the member profile. It comes from the **County column of VESTA's Member Master List** export. That list has several rows per client (member, authorization and schedule rows), and the loader takes `MAX(county)` across them. When the rows disagree, that is simply the alphabetically last value.\n\nBoth bad values fit: Travis comes after Hidalgo, and Smith comes after Bexar. The profiles Cassandra checked showed the right county, and both bad values were gone from the 23 Oct data without anyone correcting them. That points to a stray row (another authorization or schedule row) that carried a different county and has since dropped off the list. **Not yet confirmed**: the raw export isn't kept after loading.\n\n### Changes needed\n\n**1. Loader: stop picking a county (and the other Master List fields) by alphabet.**\nThe same `MAX(NULLIF(TRIM(x), ''))` is in two places, so it affects both routes:\n- `master_clinical_map()` in `scripts\/load-to-mariadb.php`: the report path, grouped by `mem_id`\n- `master_enrichment_by_medicaid()` in the same file: the API path, grouped by Medicaid number, written by `vesta_store_apply_enrichment()`\n\nIt applies to the same degree to **physician, medicare, contact, contact phone, diagnosis and caseworker**. A client with two physicians or two emergency contacts across their rows also gets whichever sorts last. Proposed fix:\n- **(a) Measure first.** Have the loader count, per agency, the clients whose rows carry more than one distinct value for each field. This logs counts only, no values, so no PHI. One night's load confirms the cause and shows how many clients and which fields are affected.\n- **(b) Then refuse to guess.** One distinct value: use it. Several: take it from the **member row** if the export has a way to tell that row apart. Otherwise store **no county** and record the conflict, so the client shows on Internal Reports as *\"VESTA lists more than one county\"* with the counties it found. Something the office can fix in VESTA is better than a quietly wrong vendor number on the 3040. The rule (distinct values \u2192 value or conflict) goes in the pure rules with a test, shared by both routes. Which row is the member row needs one look at a real export header and rows.\n- Diagnosis is the exception, since it really does differ per authorization. It probably needs to be every distinct value joined, as `tasks` already is, rather than one.\n\n**2. Internal Reports: the \"County missing\" list is mostly noise.** It has 909 clients today, because the Master List only carries clients with an **active authorization**. Almost all of them are NEVER STARTED (138 at Legacy Home Care, 304 at Coastal), NEW MEMBER, SERVICE BREAK and similar. Only **9 ACTIVE** clients have no county (3 Coastal, 6 Legacy Home Health). Proposal: list ACTIVE clients by default, with the rest behind \"show all statuses\" or as a count.\n\n**3. El Paso branch office:** data entry once Cassandra sends the address.","assets":[],"created_at":"2026-10-23T13:50:57-05:00","updated_at":"2026-10-23T13:50:57-05:00"},{"id":2863,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/205#issuecomment-2863","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/205","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"**Progress, 2026-10-25: step 2 (the redactor) is built** \u2014 commit 0d77910.\n\n## `fax\/redact.py`\nRuns on the box where the faxes are; nothing leaves it.\n\n- **Pages that aren't a recognised 2101\/2067 are dropped**, never redacted. A cover sheet has no template to say where the name is.\n- **The transport banner** across the top is filled.\n- **Layer 1**: each template field marked `\"phi\": true` (new key in `fax\/templates\/*_roi.json`) is blacked out whole, plus any OCR'd word spilling past one. The 2067 also gains `redact_regions` for the Response section's To\/From, which has no field. A page that can't be registered gets 12pt padding instead of 3pt, and the report says so.\n- **Layer 2**: Presidio (spaCy `en_core_web_lg`, on-prem) plus our own recognizers over everything else. The recognizers cover ID numbers of 7+ digits, phone numbers, BJN\/license-style ids, contract names, a labelled date of birth, and email. `DATE_TIME` is not requested.\n- **Kept**: dates, units, codes, RUG, 2060 score, check marks and the printed form.\n- **The output is image-only**: rasterised and filled, no text layer, no metadata. Named `{forms}_{sha12}.pdf`.\n- **Leftover check**: every output page is OCR'd again. If any value Layer 1 read, or any Layer 2 hit, can still be read, the fax is refused and nothing is written. Words printed on the blank forms (`printed_words`, hand-checked) never count as survivors.\n- **The report** (JSON on stdout) carries counts, entity types and field keys only. It never carries values or the input path, so it can be shared.\n\nTests: `fax\/test_redact_rules.py` (pure, standalone) has 56 checks. `fax\/test_redact.py` has 34 end-to-end checks on synthetic faxes built from the blank forms with invented values, in clean, shifted+rotated and stretched variants. No invented identifier survives in any variant, and the dates stay readable.\n\n### To run it on the secure box\n```\nvenv\/bin\/pip install -r fax\/requirements.txt -r fax\/requirements-redact.txt\nvenv\/bin\/python -m spacy download en_core_web_lg\nvenv\/bin\/python fax\/redact.py \/path\/*.pdf --out-dir \/path\/redacted > report.jsonl\n```\n`requirements-redact.txt` pins `preshed<3.0.13`, because 3.0.14 breaks spaCy's tokenizer on load. A person still pages through each sample before it is copied to `fax\/corpus\/` on dev, which is gitignored.\n\n## Claude is kept off PHI by a hook\n`.claude\/settings.json` adds Read deny rules and a `PreToolUse` hook, `.claude\/hooks\/phi-guard.py`, with 52 tests. It refuses any tool call that names any of these:\n- `faxes\/`, `fax\/output\/` or `fax\/corpus\/`\n- `downloads\/`, `hhstore\/` or `docstore\/`\n- `.env*`\n- the directories `.env` sets for the fax and document pipelines\n- Tesseract's `\/tmp` crops\n- the fax review screens\n\nIt is a seatbelt, not a sandbox: a script that opens files itself is not seen. The OS sandbox (`sandbox.filesystem.denyRead`) is not enabled yet.\n\n## Found for step 4 (calibration), not fixed\n- The classifier can't read \"Form 2101\" on the binarised blank 2101 scan (\"FOFM Z1Ut\"). `ExampleFax.pdf` reads fine.\n- A 0.8\u00b0 rotation made it miss a 2067; deskew read \u22121.97\u00b0 on one run. A 0.5\u00b0 rotation lost 2101 registration.\n- The redactor drops pages it can't recognise. That is safe, but each dropped page is one fewer sample, so the step 4 perturbation test matters.\n\n**Next:** step 1 (faxes flowing on prod) and step 3 (run the redactor, check, copy 30\u201350 per form to dev).","assets":[],"created_at":"2026-10-25T11:37:41-05:00","updated_at":"2026-10-25T11:37:41-05:00"},{"id":2864,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/200#issuecomment-2864","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/200","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"I went through every list in the 13 live form definitions (`docs\/forms\/*.json`).\n\n## Where things stand\n\nThe customer can already edit four lists on **Admin \u2192 Answer Lists** (#183):\n\n| List | Used on |\n|---|---|\n| Allergies | Client Information Sheet |\n| Equipment and assistive devices | PAS Service Plan |\n| Authority of the person signing for the client | PAS\/PHC consent, PCS consent, Private Pay agreement |\n| Languages (a menu beside \"Other (specify)\", #158) | Client Information Sheet |\n\n**No other pick-from-a-list question can be opened up as it stands.** Only a list printed on one line can take a new choice. Every other list (payer, classification, advance directives, Type of ISP, other services, the 3040's S\/U\/N\/A, and so on) has its own tick box printed on the paper. A new choice would have no box to print in. Editing one of those means changing the paper itself, not editing a list.\n\n## Where more lists can come from: a menu beside a text box\n\nThat leaves the #158 kind of list: a menu next to a typed answer. Picking from the menu fills in the wording, and the answer is still printed as typed, so it fits any line on any form. These questions are typed today and would benefit, best first:\n\n1. **Emergency contact relationship.** Client Information Sheet (first and second contact) and the Emergency\/Disaster form. The first contact is already one Shared Answer across those two forms, so the second contact would be the only extra work. This is the most common thing typed, and it's the same set of words every time.\n2. **H2076 \"describe your authority to act for the client.\"** This is a text box, while the three consents ask the same thing as a pick list. If we give it the **existing** signer-authority list as a menu, one edit on Answer Lists reaches all four forms.\n3. **Health plan (MCO) name** on both consents (\"Which health plan?\"). A short, stable list of the Texas MCOs. *Alternative:* fill it in from the VESTA authorization's payer instead. When that's available, it beats a list. Worth deciding before building either.\n4. **Reason the client cannot sign.** One Shared Answer across the three consents. Short common reasons, for example \"physical impairment\" or \"cognitive impairment\".\n\n**Not recommended:**\n- **Diagnosis.** It's a clinical free-text field, and a menu would mostly invite picking the nearest wrong entry.\n- **Service tasks \/ \"Other task.\"** These are fixed from VESTA (`auth.service_tasks`).\n- **County.** It comes from the address.\n- **Physician \/ pharmacy \/ other agency.** The provider directory lookup (#82) covers these.\n\n## Questions for the customer\n\n- Which of 1\u20134 do they want?\n- Do they have their own wording for **relationships**? The signer-authority list is still the starting list we wrote (19 Oct), not theirs, so this is a good moment to collect both.\n- For the health plan: a list they keep, or filled in from VESTA?\n\nEach one is a definition change (`\"menu\": [...]` on the field, plus a title in `ANSWER_LIST_TITLES`) and a publish. No screen or schema work is needed.","assets":[],"created_at":"2026-10-25T13:43:43-05:00","updated_at":"2026-10-25T13:43:43-05:00"},{"id":2868,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/176#issuecomment-2868","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/176","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"Fixed in a6ac68f (committed on dev, not yet deployed).\n\n- [x] `user_in_system($fk_system)` on the posted agency; a refusal is audited (`authz.denied`, `reason: not_in_system`).\n- [x] `report_type` must match `^[a-z][a-z0-9_-]{0,39}$`. `accept_column_signature()` already changes nothing unless that row exists for the system, so the shape check mainly keeps arbitrary text out of the audit record.\n- [x] Grepped every `perms[$x]` lookup in `backend\/`, `pages\/`, `code\/`. None other takes `$x` from the request: each uses `$SITE['pk_system']` (the URL's agency, which `cw_route()` already membership-checks), or filters `$_SESSION['user']['systems']` first (`pipeline-status`, `activity_scope_systems()`, `mobileTokenRegister`).\n\nAlso: the endpoint now reads `$_POST` and is gated by `check_auth_json(['role\/Administrator', 'role\/Superuser'])` instead of a bare `check_auth_json()`. It was removed from the self-scoped allowlist in `scripts\/test-backend-auth-guards.php`, which passes.\n\nNot tested live: every admin on dev is linked to all three agencies, so the refusal path is covered by reading the code, not by a request.","assets":[],"created_at":"2026-10-25T16:17:58-05:00","updated_at":"2026-10-25T16:17:58-05:00"},{"id":2869,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/178#issuecomment-2869","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/178","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"Code half done in a6ac68f (committed on dev, not yet deployed). **Leaving this open for the Caddyfile check.**\n\n- [x] One helper, `client_ip()` in `code\/client_ip.inc.php`, now used in all six places: `accountLogin`, `accountAuth`, `mobileSessionStart`, `actionPlan`, `sessions.ip`, and the audit log. It returns `REMOTE_ADDR`, and reads `X-Forwarded-For` only when `REMOTE_ADDR` is in the new `TRUSTED_PROXIES` setting (comma-separated addresses or CIDR ranges, IPv4 and IPv6). It then walks the header right to left, past our own proxies, and stops at a malformed entry. **Unset by default, so the header is never read.**\n- [x] `scripts\/test-client-ip.php` (25 checks) covers the resolver, and fails if anything else in `backend\/`, `code\/`, `pages\/` or `web\/` reads the header.\n- [x] Same commit, a #179 item: the `logs` row's `INET_ATON(\"{$_SERVER['REMOTE_ADDR']}\")` is now quoted via `PDO::quote()`.\n\n**Still to do:**\n- [ ] Check the production Caddyfile. If Caddy serves PHP directly (`php_fastcgi`), leave `TRUSTED_PROXIES` unset: `REMOTE_ADDR` is already the real client. Only if another proxy sits in front of Caddy should its address go in `TRUSTED_PROXIES`. In that case also confirm that Caddy's `trusted_proxies` is set, so it does not pass a client-supplied header through.","assets":[],"created_at":"2026-10-25T16:17:58-05:00","updated_at":"2026-10-25T16:17:58-05:00"},{"id":2871,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/29#issuecomment-2871","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/29","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"Built in a6ac68f (committed on dev, not yet deployed). Verified in one place, as the issue asked: `cw_route()`, after `check_auth()` and before any page or `\/do\/` endpoint is dispatched.\n\n## Two layers\n1. **Origin, on every non-GET request, signed in or not.** Refused when `Sec-Fetch-Site` is `cross-site` or `same-site`. Browsers that don't send it are judged by `Origin` against the request's Host instead. A request with neither header is not a browser acting for someone (a browser always sends `Origin` on a cross-site POST). It passes to whatever else authenticates it, which covers `actionPlan`'s own token. This layer also covers the anonymous endpoints: a cross-site POST to `accountLogin` would otherwise sign the victim out.\n2. **Token, on every write with a signed-in cookie session.** A per-session random value (`$_SESSION['csrf_token']`), printed as `<meta name=\"csrf-token\">` and by `csrf_field()`, and sent back as the `X-CSRF-Token` header or a `_csrf` field.\n\nA Bearer request is exempt from both, because the credential is not ambient.\n\n## Callers\n- jQuery: an `ajaxPrefilter` in the layout adds the header to same-origin requests only.\n- The six `fetch()` `post()` helpers send `window.CSRF_TOKEN`: `visit-v2`, `visits-v2`, `form-v2-releases`, `form-explorer`, `form-v2-publish`, `form-packets`.\n- The 13 POST forms print `csrf_field()`: `roles` \u00d74, `emergency` \u00d73, `login` \u00d72, `emergencies`, `users-edit`, `systems-edit`, `answer-list-edit`.\n\n## What a refusal looks like\n- On a `\/do\/` endpoint: `error_code: 'csrf'`, \"This page is out of date. Reload the page and try again.\"\n- On a page: a notice, and a 303 back to the same page.\n- Either way it is audited as `audit_security('csrf.refused')`.\n\n## Tests\n- Pure rules in `code\/csrf_rules.inc.php`. `scripts\/test-csrf.php` (43 checks) also fails on:\n  - a POST form without `csrf_field()`;\n  - a writing `fetch()` without the header;\n  - the check placed after `check_auth()` is missing, or moved below a page or `\/do\/` include.\n- I removed a token on purpose to confirm the scan fails.\n- On dev with curl:\n  - no token, a wrong token, or `Sec-Fetch-Site: cross-site` \/ a foreign `Origin` with a valid token were all refused;\n  - a valid token was accepted;\n  - GETs were unaffected;\n  - an anonymous cross-site POST to `accountLogin` was refused.\n- In Chrome: a jQuery `$.post` and the page's `fetch()` helper both succeeded without being told about the token, and a bare `fetch()` was refused.\n\n## Deploy notes\n- Browser tabs left open from before the deploy have no token, so their first save shows the message once. A visit with unsaved answers stops saving and keeps them pending, but reloading the page loses them.\n- If a person's server session is replaced while a page is open (for example, the trusted-device cookie signs them back in), the page's token is stale and they see the same message. Not seen in testing.\n- `code\/php-csrf.php` is still unused. It can be deleted separately.","assets":[],"created_at":"2026-10-25T16:17:58-05:00","updated_at":"2026-10-25T16:17:58-05:00"},{"id":2898,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/206#issuecomment-2898","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/206","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"## Decided (2026-11-03, later)\n\n- [x] **If an update changes a value of an accepted form, the form goes back to \"Not checked\".** A change to a value that staff corrected does not do this, because the correction wins.\n- [x] **Fax images go in the encrypted document store under a new subject kind, `fax`.** An unrouted fax is filed under agency 0. Only the `fax` subject kind may do this. When staff route the fax, production files the images again under the agency and archives the agency-0 copies.\n- [x] **No faxes on production yet.** Start clean. The fax push is the only route, and the worker no longer writes to a database.\n\n## Progress (not committed yet)\n\n- **Step 1 \u2014 built.** `docs\/Fax.md` describes the route. On the secure box: `fax-worker.php` \u2192 outbox \u2192 `fax-push.php`. On production: `web\/ingest.php` spools the push and `fax-intake.php` files it. New tables: `fax_form`, `fax_field_correction`, `fax_form_match` and `fax_push`. The document store has the `fax` subject kind. The image endpoint writes a PHI audit record. Tests: `test-fax-push-rules.php` (64 passed), `test-fax-intake-state.php` (49 passed). The signed push was also tested end to end on dev.\n- **Step 2 \u2014 built.** Each authorization has a VESTA date in `hh_auth_change`. The loader records it at each load. Test: `test-auth-change-rules.php` (42 passed).\n- **Step 3 (the tables) \u2014 partly done.** The form, match and push-history tables are in migration `20261103-03_fax-push.sql`.\n- **Next:** step 4, the automatic match and the retry after each VESTA load.","assets":[],"created_at":"2026-11-03T16:41:53-06:00","updated_at":"2026-11-03T16:41:53-06:00"},{"id":2899,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/197#issuecomment-2899","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/197","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"## Settled, 5 Nov (Charles)\n\n**1. The \"Ask: \u2026\" line** now sits at the top of each question's \u24d8 panel, above the list of forms the answer goes on. It's no longer under the label. A question that has an \"Ask:\" but goes on no form still gets the \u24d8 button. FormsV2Plan \u00a74.1.3 and `docs\/form-v2-interviews\/README.md` say so.\n\n**2. Fragment labels** (\"Phone\", \"Which directives\", \"Reviewed and acknowledged\"): covered for now by point 1. The \"Ask:\" line that explains them is one tap away, in the \u24d8 panel.\n\n**3. The four labels**, now pinned in `FORM_V2_STANDARD_WORDING` so a form added later can't change them:\n- Phone \u2192 **\"Phone\"** (was \"Telephone No.\")\n- Address \u2192 **\"Individual's Address\"**, kept\n- Emergency priority class \u2192 **\"What category describes your special needs?\"**, kept\n- Physician \u2192 **\"Name of Physician Individual Sees Regularly\"**, kept\n\nThe \u24d8 panel change is live in dev. The \"Phone\" label goes out with the next SOC\/AO release (not yet published). Tests: `test-form-v2.php`.","assets":[],"created_at":"2026-11-05T08:12:27-06:00","updated_at":"2026-11-05T08:12:27-06:00"},{"id":2900,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/198#issuecomment-2900","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/198","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"## Fixed, 5 Nov (Charles: \"print N\/A. clear type when attendant name is removed\")\n\n**What happens now:** clearing an attendant's name clears that attendant's visit type. Items 4 and 5 then print **N\/A** for them, unasked.\n\n**How:**\n- A question may now carry `clear_when_hidden: true`. When a save hides it, the same save clears its kept answer. The cleared row is marked as coming from the hiding (origin `hidden`), and the page is told so it updates. Code: `form_v2_visit_hidden_clears()` (pure), called from `form_v2_visit_save()`.\n- The answer is cleared **only when a save hides the question**. An attendant slot that was never named keeps its starting AO, so \"Add an attendant\" still starts as AO.\n- SOC\/AO's three attendant visit-type questions carry it. Items 4 and 5 are now `fixed_if` the type is AO **or blank** (`[\"ao\", \"\"]`; a cleared answer reads as `\"\"`).\n- This doesn't change how conditions read hidden answers in general. Every other hidden answer is still kept until signing (#120).\n\n**One difference:** an attendant who is removed and then added back starts with a **blank** type, not AO. It's required, so the supervisor picks it.\n\n**Tests:**\n- `test-form-v2-visit-rules.php`: the rule itself.\n- `test-form-v2-visit-state.php`: real saves. The save that hides the question clears the answer, and the answer stays cleared when the question comes back.\n- `test-form-v2-workflow.php`: the flag is carried from the interview file.\n\nThe publish dry run for SOC\/AO passes. This goes out with the next SOC\/AO release (not yet published).","assets":[],"created_at":"2026-11-05T08:12:27-06:00","updated_at":"2026-11-05T08:12:27-06:00"},{"id":2902,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/156#issuecomment-2902","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/156","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"## Update, 5 Nov: the AR interview is written\n\n**SOC\/AO cleanup:** the Client Information Sheet's \"Type of Visit Completed\" is no longer asked. It's fixed as Start of Care.\n\n**`docs\/form-v2-interviews\/AR.json`** is AR's interview: 277 questions in 10 steps. It's built from SOC\/AO's for the forms the two share (consent, Client Information Sheet, Emergency\/Disaster, 3040, service plan, Coordination of Care), with these changes:\n- The visit type is fixed as **Annual Reassessment**, on the Client Information Sheet and in the 3040's item 1 sentence (`visit.visit_kind` = `ar`).\n- Each attendant's 3040 visit type **starts as SV**: at a reassessment the attendant is usually already working, so this is a supervisory visit. AO and SA are still available.\n- The 3040's orientation questions (item 10) are asked only when an attendant is AO.\n- The Task Guide, Things You May Not Do, 2-1-1, transfer and Private Pay steps are gone, since AR doesn't include those forms.\n\nThe publish dry run passes every check, including the printed sample forms. It isn't published. In dev, the interview draft `AR_V2` exists.\n\n### What it showed\n\n| | |\n|---|---|\n| Offering fewer of a form's choices | **Not needed for AR.** |\n| Showing an answer that is fixed (never asked) | **Not needed for AR.** |\n| **Printing only some pages of a form** | \u274c **A gap.** The AR checklist lists only page 1 of the 3040. V2 ignores a packet's `require: pages` and prints the whole form, so an AR visit would print the 3040's orientation page with its signature lines. **Being built next.** |\n\n### Still open\n- **For Jane:** is the attendant visit type at an AR always SV? (This is question 3 above, for AR.)\n- **For the customer:** combined visits (the 20 Oct comment).","assets":[],"created_at":"2026-11-05T08:12:27-06:00","updated_at":"2026-11-05T08:12:27-06:00"},{"id":2903,"html_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/156#issuecomment-2903","pull_request_url":"","issue_url":"https:\/\/www-s01.apinet.com\/codeforge\/apiintl\/hhmanager\/issues\/156","user":{"id":1,"login":"charles","login_name":"","source_id":0,"full_name":"Charles Willgren","email":"charles@noreply.www-s01.apinet.com","avatar_url":"https:\/\/www-s01.apinet.com\/codeforge\/avatars\/d3c894f7297c5a18eb3f6ac837c335b11a00aa9cc0961323771632b1e2d61bb2","html_url":"https:\/\/www-s01.apinet.com\/codeforge\/charles","language":"","is_admin":false,"last_login":"0001-01-01T00:00:00Z","created":"2025-12-08T10:03:41-06:00","restricted":false,"active":false,"prohibit_login":false,"location":"","pronouns":"","website":"","description":"","visibility":"public","followers_count":0,"following_count":0,"starred_repos_count":0,"username":"charles"},"original_author":"","original_author_id":0,"body":"## Fixed, 5 Nov: a visit type prints only the pages it requires\n\n**What changed:** a packet item's `require` (`{\"pages\":[1]}` or `{\"sections\":[\u2026]}`) now narrows the form in V2. This is done wherever V2 loads a visit type's forms:\n- `form_v2_workflow_validation_ctx()`: the seed and the publish check, Shared Answers included.\n- `form_v2_release_runtime()`: a visit, and the Explorer on a release.\n- `form_v2_signing_maps()`, when given a release's manifest.\n- `form_v2_release_pdf()`: narrows the map and returns `pages`.\n\n**What follows from it:** only the required pages' questions are asked and checked, and only their signing lines are signed. `form_pdf_generate()` takes a `pages` option and prints just those sheets of the blank. A signed copy is stamped onto the same sheets.\n\nNothing is added to a release's manifest: the pages are worked out from the packet and form versions it already pins (`form_v2_release_pages()`).\n\n**What it narrows today** (a form required whole, or on every page it has, is untouched):\n\n| Visit type | Prints |\n|---|---|\n| SOC\/AO | unchanged; its interview and release are what they were |\n| AR, SV, PHV | 3040 page 1 |\n| AO, Change Program, Service Plan Change | service plan page 2 |\n\n**AR:** AR.json no longer asks the 3040's orientation questions (page 2, which AR doesn't print). It's now 270 questions, and its publish dry run passes every check, including the printed samples. Not published.\n\n**Tests:**\n- `scripts\/test-form-v2-pages.php`: the pure rules.\n- `test-form-pdf-compose.php`: page 2 alone prints one sheet, page 2 of the blank, and the signed copy keeps it.\n- All the Forms V2 suites pass.\n\n**For Jane:**\n- At an AR, a new attendant can still be marked AO, but their orientation page isn't printed. Is that right, or is a new attendant oriented on another visit?\n- The AO visit type prints only page 2 of the service plan. Is that what they use?\n\n**Not yet checked:** a real AR visit from start to signing in the browser. That needs AR published and switched on in dev.","assets":[],"created_at":"2026-11-05T08:24:19-06:00","updated_at":"2026-11-05T08:24:19-06:00"}]}