diff --git a/data/forms-content-review.json b/data/forms-content-review.json index f335916537..c157f97565 100644 --- a/data/forms-content-review.json +++ b/data/forms-content-review.json @@ -11,7 +11,7 @@ "sections": ["26", "36", "40", "41", "42", "43", "44"], "contextualSections": ["25", "31", "37", "39", "45", "46", "547"], "basis": "Drafted from Mental Health Act 2014 (WA) s 26, s 36, s 40, s 41, s 42, s 43, s 44 with s 25, s 31, s 37, s 39, s 45, s 46, s 547 as context, and from the approved Form 1A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "eb950d3c48dba095ef61d7b0645709d90316ed475b5eb6602b670e62e6e07ad1" }, @@ -21,7 +21,7 @@ "sections": ["41", "42"], "contextualSections": ["26", "36"], "basis": "Drafted from Mental Health Act 2014 (WA) s 41, s 42 with s 26, s 36 as context, and from the approved Form 1A attachment as listed on the Office of the Chief Psychiatrist register. Section basis: The attachment carries referral information given in confidence by someone other than the person. s 41(c) and (d) require the referral to set out the information the suspicion rests on and to distinguish its source; s 42(2) is the exception that keeps information supplied on condition of non-disclosure from the person.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "50c9d0d7b072e076da8830c54f6c35ff608f7a7ca338721701b9a2f96db79717" }, @@ -31,7 +31,7 @@ "sections": ["45", "46"], "contextualSections": ["26", "41", "44"], "basis": "Drafted from Mental Health Act 2014 (WA) s 45, s 46 with s 26, s 41, s 44 as context, and from the approved Form 1B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "933af3a84c6ce4b698e314fed0553bccec0ca8c54b2797a791ce88c93df048a7" }, @@ -41,7 +41,7 @@ "sections": ["34", "35"], "contextualSections": ["25", "36"], "basis": "Drafted from Mental Health Act 2014 (WA) s 34, s 35 with s 25, s 36 as context, and from the approved Form 2 as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-10-06T09:19:27.897Z", "reviewedContentSha256": "9f8dd86e02761c72372037d1e3b1046c70e4444e1177c3b2c870c2c1581bc098" }, @@ -51,7 +51,7 @@ "sections": ["28", "62"], "contextualSections": ["26", "61"], "basis": "Drafted from Mental Health Act 2014 (WA) s 28, s 62 with s 26, s 61 as context, and from the approved Form 3A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "04f66d823c0f88123e5c2c8aeeaa3609f1c36515769abf6955083c6a6804a7c3" }, @@ -61,7 +61,7 @@ "sections": ["28", "59", "62"], "contextualSections": ["26", "58", "61"], "basis": "Drafted from Mental Health Act 2014 (WA) s 28, s 59, s 62 with s 26, s 58, s 61 as context, and from the approved Form 3B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "11ddcb0d7750d907c29ee1e2452e78c886ca38846f08bf6eeff2e93d300c46c2" }, @@ -71,7 +71,7 @@ "sections": ["55", "56"], "contextualSections": ["52", "53"], "basis": "Drafted from Mental Health Act 2014 (WA) s 55, s 56 with s 52, s 53 as context, and from the approved Form 3C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:14:18.043Z", "reviewedContentSha256": "8bf94f175892125cf8bd077a2eab041930175c94f260b39bb82426c5954d847d" }, @@ -81,7 +81,7 @@ "sections": ["61"], "contextualSections": ["62", "63", "69"], "basis": "Drafted from Mental Health Act 2014 (WA) s 61 with s 62, s 63, s 69 as context, and from the approved Form 3D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "302c105b548a4248246905d2bb839cec01295b0edbea5c09ee2d4688f27ffb58" }, @@ -91,7 +91,7 @@ "sections": ["55", "56", "61", "72"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 55, s 56, s 61, s 72, and from the approved Form 3E as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "8418a51499269d6a8a0ee0b7816d6743941caff7b4dc028d24118f4216cafacb" }, @@ -101,7 +101,7 @@ "sections": ["29", "63", "67", "92", "112", "129", "133", "148", "150", "154"], "contextualSections": ["152", "153"], "basis": "Drafted from Mental Health Act 2014 (WA) s 29, s 63, s 67, s 92, s 112, s 129, s 133, s 148, s 150, s 154 with s 152, s 153 as context, and from the approved Form 4A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "00913d4155717b2da2d3635cbfcbd8427af5dd66849f618fb0b81a286d2ee9b2" }, @@ -111,7 +111,7 @@ "sections": ["152"], "contextualSections": ["148", "150"], "basis": "Drafted from Mental Health Act 2014 (WA) s 152 with s 148, s 150 as context, and from the approved Form 4B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "8db3f7db90766bb5f8faf1774501c19f985b4f97c9342f95528ac0c19e7545dc" }, @@ -121,7 +121,7 @@ "sections": ["66", "91"], "contextualSections": ["67", "92"], "basis": "Drafted from Mental Health Act 2014 (WA) s 66, s 91 with s 67, s 92 as context, and from the approved Form 4C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "94d6a2b10922bb21b2b6ba92c55194bbae5a34baa81fd9045db6bd12412cfed6" }, @@ -131,7 +131,7 @@ "sections": ["555"], "contextualSections": ["551"], "basis": "Drafted from Mental Health Act 2014 (WA) s 555 with s 551 as context, and from the approved Form 4D as listed on the Office of the Chief Psychiatrist register. Section basis: s 555 is the interstate transfer order: the person in charge of a hospital, with the Chief Psychiatrist's written approval, may order a State inpatient's transfer to an interstate mental health service.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "37c313bfe24c80353139d302e83e220fa88eef1ecb4e599f7318fccbeda054d4" }, @@ -141,7 +141,7 @@ "sections": ["557"], "contextualSections": ["551"], "basis": "Drafted from Mental Health Act 2014 (WA) s 557 with s 551 as context, and from the approved Form 4E as listed on the Office of the Chief Psychiatrist register. Section basis: s 557 creates the transfer approval order, by which the person in charge of a hospital, with the Chief Psychiatrist's written consent, approves an interstate inpatient's transfer to that hospital.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "e48c4707ad2328cd5086fe9e59dfac23b13a63cf123413294ade27fdaecb53e0" }, @@ -151,7 +151,7 @@ "sections": ["55", "56", "61", "72", "75", "76"], "contextualSections": ["25", "114", "115", "116", "117", "120", "123", "131"], "basis": "Drafted from Mental Health Act 2014 (WA) s 55, s 56, s 61, s 72, s 75, s 76 with s 25, s 114, s 115, s 116, s 117, s 120, s 123, s 131 as context, and from the approved Form 5A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "97a7ed35ee582dd764fee035ce0238afec82e3ffeb8046f69c45c279351b2e07" }, @@ -161,7 +161,7 @@ "sections": ["121"], "contextualSections": ["118", "120"], "basis": "Drafted from Mental Health Act 2014 (WA) s 121 with s 118, s 120 as context, and from the approved Form 5B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "97cd3fb2701fc2817ccc9a9811e95909a424c4adafd111c83f777f1b13bf989e" }, @@ -171,7 +171,7 @@ "sections": ["122"], "contextualSections": ["115", "135", "137"], "basis": "Drafted from Mental Health Act 2014 (WA) s 122 with s 115, s 135, s 137 as context, and from the approved Form 5C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "151a61fe17b7e05a6e5fb1556ce2500cdf5d461195222440372a097643d4960a" }, @@ -181,7 +181,7 @@ "sections": ["118", "119"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 118, s 119, and from the approved Form 5D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "bc5bede61cca0ed4a0b75c570878793287d632ebc954ab411dae41580b657b81" }, @@ -191,7 +191,7 @@ "sections": ["127"], "contextualSections": ["126"], "basis": "Drafted from Mental Health Act 2014 (WA) s 127 with s 126 as context, and from the approved Form 5E as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "055e581ec4e9d8507430ec598b91c297ecdefce9e1a7d5e805d4c371f46e184c" }, @@ -201,7 +201,7 @@ "sections": ["128"], "contextualSections": ["127", "129"], "basis": "Drafted from Mental Health Act 2014 (WA) s 128 with s 127, s 129 as context, and from the approved Form 5F as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "6735c7bb7a9c5d66f147cf5292ed4a3deee218d76117073cc29260e42e5eb7d2" }, @@ -211,7 +211,7 @@ "sections": ["55", "56", "72", "87"], "contextualSections": ["25", "89", "90", "120", "123", "131"], "basis": "Drafted from Mental Health Act 2014 (WA) s 55, s 56, s 72, s 87 with s 25, s 89, s 90, s 120, s 123, s 131 as context, and from the approved Form 6A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "7f6f49a4d962b452f6be7b7eda705e2b6d7c92724661bde57c9f41c647d247a2" }, @@ -221,7 +221,7 @@ "sections": ["61", "87"], "contextualSections": ["65", "66", "68", "89", "90", "131"], "basis": "Drafted from Mental Health Act 2014 (WA) s 61, s 87 with s 65, s 66, s 68, s 89, s 90, s 131 as context, and from the approved Form 6B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "da8736e41d2cd3f2505e6d2e2dfb286dd8890741cfefc69a44db87a3b47d305e" }, @@ -231,7 +231,7 @@ "sections": ["65"], "contextualSections": ["61", "87", "89"], "basis": "Drafted from Mental Health Act 2014 (WA) s 65 with s 61, s 87, s 89 as context, and from the approved Form 6B attachment as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "6b9188f60ed7f897f95b99caac3077e9737abd7452cd6ccb830c30f838cb2bf2" }, @@ -241,7 +241,7 @@ "sections": ["89"], "contextualSections": ["87", "90"], "basis": "Drafted from Mental Health Act 2014 (WA) s 89 with s 87, s 90 as context, and from the approved Form 6C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "58960bdc41245e790f261272cefae6e481ddd02e9c4053b1be9bc4109e88fcf7" }, @@ -251,7 +251,7 @@ "sections": ["68", "124"], "contextualSections": ["61", "66", "120", "123"], "basis": "Drafted from Mental Health Act 2014 (WA) s 68, s 124 with s 61, s 66, s 120, s 123 as context, and from the approved Form 6D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "9ba2496ef4ff40424107c705203cf1ff8a5abbf9121167ca0ff0a5567cedbb8c" }, @@ -261,7 +261,7 @@ "sections": ["105"], "contextualSections": ["90"], "basis": "Drafted from Mental Health Act 2014 (WA) s 105 with s 90 as context, and from the approved Form 7A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "a47687a483103681ef546e760157d2701c0cd335c1bcb7c18de6651ad7b64215" }, @@ -271,7 +271,7 @@ "sections": ["106"], "contextualSections": ["105", "110"], "basis": "Drafted from Mental Health Act 2014 (WA) s 106 with s 105, s 110 as context, and from the approved Form 7B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "29812cfccd9120636fb8a9a42dd932d6a5d56ab64a13d1a9dbf309fd4e14c066" }, @@ -281,7 +281,7 @@ "sections": ["110"], "contextualSections": ["112"], "basis": "Drafted from Mental Health Act 2014 (WA) s 110 with s 112 as context, and from the approved Form 7C as listed on the Office of the Chief Psychiatrist register. Section basis: s 110 is the cancelling-leave power: where a psychiatrist reasonably believes it is inappropriate for an involuntary inpatient to remain away on leave, they may order the leave cancelled.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "142743958ac5534679359c0030e6e7aabaf7eefeb788f3a77b4630431da37c7c" }, @@ -291,7 +291,7 @@ "sections": ["98", "101"], "contextualSections": ["97", "99", "100"], "basis": "Drafted from Mental Health Act 2014 (WA) s 98, s 101 with s 97, s 99, s 100 as context, and from the approved Form 7D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "f9871c48eab4364242bbee4ace894164e10dbf0b30974ee4b3c5424b4c6d61e6" }, @@ -301,7 +301,7 @@ "sections": ["165"], "contextualSections": ["159", "162", "166"], "basis": "Drafted from Mental Health Act 2014 (WA) s 165 with s 159, s 162, s 166 as context, and from the approved Form 8A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "50ab2c19a7bda52c0c7429b194f0a59941ec44ec6d502f5cf7c033254a68babb" }, @@ -311,7 +311,7 @@ "sections": ["167"], "contextualSections": ["162", "166"], "basis": "Drafted from Mental Health Act 2014 (WA) s 167 with s 162, s 166 as context, and from the approved Form 8B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "87e8bca7e93166a7825aca88d5757f6d16564fb86d4edbd09abb8aee3a93ed16" }, @@ -321,7 +321,7 @@ "sections": ["204"], "contextualSections": ["202", "203"], "basis": "Drafted from Mental Health Act 2014 (WA) s 204 with s 202, s 203 as context, and from the approved Form 9A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "3cfb4a73e3b70cd624869ac6be78e6ed81cc32e70fb923ccd027dd0e7f736480" }, @@ -331,7 +331,7 @@ "sections": ["242"], "contextualSections": ["240", "241"], "basis": "Drafted from Mental Health Act 2014 (WA) s 242 with s 240, s 241 as context, and from the approved Form 9B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "80cd346e45c3caeb84c45240bac4129850ff064a356c4af99c00e04783ac775d" }, @@ -341,7 +341,7 @@ "sections": ["230"], "contextualSections": ["232"], "basis": "Drafted from Mental Health Act 2014 (WA) s 230 with s 232 as context, and from the approved Form 10A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "b387de0a23c1bc227d8da4913df2dcd4db255fccc656bf8e5faa295970eb29c3" }, @@ -351,7 +351,7 @@ "sections": ["231"], "contextualSections": ["232"], "basis": "Drafted from Mental Health Act 2014 (WA) s 231 with s 232 as context, and from the approved Form 10B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:14:23.764Z", "reviewedContentSha256": "30dcd439366783c96abc3e827d0f8378c3f851b5f5044e65231313c97814e24f" }, @@ -361,7 +361,7 @@ "sections": ["230", "231", "233"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 230, s 231, s 233, and from the approved Form 10C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "3969ac09dd042aa9fe4a8844ac6649a83703973af5471eb9935ee150ec3d51e1" }, @@ -371,7 +371,7 @@ "sections": ["238"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 238, and from the approved Form 10D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "7c087fb285d1ef9054067ac4fc272249e147d44a19285141302cffc5be1a22f6" }, @@ -381,7 +381,7 @@ "sections": ["234", "238"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 234, s 238, and from the approved Form 10E as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:14:28.175Z", "reviewedContentSha256": "b834adf3b6a3524672262d4b5dd3a387af38a57b6a23d753ed7f31811388e9c0" }, @@ -391,7 +391,7 @@ "sections": ["234"], "contextualSections": ["238"], "basis": "Drafted from Mental Health Act 2014 (WA) s 234 with s 238 as context, and from the approved Form 10F as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "f0406453839048cffea1461ee51a6fefd29ffc3c7ff3c1edab79df4ceb5afdcc" }, @@ -401,7 +401,7 @@ "sections": ["235", "237"], "contextualSections": ["239"], "basis": "Drafted from Mental Health Act 2014 (WA) s 235, s 237 with s 239 as context, and from the approved Form 10G as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "a063e3ea9ff7fad8580b1ce4d0cfda22a15926f069b3c510482be39f05e63d78" }, @@ -411,7 +411,7 @@ "sections": ["238"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 238, and from the approved Form 10H as listed on the Office of the Chief Psychiatrist register. Section basis: s 238(5) requires a psychiatrist to review the use of bodily restraint once a person has been restrained for more than 6 hours, and to record the date, time and results.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "de8afc8023f9546fbcfbe243ee442657e08477b309c7f9d998172c663ba89987" }, @@ -421,7 +421,7 @@ "sections": ["239"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 239, and from the approved Form 10I as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "36a060bf718be535db818f56d0d06c638bbf8dc16dc7bd43a7a3d0f9a1165c02" }, @@ -431,7 +431,7 @@ "sections": ["214"], "contextualSections": ["216"], "basis": "Drafted from Mental Health Act 2014 (WA) s 214 with s 216 as context, and from the approved Form 11A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "2aaeb27a46594658cf1539ebe64680ece9f671a145f758652818ffcf321d3118" }, @@ -441,7 +441,7 @@ "sections": ["215"], "contextualSections": ["216"], "basis": "Drafted from Mental Health Act 2014 (WA) s 215 with s 216 as context, and from the approved Form 11B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:14:35.024Z", "reviewedContentSha256": "f146cf71bd4da3b092bccd2bad5693212109178265e5a8d8e7c684552705e642" }, @@ -451,7 +451,7 @@ "sections": ["214", "215", "217"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 214, s 215, s 217, and from the approved Form 11C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "2843a9033385d0d6252309dfa3859530d033e21e570334c32a84a5565af21900" }, @@ -461,7 +461,7 @@ "sections": ["222"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 222, and from the approved Form 11D as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "147ea97578a2ecca6093a6b129979c9f05641470cceeb987f38f81b0da91569a" }, @@ -471,7 +471,7 @@ "sections": ["218", "222"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 218, s 222, and from the approved Form 11E as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "ce7c4d6b81131d8b1f8ae19cf8bca7cd0807c3fcce35e27b3e2922f767f4b345" }, @@ -481,7 +481,7 @@ "sections": ["219", "221"], "contextualSections": ["223"], "basis": "Drafted from Mental Health Act 2014 (WA) s 219, s 221 with s 223 as context, and from the approved Form 11F as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "f6370eb461a77a93c6cd901d297f2d2668e7cdaf92ab501befb36aaaaa5300ee" }, @@ -491,7 +491,7 @@ "sections": ["223"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 223, and from the approved Form 11G as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "be090f33603afbc5d01f5faa938c472fb90950b83dd8dd44976eafd64ee8b0f1" }, @@ -501,7 +501,7 @@ "sections": ["275"], "contextualSections": ["263", "266", "273", "274", "276", "277", "278"], "basis": "Drafted from Mental Health Act 2014 (WA) s 275 with s 263, s 266, s 273, s 274, s 276, s 277, s 278 as context, and from the approved Form 12A as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "6e15eb400780d6bb8be598dff13831b20ac929cfb1afee591666743de77c37db" }, @@ -511,7 +511,7 @@ "sections": ["248", "249"], "contextualSections": [], "basis": "Drafted from Mental Health Act 2014 (WA) s 248, s 249, and from the approved Form 12B as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "7aac0062daf89cd772500faf22167b9769c32f0d49472a75b51129a4d9a9595e" }, @@ -521,7 +521,7 @@ "sections": ["262"], "contextualSections": ["261"], "basis": "Drafted from Mental Health Act 2014 (WA) s 262 with s 261 as context, and from the approved Form 12C as listed on the Office of the Chief Psychiatrist register.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "3b202a3de5fb63fbc4139e35b72a1d694fbcd96ab825fc9dc6e5b179049c02f7" }, @@ -531,7 +531,7 @@ "sections": ["262"], "contextualSections": ["261"], "basis": "Drafted from Mental Health Act 2014 (WA) s 262 with s 261 as context, and from the approved Form 12C attachment as listed on the Office of the Chief Psychiatrist register. Section basis: s 262(7) and (8) require a psychiatrist to review a communication-restriction order before the end of each 24-hour period and to confirm, amend or revoke it, filing a record and the reasons.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "d0c16853019cb610af7ae63308a04e12fa62c6fca62917e75309eef7f5913ef2" }, @@ -541,7 +541,7 @@ "sections": ["201"], "contextualSections": ["199"], "basis": "Drafted from Mental Health Act 2014 (WA) s 201 with s 199 as context, and from the approved Form 13 as listed on the Office of the Chief Psychiatrist register. Section basis: s 201 is the ECT statistics duty: the person in charge of a mental health service where ECT is performed must report monthly to the Chief Psychiatrist.", - "reviewedBy": "PsychSift", + "reviewedBy": "Josh Simpson", "reviewedAt": "2026-09-26T17:20:51.637Z", "reviewedContentSha256": "c95b4fafb2144233036083cde68034e14e97f1413532d04dde5fa80eca40e209" } diff --git a/data/repo-awareness-snapshot.json b/data/repo-awareness-snapshot.json index e98628bf8d..5731be069d 100644 --- a/data/repo-awareness-snapshot.json +++ b/data/repo-awareness-snapshot.json @@ -663,6 +663,11 @@ "file": "src/app/mockups/warning-line/page.tsx", "area": "mockup" }, + { + "path": "/teaching/assessments/respond/[token]", + "file": "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", + "area": "product" + }, { "path": "/my-day/alerts/earlier", "file": "src/app/(search-app)/my-day/alerts/earlier/page.tsx", @@ -1926,6 +1931,10 @@ "path": "/api/on-call/shifts", "file": "src/app/api/on-call/shifts/route.ts" }, + { + "path": "/api/teaching/assessments/respond/[token]", + "file": "src/app/api/teaching/assessments/respond/[token]/route.ts" + }, { "path": "/api/alerts/test", "file": "src/app/api/alerts/test/route.ts" diff --git a/data/service-records-review.json b/data/service-records-review.json index 011011f0d2..76c1c348c7 100644 --- a/data/service-records-review.json +++ b/data/service-records-review.json @@ -4,22 +4,22 @@ { "id": "SVC-SV-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "bf23a645cd7e8a794a22034c3405b68892fd97f38d5c355c20dac58de2a62096" }, { "id": "SVC-FDV-003", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "9ae1192f9bc458c0cb0abc94ca0b8b2acb82f65458d2246800daecba90a5a9a6" }, { "id": "SVC-SUI-003", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "9a8af1cf599ba6c8d228cf2a31e201445ff27b8186da05e3b23f51aae7d840b2" }, { @@ -39,22 +39,22 @@ { "id": "SVC-POS-002", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "ef73b6890bd8d2386134c851e9069b7522f28615fb7b492f016f55b8c07aafad" }, { "id": "SVC-POS-003", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "f472e416a713a921f0f38807382c0c01303d37e60f9bfaa51e6d5842610928e2" }, { "id": "SVC-POS-004", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "1c9991f9c5e17bfdbe2713abbed717518de693fb3008b81b24765a1e85b80229" }, { @@ -67,57 +67,57 @@ { "id": "SVC-YTH-014", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "4b8c98000c7d996eee0652ce7adb4ccd6dcb0f972d345468d26a251c7803d3c2" }, { "id": "SVC-YTH-015", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "41054a233a4076783b2e1194d252cfd74fb06ac3110f19fb9c3d2454e714155d" }, { "id": "SVC-DEV-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "52e6ae71184fed9228c6782acf61f7302c03d2e4520b0f5ac178d0fbb8ff66f7" }, { "id": "SVC-PER-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "39a53cc5bb9993919daf97fc4fd945d44368b09baf64de1650d705281f4318ab" }, { "id": "SVC-ED-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "d5d8b50164ac89763661e02df501e576163defe7bcef10129c40e85dd09cd321" }, { "id": "SVC-GEN-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "bd258b687b7bfc3ade71481638334d74c60310ef19bcac9b3026a3cd3351f68d" }, { "id": "SVC-NAV-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "f99f23ab3b11fbbfa55d8e03fe1b787705d685d78b5d5a4dd139d7cbb6b18689" }, { "id": "SVC-REG-006", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "8802bd25383190e0cd108742a4bf63b3bf2c2e0953ac3ddd17b0580054c696aa" }, { @@ -130,50 +130,50 @@ { "id": "SVC-INT-001", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "52e6e926e84cddf8a8792ca9c13ebc1bd78fe48cca137f482fe531c69c6e363c" }, { "id": "SVC-HOU-003", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "c2ce3401f096baf8d3331dd59b3458c30eec9276fe926e21d13a9c14474f6c7b" }, { "id": "SVC-LEG-002", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "0fcd27d58dce06c5649f24435f3b5eae250775b883f5a37727b64f560347ca29" }, { "id": "SVC-YTH-017", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "c618908dd4fb0d5f3af963fc38f7f4c16cd2a83231fd004b14cb2893ac45191d" }, { "id": "SVC-YTH-018", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "43b684990f8c095bbda0246598cf3bea94be9be0bc1d3d9f3fe02209946c3092" }, { "id": "SVC-YTH-019", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "8182c61b9ea0f0733fbc36f9ee37fb5f256e5990b13c34d46248b0701a013cce" }, { "id": "SVC-YTH-023", "status": "reviewed", - "reviewedBy": "PsychSift", - "reviewedAt": "2026-09-26T17:26:07.270Z", + "reviewedBy": "Josh Simpson", + "reviewedAt": "2026-10-16T05:11:29.327Z", "reviewedContentSha256": "90cd1f92e3e6ce771e000ecf6418dfe1eb7d335178c27dd3e2c265408bb9dda5" } ] diff --git a/docs/clinical-hazard-controls.json b/docs/clinical-hazard-controls.json index 57b4e9a597..4b5479dbdf 100644 --- a/docs/clinical-hazard-controls.json +++ b/docs/clinical-hazard-controls.json @@ -165,20 +165,20 @@ "src/components/clinical-dashboard/patient-profile-panel.tsx": "c81ce6a9d80bdc749f9ebfac6bda7578b97f66acf7daaeb8827b4c7b3e6b0628", "src/data/dictionary-source-dispositions.json": "3d03bd0be2d699f5dc7eb50338b535112a7dea57daf0f210de9ae241c606c2b8", "src/lib/answer-render-policy.ts": "a5e2b36c4bdf6c2081d443d10e87c0ced403abfb129454d6989ad93af737f4a9", - "src/lib/answer-verification.ts": "0a340eeec7850282d8cbe50c90dd9a4369bc04bd92057d97005db323321f91ed", + "src/lib/answer-verification.ts": "73e2a66d3b50ae66b415f57366de7f688d098dd9315aeefa38c7e8fd426f8dfc", "src/lib/clinical-safety.ts": "8fa7b5fca92f2b12b6f241d32feadd9310ee075a38e55e10b5bbce4c26c1173b", "src/lib/rag/rag-answer-support.ts": "4250f30017789f6c5d75e84e7a291f163f08abb95d615fb2368e904956841dd5", - "src/lib/rag/rag-claim-support.ts": "866ae98e48a1f5bb9f6599399f362017d4a04d76e0ac5aa8fb8c612488376702", + "src/lib/rag/rag-claim-support.ts": "a945a3aa1166590010404fbae71ac7a3cc1a8ed4036b68164667adea84e21b47", "src/lib/rag/rag-source-block.ts": "984b3f655b468aabbf2d1f489eb6df66273fe7c9e85ea88df63affa986654ad2", "src/lib/service-ranker.ts": "bbdbe3629520a22104194fc727530c05614dfba5528d9b9d8d5743acbfa9ea44", "src/lib/service-urgent-routing.ts": "663b0d131fa4457a4df9875fb200efe1520c9ebda75b552a8bbd68eb66264a7f", "src/lib/source-authority-registry.ts": "e82b2f1aeaf053a321f76576da71a2c54f7fb4db485fbf6c4caf686ac6f2267c", "src/lib/source-governance.ts": "e3e1c09b0a7e446b7055f894088c771f1a5cc160a0f20f026f3cc291af5804fa", - "src/lib/source-text-sanitizer.ts": "c8b2a8b12b365a9558115f6f75d28c22234d1595291f58f1554f46daeace0c61", + "src/lib/source-text-sanitizer.ts": "cb6c869b520a8be03d40bae1206a87b6d53318573baeaec664b35c353fa1bd80", "tests/answer-render-policy.test.ts": "5e48ea66ca1902ac17a271444db7f6350a37c0100fe2152afd042e4fdb89427d", - "tests/answer-verification.test.ts": "6c61453a04d7342b5c80ddb337df76b61f5dfe14e6de363c86348d97e71ccee3", + "tests/answer-verification.test.ts": "2beac1a1f96cb8afae395a51cd5d2a91e8f45ff45723bf3e7641ec85c2605050", "tests/clinical-safety.test.ts": "053b82e3523a5aa55b40059a558e8992fe5342ebedd8812da10193977cad43f6", - "tests/rag-claim-support.test.ts": "0fa88174f11aa1e10588ac92ab11bfcf3185a8e9bec44f047ad5dcd1bc999080", + "tests/rag-claim-support.test.ts": "79f19e142dff92ea92cb3635bd032f081885a1714d1ac745eb3d0f9151247586", "tests/rag-content-accuracy.test.ts": "6aaacb7fb9b43711696ba244a56cd31736fb3a884690774cde4f4db6ee206eb4", "tests/rag-injection.test.ts": "9a6fa43c799232d9e38d334b732c99dfaad5a5192ed64a7fcb8d6cb373300931", "tests/rag-retrieval-row-contract.test.ts": "4da5fe01a76dfa5b4e06e02303f136ff3fb0a1a1219cfe09ec158a1eae074fb6", diff --git a/docs/design-system/ADOPTION.md b/docs/design-system/ADOPTION.md index 1a7ed8b88d..6f08a6b782 100644 --- a/docs/design-system/ADOPTION.md +++ b/docs/design-system/ADOPTION.md @@ -5,8 +5,8 @@ of truth is `adoption-contract.json`; the generated manifest and marked tables i must match it exactly. - **Date:** 12 August 2026 -- **Current state:** 55 visual references are locally registered; all 224 production page routes - are owned across 14 surface families, with 232 route/component roots scanned (the generated +- **Current state:** 55 visual references are locally registered; all 225 production page routes + are owned across 14 surface families, with 233 route/component roots scanned (the generated table below is authoritative if these drift); every declared root uses the v2 shell and has declared proof with no committed visual baseline. - **Phase 1 blockers resolved first, in their own commits:** `#207` ungrounded `AnswerState`, @@ -368,12 +368,12 @@ product exclusions; the only route-only dispositions are the documented legacy-r surfaces. Shared shell/component roots carry their own explicit `shared-shell` disposition. Registered public components: 55 -Declared product roots: 232 +Declared product roots: 233 Roots with a literal `.ckb-v2` opt-in: 1 -Roots inheriting `.ckb-v2` from the global ``: 231 +Roots inheriting `.ckb-v2` from the global ``: 232 Production surfaces observed under v2: 14/14 Dynamic `ckb-v2` constructions: 0 -Declared production page routes: 224/224 +Declared production page routes: 225/225 Source observation and contract declaration are independent. A literal `ckb-v2` on the global `` makes every production surface inherit v2, but it does not approve that adoption. The Proof column summarizes each surface's dark, forced-colours, 320px, print and browser declarations; exact statuses and evidence paths live in the manifest. @@ -382,7 +382,7 @@ Observed v2 under a compatibility declaration fails closed. A declared v2 shell | Surface | Disposition | Routes | Roots | Declared shell | Observed shell (mount) | Proof | Baseline | | ---------------------------------- | --------------- | -----: | ----: | -------------- | -------------------------- | -------------- | -------------- | | `root-shell-and-settings` | shared-shell | 3 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | -| `catalogues-forms-and-info` | owned | 181 | 181 | v2 | v2 (inherited-global-root) | passed | not-committed | +| `catalogues-forms-and-info` | owned | 182 | 182 | v2 | v2 (inherited-global-root) | passed | not-committed | | `differentials` | owned | 7 | 7 | v2 | v2 (inherited-global-root) | passed | not-committed | | `formulation` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | | `specifiers` | owned | 6 | 6 | v2 | v2 (inherited-global-root) | passed | not-committed | diff --git a/docs/design-system/COMPONENTS.md b/docs/design-system/COMPONENTS.md index 596a1bb1d6..0ae4dcd9cd 100644 --- a/docs/design-system/COMPONENTS.md +++ b/docs/design-system/COMPONENTS.md @@ -1102,7 +1102,7 @@ This generated snapshot is a local source-derived inventory. It does not assert | `StageList` | feedback | yes | yes | no | yes | no | 0 | | `StatusMark` | source | yes | yes | inherited-global-root | yes | no | 6 | | `Tabs` | controls | yes | yes | inherited-global-root | yes | no | 3 | -| `TextField` | controls | yes | yes | inherited-global-root | yes | no | 48 | +| `TextField` | controls | yes | yes | inherited-global-root | yes | no | 49 | | `TextLink` | controls | yes | yes | inherited-global-root | yes | no | 3 | | `ToastRegion` | feedback | yes | yes | inherited-global-root | yes | no | 1 | | `ToggleSwitch` | controls | yes | yes | inherited-global-root | yes | no | 2 | diff --git a/docs/design-system/adoption-contract.json b/docs/design-system/adoption-contract.json index bdda51cba3..787513a661 100644 --- a/docs/design-system/adoption-contract.json +++ b/docs/design-system/adoption-contract.json @@ -291,6 +291,7 @@ "src/app/(search-app)/teaching/assessments/export/page.tsx", "src/app/(search-app)/teaching/assessments/help/page.tsx", "src/app/(search-app)/teaching/assessments/record/page.tsx", + "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/[id]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/page.tsx", "src/app/(search-app)/my-day/favourites/page.tsx", diff --git a/docs/design-system/adoption-manifest.json b/docs/design-system/adoption-manifest.json index 0066f08c11..6b88b8b705 100644 --- a/docs/design-system/adoption-manifest.json +++ b/docs/design-system/adoption-manifest.json @@ -2873,6 +2873,7 @@ "src/components/admin/renewals/record-dates-sheet.tsx", "src/components/admin/starter/starter-date-sheet.tsx", "src/components/alerts/remind-me-sheet.tsx", + "src/components/calculators/clinical-math-panel.tsx", "src/components/clinical-dashboard/email-auth-form.tsx", "src/components/clinical-dashboard/password-recovery-form.tsx", "src/components/clinical-dashboard/patient-profile-panel.tsx", @@ -2924,6 +2925,7 @@ "src/components/admin/renewals/record-dates-sheet.tsx", "src/components/admin/starter/starter-date-sheet.tsx", "src/components/alerts/remind-me-sheet.tsx", + "src/components/calculators/clinical-math-panel.tsx", "src/components/clinical-dashboard/email-auth-form.tsx", "src/components/clinical-dashboard/password-recovery-form.tsx", "src/components/clinical-dashboard/patient-profile-panel.tsx", @@ -3442,6 +3444,7 @@ "src/app/(search-app)/teaching/assessments/help/page.tsx", "src/app/(search-app)/teaching/assessments/page.tsx", "src/app/(search-app)/teaching/assessments/record/page.tsx", + "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/[id]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/page.tsx", "src/app/(search-app)/teaching/c/[token]/page.tsx", @@ -5102,6 +5105,16 @@ "v2MountMode": "inherited-global-root", "sanctionedPatternsPresent": [] }, + { + "file": "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", + "exists": true, + "imports": [], + "importedFamilies": [], + "literalCkbV2": false, + "dynamicCkbV2": false, + "v2MountMode": "inherited-global-root", + "sanctionedPatternsPresent": [] + }, { "file": "src/app/(search-app)/teaching/assessments/trainee/[id]/page.tsx", "exists": true, @@ -6559,6 +6572,7 @@ "src/app/(search-app)/teaching/assessments/help/page.tsx", "src/app/(search-app)/teaching/assessments/page.tsx", "src/app/(search-app)/teaching/assessments/record/page.tsx", + "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/[id]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/page.tsx", "src/app/(search-app)/teaching/c/[token]/page.tsx", @@ -6785,6 +6799,7 @@ "src/app/(search-app)/teaching/assessments/help/page.tsx", "src/app/(search-app)/teaching/assessments/page.tsx", "src/app/(search-app)/teaching/assessments/record/page.tsx", + "src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/[id]/page.tsx", "src/app/(search-app)/teaching/assessments/trainee/page.tsx", "src/app/(search-app)/teaching/c/[token]/page.tsx", @@ -6826,7 +6841,7 @@ }, "adoption": { "literalCkbV2RootCount": 1, - "inheritedCkbV2RootCount": 231, + "inheritedCkbV2RootCount": 232, "dynamicCkbV2RootCount": 0, "v2MountedSurfaceCount": 14, "declaredV2SurfaceCount": 14 @@ -6835,8 +6850,8 @@ "registeredComponentCount": 55, "previewCount": 55, "productImportedComponentCount": 48, - "rootCount": 232, - "productionRouteCount": 224, - "nextUiEntryCount": 344 + "rootCount": 233, + "productionRouteCount": 225, + "nextUiEntryCount": 345 } } diff --git a/docs/evidence/forms-operational-guidance-review.md b/docs/evidence/forms-operational-guidance-review.md index 11841022cc..4418d85118 100644 --- a/docs/evidence/forms-operational-guidance-review.md +++ b/docs/evidence/forms-operational-guidance-review.md @@ -30,7 +30,7 @@ Official register: (1)A child is presumed to not have the capacity to make a treatment decision. +> +> (2)A child has the capacity to make a treatment decision if the child has sufficient maturity and understanding to make the decision having regard to the criteria set out in section 15. + +**Drafted summary** (status: reviewed) + +> A child (a person under 18 years of age) is presumed to not have capacity to make a treatment decision unless the child has sufficient maturity and understanding to make the decision having regard to the criteria in s 15. + +Cited by: _none_ + +Source text SHA-256: `a8faee7535560b29ff6d4a67e23114d7b2354c4ff5aa3bcebafe4d8f58b0f49f` + +Reviewed by: ______________________ Date: ______________ + +--- + ### s25 — Criteria for involuntary treatment order **Act text (02-b0-02, as at 2025-09-25)** @@ -64,7 +84,7 @@ sign-off via `npm run clinical:review`. > > Subdivision 1 — Person suspected of needing involuntary treatment order -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A person needs an inpatient treatment order only if all five criteria are met: (a) a mental illness for which they need treatment; (b) because of that illness, a significant risk to the health or safety of the person or to the safety of another person, or a significant risk of serious harm to the person or another person; (c) they do not demonstrate the capacity required by s 18 to make a treatment decision about that treatment; (d) treatment in the community cannot reasonably be provided; and (e) they cannot be adequately treated in a way that is less restrictive of their freedom of choice and movement than an inpatient treatment order. A community treatment order requires the same illness and capacity criteria. Its risk criterion also includes a significant risk of the person suffering serious physical or mental deterioration, and it requires that treatment in the community can reasonably be provided and that the person cannot be adequately treated in a less restrictive way than a community treatment order. Either decision must be made having regard to the guidelines published under s 547(1)(a). @@ -106,7 +126,7 @@ Reviewed by: ______________________ Date: ______________ > > 3.Part 7 Division 5 applies if a person who is detained under section 28(1) or (2), 52(1)(b) or 58(1)(b) is absent without leave from the authorised hospital or other place where the person is be detained. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may refer a person for examination by a psychiatrist if, having regard to the section 25 criteria, they reasonably suspect the person needs an involuntary treatment order — or, for someone already under a community treatment order, an inpatient treatment order. The examination may be at an authorised hospital, or at another place the practitioner considers appropriate under the s 547(1)(b) guidelines, in which case the practitioner must make the arrangements needed for it to happen there. @@ -172,7 +192,7 @@ Reviewed by: ______________________ Date: ______________ > > (12)The release of a person because of subsection (10) or (11) is an event to which Part 9 applies and a medical practitioner or authorised mental health practitioner is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may order detention for up to 24 hours to enable a referred person to be taken to the examination place, and may renew it for further 24-hour blocks — but only after personally assessing the person again and remaining satisfied detention is still needed. Total continuous detention is capped at 72 hours if the referral was made in the metropolitan area, or 144 hours outside it. The order is in the approved form with times made and expiring, reasons and the practitioner's details, is filed with a copy to the person, and is a Part 9 notifiable event. The person must be given the opportunity and means to contact a support person, their treating health professional and the Chief Mental Health Advocate. Detention ends if the person has not been taken to the place and no valid further order or transport-order apprehension applies, or if the referral expires first. @@ -200,7 +220,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The making of a transport order under subsection (1) is an event to which Part 9 applies and the practitioner who makes the order is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may make a transport order for a referred person, but only if satisfied the person needs to be taken to the examination place and no other safe means of taking them is reasonably available. Part 10 governs how the order is carried out, and making it is a Part 9 notifiable event. @@ -250,7 +270,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 2 — Voluntary inpatient admitted by authorised hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may revoke a s 26 referral if satisfied the person no longer needs an involuntary treatment order. Revoking another practitioner's referral requires consulting them, or documented reasonable efforts to make contact. The order records the time, the reasons, and the consultation or the attempts, and is filed with a copy to the person. The practitioner must also tell the transport or police officer carrying out any transport order — which is revoked with the referral under s 153 — and file a record of that advice. Detention cannot continue once the referral is revoked, and the release is a Part 9 notifiable event. @@ -298,7 +318,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)the assessment has been completed but a referral has not been made under section 36(2) in respect of the voluntary inpatient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a voluntary inpatient wants to leave against medical advice and the person in charge of the ward reasonably suspects, on the section 25 criteria, that they need an involuntary treatment order, that person may order an assessment by an MP or AMHP at the hospital. The inpatient can be detained for up to 6 hours to allow it. The order is in the approved form and is filed with a copy to the patient, and the inpatient must be given the opportunity and means to contact a support person, their treating health professional and the Chief Mental Health Advocate. Detention ends at 6 hours if the assessment is not completed, or is completed without a s 36(2) referral being made. @@ -328,7 +348,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The voluntary inpatient cannot continue to be detained if the order for an assessment is revoked under subsection (1). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person who ordered a s 34 assessment may revoke that order at any time before the assessment starts, if satisfied the patient no longer needs an involuntary treatment order. The revocation is in the approved form and is filed with a copy to the patient, and detention cannot continue once it is made. @@ -362,7 +382,7 @@ Reviewed by: ______________________ Date: ______________ > > 3.Part 7 Division 5 applies if a voluntary patient who is detained under section 53(1) is absent without leave from the authorised hospital where the voluntary patient is detained. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For a voluntary inpatient assessed either under a s 34 order or in the course of their treatment, an MP or AMHP may refer them for psychiatrist examination at that hospital if, having regard to the section 25 criteria, they reasonably suspect the inpatient needs an involuntary treatment order. @@ -404,7 +424,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 3 — Requirements for referral -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may revoke a s 36 referral if satisfied the voluntary inpatient no longer needs an involuntary treatment order. Revoking another practitioner's referral requires consulting them, or documented reasonable efforts to make contact. The order records the time, the reasons and that consultation or those attempts, and is filed with a copy to the patient. Detention cannot continue once the referral is revoked. @@ -452,7 +472,7 @@ Reviewed by: ______________________ Date: ______________ > > (e)include the name, qualifications and signature of the practitioner making the referral. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A referral must be in the approved form and must state when and where it was made, when it expires, whether and how it can be extended under s 45, where the examination will be conducted, and when the s 39(1) assessment was completed. It must certify the practitioner's reasonable suspicion against the section 25 criteria, set out the information that suspicion rests on, and — for information gathered in their own assessment — distinguish what came from the person themselves from what came from someone else or the medical record. @@ -474,7 +494,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The information provided under subsection (1) must be in the approved form. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The practitioner must give the referred person the referral information required by s 41(a) and (b), and the s 41(c) grounds, in the approved form. The exception is any part of those grounds supplied by someone else on condition that it not be passed on to the person. @@ -534,7 +554,7 @@ Reviewed by: ______________________ Date: ______________ > > (6)The referral cannot be extended more than once. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a referral was made outside the metropolitan area and the person responsible for transporting the patient forms the view it will expire before arrival, an extension of a further 72 hours may be obtained. The request goes to the referring practitioner, or if they are unavailable another practitioner at the same place, or failing that any other MP or AMHP; the transporting person may extend it themselves only if no practitioner is reasonably available and they are themselves an MP or AMHP. The extension is recorded in the approved form with the time granted, the new expiry and the reasons, and filed with a copy to the person. A referral cannot be extended more than once. @@ -576,7 +596,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 4 — Conduct of assessment -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may change the place specified in a s 26 referral where the examination will be conducted, but only after consulting a practitioner at the proposed new place. They must promptly tell whoever is transporting the person, record the change in the approved form with the old and new places and the time, and file it with a copy to the person. Changing between an authorised hospital and a non-hospital place switches which limb of s 26 the referral is treated as having been made under. @@ -632,7 +652,7 @@ Reviewed by: ______________________ Date: ______________ > > 4.A community treatment order in respect of an involuntary community patient who is referred under section 26(2) is no longer suspended if a psychiatrist makes an order under section 55(1)(d) that the involuntary community patient cannot continue to be detained (see section 30(b)(i)). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > On completing the examination the psychiatrist must make one of four orders: an inpatient treatment order detaining the person at the authorised hospital for a s 87 period; a community treatment order; an order continuing detention to allow a further psychiatrist examination; or an order that the person cannot continue to be detained. The order is in the approved form with the time, the reasons (except for a release order) and the psychiatrist's details, and is filed with a copy to the person. A continuation order runs only to the period specified, which cannot exceed 72 hours from reception or detention at the hospital, and cannot be extended. Making the order is a Part 9 notifiable event. @@ -678,7 +698,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 2 — Examination at place that is not authorised hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An order continuing detention under s 55(1)(c) lasts until whichever comes first: a psychiatrist completes the further examination and makes an inpatient treatment order, a community treatment order, or an order that detention cannot continue; or the period specified under s 55(3) expires. The resulting order is in the approved form with the time, the reasons (except for a release order) and the psychiatrist's details, and is filed with a copy to the person. @@ -726,7 +746,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)the examination has been completed but an order has not been made under section 61(1) in respect of the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where the examination place is outside the metropolitan area and it is not practicable to finish the examination within the 24 hours allowed by s 58(1)(b), an MP or AMHP at that place may order detention to continue for up to a further 48 hours so it can be completed. The order is in the approved form with the times made and expiring, the reasons and the practitioner's details, and is filed with a copy to the person. The person must be given the opportunity and means to contact a support person, their treating health professional and the Chief Mental Health Advocate. Detention ends at the 48 hours if the examination is unfinished, or is finished without a s 61(1) order. @@ -780,7 +800,7 @@ Reviewed by: ______________________ Date: ______________ > > 4.A community treatment order in respect of a person who is referred under section 26(3)(a) is no longer suspended if a psychiatrist makes an order under section 61(1)(d) that the involuntary community patient cannot continue to be detained (see section 30(b)(i)). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > On completing an examination at a place that is not an authorised hospital, the psychiatrist must make one of four orders: an inpatient treatment order detaining the person at a specified general hospital; a community treatment order; an order for reception and detention at an authorised hospital for a psychiatrist examination; or an order that the person cannot continue to be detained. A general-hospital inpatient treatment order is available only where taking or detaining the person at an authorised hospital would pose a significant risk to their physical health, and only with the Chief Psychiatrist's consent. The order is in the approved form and is filed with a copy to the person, and making it is a Part 9 notifiable event. @@ -836,7 +856,7 @@ Reviewed by: ______________________ Date: ______________ > > (c)an order under subsection (2) authorising the continuation of the person’s detention from the end of that period has not been made or, because of subsection (3), cannot be made. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An MP or AMHP may order detention to continue for up to 24 hours so a person under a s 61(1)(a) or (c) order can be taken to the hospital, and may renew it in further 24-hour blocks — but only after assessing the person immediately beforehand and remaining satisfied detention is still needed. Total continuous detention under this section cannot exceed 72 hours. The order is in the approved form with the times made and expiring, the reasons and the practitioner's details, is filed with a copy to the person, and the person must be given the opportunity and means to contact a support person, their treating health professional and the Chief Mental Health Advocate. Detention ends if the person has not reached the hospital, has not been apprehended under a s 63 transport order, and no valid further order applies. @@ -864,7 +884,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 3 — Inpatient treatment order authorising detention at general hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may make a transport order for a person under a s 61(1)(a) or (c) order, but only if satisfied the person needs to be taken to the hospital named in that order and no other safe means of taking them is reasonably available. Part 10 governs how the order is carried out. @@ -890,7 +910,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)The report must be in the approved form. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > At the end of each successive 7-day period an involuntary inpatient is detained at a general hospital, the treating psychiatrist must report to the Chief Psychiatrist in the approved form on the inpatient's mental and physical condition, any treatment being provided at the general hospital, and any other medical or surgical treatment being provided there. @@ -932,7 +952,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)The making of a transfer order under subsection (1) is an event to which Part 9 applies and the treating psychiatrist is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Once the treating psychiatrist is satisfied that taking or detaining the involuntary inpatient at an authorised hospital no longer poses a significant risk to their physical health, the psychiatrist must, as soon as practicable, make a transfer order to the authorised hospital named in it. In deciding whether the risk remains, they may consult any other practitioner or health care provider responsible for the inpatient's medical or surgical treatment. The order is in the approved form and must include the inpatient's name, the hospital transferred from and to, the time made, the reasons and the psychiatrist's details. It is filed with a copy to the patient, and making it is a Part 9 notifiable event. @@ -954,7 +974,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)Part 10 applies in relation to the transport order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may make a transport order for an inpatient under a s 66(1) transfer order, but only if satisfied no other safe means of taking them to the authorised hospital is reasonably available. Part 10 governs how the order is carried out. @@ -996,7 +1016,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 4 — Order for further examination at authorised hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where the examination for an inpatient treatment order was conducted without the psychiatrist and inpatient being in each other's physical presence, and no in-person psychiatrist examination has happened since, the order must be confirmed by a psychiatrist at the authorised hospital within 24 hours of admission under the transfer order. Confirmation requires examining the inpatient, and is recorded in the approved form with the time, the reasons and the psychiatrist's details. The inpatient treatment order ceases to be in force if it is not confirmed in time, and that release is a Part 9 notifiable event. @@ -1038,7 +1058,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 5 — Examination without referral -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > On completing the examination the psychiatrist must make one of three orders: an inpatient treatment order detaining the person at the authorised hospital for a s 87 period; a community treatment order; or an order that the person cannot continue to be detained. The order is in the approved form with the time, the reasons (except for a release order) and the psychiatrist's details, and is filed with a copy to the person. @@ -1066,7 +1086,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The psychiatrist must, as soon as practicable, file the order and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > On completing an examination conducted without a referral, the psychiatrist may make a community treatment order. It must be in the approved form with the time made, the reasons and the psychiatrist's details, and is filed with a copy to the person. @@ -1110,7 +1130,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 6 — Conduct of examination -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A community treatment order must be confirmed within 72 hours of being made — by another psychiatrist, or if none is reasonably available by another medical practitioner or an authorised mental health practitioner. The confirmation is in the approved form with the time, the reasons and the confirming practitioner's details. The supervising psychiatrist must tell the person whether it was confirmed and, if it was, file it and give them a copy. The order ceases to be in force if it is not confirmed in time. @@ -1154,7 +1174,7 @@ Reviewed by: ______________________ Date: ______________ > > (6)The release of a person because of an order made under subsection (2)(b) or (c) is an event to which Part 9 applies and the person in charge of the hospital is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The treating psychiatrist must ensure the involuntary inpatient is examined by a psychiatrist on, or within 7 days before, the day the detention period ends. On completing that examination the psychiatrist must make one of three orders on the section 25 criteria: a continuation order extending the inpatient treatment order for a further detention period; a community treatment order, if an involuntary treatment order is still needed but not as an inpatient; or an order revoking the inpatient treatment order. A further detention period cannot exceed 3 months for an adult or 28 days for a child. The order is in the approved form and is filed with a copy to the inpatient; a release under (2)(b) or (c) is a Part 9 notifiable event. @@ -1190,7 +1210,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)The making of an order under subsection (1) is an event to which Part 9 applies and the psychiatrist who makes the order is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > During the detention period a psychiatrist may, on the section 25 criteria, make a community treatment order where the inpatient no longer needs the inpatient treatment order but still needs an involuntary treatment order, or revoke the inpatient treatment order where no involuntary treatment order is needed at all. Either order may be made without examining the inpatient. It is in the approved form and is filed with a copy to the inpatient, and making it is a Part 9 notifiable event. @@ -1236,7 +1256,7 @@ Reviewed by: ______________________ Date: ______________ > > Section 66 applies in relation to the transfer of an involuntary inpatient from a general hospital to an authorised hospital. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For an involuntary inpatient detained at an authorised hospital, the treating psychiatrist — or another psychiatrist at that hospital if the treating psychiatrist is not reasonably available — may make a transfer order to another authorised hospital named in it. The order is in the approved form and must include the inpatient's name, the hospital transferred from and to, the time made, the reasons and the psychiatrist's details. It is filed with a copy to the inpatient, and making it is a Part 9 notifiable event. Transfers from a general hospital instead run under s 66. @@ -1258,7 +1278,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)Part 10 applies in relation to the transport order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may make a transport order for an inpatient under a s 91(2) transfer order, but only if satisfied no other safe means of taking them to the authorised hospital is reasonably available. Part 10 governs how the order is carried out. @@ -1298,7 +1318,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)A person who makes an apprehension and return order must, as soon as practicable, file it and give a copy to the police officer or person prescribed who will carry out the order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person in charge of a hospital or other place, or a medical practitioner, may make an apprehension and return order for someone absent without leave, but only if satisfied no other safe means of ensuring their return is reasonably available. The order is in the approved form and must name the person, the place they are absent from, the place they must be taken to if apprehended, the date made, the date it expires, the reasons and the maker's details. It is filed as soon as practicable with a copy to the police officer or prescribed person who will carry it out. @@ -1334,7 +1354,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)file the order and a record of the advice. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person in charge of the place the patient is absent from, or a medical practitioner, may revoke an apprehension and return order if satisfied it is no longer needed. The revocation is in the approved form with the time, the reasons and the maker's details. They must promptly tell the police officer or prescribed person responsible for carrying out the original order, and file both the revocation and a record of that advice. @@ -1426,7 +1446,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 105 amended: No. 10 of 2023 s. 357.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may grant an involuntary inpatient leave of absence if satisfied it is likely to benefit their recovery or mental health, or will let them obtain medical or surgical treatment or otherwise benefit their physical health, and that it is not inconsistent with their need for treatment under s 25(1)(b). Before granting it the psychiatrist must consult, on both whether to grant leave and its period and conditions, any enduring guardian or guardian, a child's parent or guardian, any nominated person, any carer and any close family member (subject to the Act's entitlement exceptions), and the Mental Impairment Review Tribunal for a supervised person; the consultation or the efforts made must be filed. The psychiatrist must also consider whether a s 90(1) order would be more appropriate. Conditions may cover residing at a specified place, receiving specified treatment, or attending and remaining at a specified place for treatment. The order is in the approved form with the time, the period and conditions, the reasons and the psychiatrist's details, is filed with a copy to the inpatient, and making it is a Part 9 notifiable event. @@ -1462,7 +1482,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The making of an order under subsection (1) is an event to which Part 9 applies and the psychiatrist who makes the order is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may extend an involuntary inpatient's leave of absence or vary the conditions it was granted subject to. The order is in the approved form with the time made, the period of the extension or the variation, the reasons and the psychiatrist's details. It is filed with a copy to the inpatient, and making it is a Part 9 notifiable event. @@ -1500,7 +1520,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 3 — Transport to and from hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a psychiatrist forms the reasonable belief that it is inappropriate for an involuntary inpatient to remain away from hospital on leave of absence, the psychiatrist may order the leave cancelled. The order is in the approved form with the time made, the reasons for that belief and the psychiatrist's details. The psychiatrist must, as soon as practicable, tell the patient orally that the leave has been cancelled, and file the order with a copy to the inpatient. Making it is a Part 9 notifiable event. @@ -1534,7 +1554,7 @@ Reviewed by: ______________________ Date: ______________ > > Preliminary matters -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may make a transport order for the involuntary inpatient, but only if satisfied no other safe means of taking them to the hospital is reasonably available. Part 10 governs how the order is carried out. @@ -1564,7 +1584,7 @@ Reviewed by: ______________________ Date: ______________ > > The supervising psychiatrist can also be the treating practitioner (see section 136(2)(b)). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist cannot make a community treatment order unless satisfied of two things: that treating the person in the community would not be inconsistent with their need for treatment for a reason in s 25(2)(b); and that suitable arrangements can be made for their treatment and care in the community, including a psychiatrist to be the supervising psychiatrist and a medical practitioner or mental health practitioner to be the treating practitioner. The supervising psychiatrist can also be the treating practitioner (s 136(2)(b)). @@ -1616,7 +1636,7 @@ Reviewed by: ______________________ Date: ______________ > > Operation of order -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A community treatment order must name the supervising psychiatrist and the treating practitioner; require the patient to comply with all of the supervising psychiatrist's directions about treatment under the order; record the date and time it is made and the date and time it comes into force, which the Act says “must be within 7 days after the date and time when the order is made”; state its treatment period; and require the patient to notify the supervising psychiatrist or treating practitioner of any change of residential address and of any interstate or overseas travel — “at least 7 days before the day of the patient’s departure”, or as soon as practicable if the travel is urgent. The treatment period specified when the order is made “cannot exceed 3 months from the day on which it is made”. The terms may require treatment by a mental health service in another State or a Territory (s 559). @@ -1648,7 +1668,7 @@ Reviewed by: ______________________ Date: ______________ > > 2.A community treatment order may be suspended under section 30 or 33. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A community treatment order stays in force until the first of these happens: the supervising psychiatrist makes an inpatient treatment order under s 120(2)(a), 123(1)(a) or 131(2)(a); any psychiatrist makes an inpatient treatment order under another provision of the Act; the supervising psychiatrist revokes it under s 120(2)(b) or 131(2)(b); or its treatment period expires, unless it has been continued under a continuation order. A community treatment order may also be suspended under s 30 or 33. @@ -1700,7 +1720,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)each report of an examination of the involuntary community patient provided to the supervising psychiatrist under subsection (5). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An involuntary community patient must be examined on, or within 14 days before, the day each monthly review period ends — by the supervising psychiatrist, or by another medical practitioner or mental health practitioner if the supervising psychiatrist is unavailable or has requested it under s 119(1). Another practitioner cannot conduct that examination if more than 2 months have passed since the supervising psychiatrist last examined the patient. A practitioner examining in the supervising psychiatrist's place must provide a written report recommending whether, on the section 25 criteria, the patient still needs an involuntary treatment order. The supervising psychiatrist must file a record of each examination they conduct and each report they receive. @@ -1720,7 +1740,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)The request must be in the approved form and may specify requirements for carrying out the examination or preparing the report or both. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist may request another medical practitioner or mental health practitioner to examine the involuntary community patient for the purposes of s 118(2)(b)(ii). The request must be in the approved form and may specify requirements for carrying out the examination, preparing the report, or both. @@ -1772,7 +1792,7 @@ Reviewed by: ______________________ Date: ______________ > > A community treatment order is automatically revoked under section 116(a) if a psychiatrist makes an inpatient treatment order under section 120(2)(a), or under section 116(b) if a psychiatrist makes an inpatient treatment order under any other provision of this Act, in respect of the involuntary community patient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > After examining the involuntary community patient, or on receiving a report under s 118(5), the supervising psychiatrist must consider whether the patient still needs an involuntary treatment order. They may make an inpatient treatment order where the patient still needs an involuntary treatment order but the s 114 community criteria are not met, or an order revoking the community treatment order where no involuntary treatment order is needed. An inpatient treatment order requires examining the patient; a revocation may be made either after examination or on the basis of a s 118(5) report alone. The order is in the approved form and is filed with a copy to the patient, and making it is a Part 9 notifiable event. @@ -1826,7 +1846,7 @@ Reviewed by: ______________________ Date: ______________ > > (8)Subsection (7) does not apply if the further opinion is not obtained within the 14-day period referred to in subsection (7)(a) because the involuntary community patient did not attend an examination to be conducted by the psychiatrist responsible for giving the further opinion. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist may, on or within 7 days before a treatment period ends, make a continuation order extending the community treatment order for a further period of up to 3 months. They cannot do so without examining the patient. The order is in the approved form with the date made, the period continued, the new expiry date, the reasons and the psychiatrist's details, and is filed with a copy to the patient. The patient may request in writing that a further opinion be obtained from another psychiatrist on whether continuing the order was appropriate — though not on the length of the period. The continuation order does not come into force, or ceases to be in force, if that opinion is not obtained within 14 days of the request or does not confirm the continuation; that does not apply where the delay was because the patient did not attend the examination. @@ -1856,7 +1876,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The supervising psychiatrist must, as soon as practicable, file the order and give a copy to the involuntary community patient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist may at any time while a community treatment order is in force vary its terms in any way consistent with s 115 that they consider appropriate. The variation is in the approved form with the time made, the variation itself, the reasons and the psychiatrist's details, and is filed with a copy to the patient. @@ -1922,7 +1942,7 @@ Reviewed by: ______________________ Date: ______________ > > A community treatment order is automatically revoked under section 116(a) if a psychiatrist makes an inpatient treatment order under section 123(1)(a) in respect of the involuntary community patient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist may at any time while a community treatment order is in force make an inpatient treatment order, if satisfied on the s 25(1) criteria that the patient needs one, or revoke the community treatment order, if satisfied on the section 25 criteria that no involuntary treatment order is needed. An inpatient treatment order requires examining the patient; a revocation may be made without examination provided the psychiatrist has regard to information from the patient, from any other person, and from the medical record. None of this depends on the patient having breached the order, been given a breach notice, or been made subject to an order to attend. The order is in the approved form and is filed with a copy to the patient, and making it is a Part 9 notifiable event. @@ -1964,7 +1984,7 @@ Reviewed by: ______________________ Date: ______________ > > (7)The release of a person because of subsection (6) is an event to which Part 9 applies and the person in charge of the authorised hospital is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where the supervising psychiatrist made an inpatient treatment order under s 120(2)(a) or 123(1)(a) without being in the patient's physical presence for the examination, and no in-person psychiatrist examination has happened since, the order must be confirmed by a psychiatrist at the authorised hospital within 24 hours of admission. Confirmation requires examining the patient, and is recorded in the approved form with the time, the reasons and the psychiatrist's details. The order ceases to be in force if it is not confirmed in time, and that release is a Part 9 notifiable event. @@ -2014,7 +2034,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 127 amended: No. 10 of 2023 s. 358.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > If an involuntary community patient breaches a community treatment order the supervising psychiatrist must record the breach, give the patient notice of it, and notify the Mental Impairment Review Tribunal for a supervised person. The record of breach is in the approved form and must set out the non-compliance, the steps taken to obtain compliance, a statement of the s 126(c) belief, and the facts and reasons behind it. The notice of breach must set out the non-compliance, what the patient must do to comply, and a statement that continued non-compliance may result in being required to attend a place for treatment. Both must be filed as soon as practicable. @@ -2054,7 +2074,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)The supervising psychiatrist must, as soon as practicable, file the order to attend and give a copy to the involuntary community patient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where the patient has been given a breach notice and the supervising psychiatrist is not satisfied they are complying, the psychiatrist may make an order to attend requiring the patient to attend a specified time and place to be provided with treatment. The order must warn that non-compliance may result in a transport order authorising apprehension and transport to that place. It is in the approved form with the time made, the reasons, the time and place to attend, the warning and the psychiatrist's details, and is filed with a copy to the patient. @@ -2080,7 +2100,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)The making of a transport order under subsection (2) is an event to which Part 9 applies and the practitioner who makes the order is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where an involuntary community patient does not comply with an order to attend, a medical practitioner or mental health practitioner may make a transport order for them, but only if satisfied no other safe means of ensuring they attend the place is reasonably available. Part 10 governs how the order is carried out, and making it is a Part 9 notifiable event. @@ -2158,7 +2178,7 @@ Reviewed by: ______________________ Date: ______________ > > Transport to hospital -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a patient is in breach of a community treatment order, has been given notice of the breach, and has since either continued not complying or failed to comply with an order to attend, the supervising psychiatrist may make an inpatient treatment order — if satisfied on the section 25 criteria that an involuntary treatment order is still needed but the s 114 community criteria are not met — or revoke the community treatment order if no involuntary treatment order is needed. An inpatient treatment order requires examining the patient, and detention at a general hospital additionally requires that an authorised hospital would pose a significant risk to physical health and that the Chief Psychiatrist consents. A revocation may be made without examination, having regard to clinical observation, other people and the medical record. The order is in the approved form and is filed with a copy to the patient, and making it is a Part 9 notifiable event. @@ -2190,7 +2210,7 @@ Reviewed by: ______________________ Date: ______________ > > Supervising psychiatrist and treating practitioner -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner may make a transport order for the involuntary community patient, but only if satisfied the patient needs to be taken to the hospital and no other safe means of taking them is reasonably available. Part 10 governs how the order is carried out. @@ -2226,7 +2246,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)An authorisation under subsection (3) has effect for the period specified in the authorisation. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist under a community treatment order may, by arrangement, transfer that responsibility to another psychiatrist, and must then inform the patient in writing. The Chief Psychiatrist, or a person authorised in writing by them, may also transfer the responsibility by arrangement and must likewise inform the patient in writing. An authorisation may cover all or any patients treated by a specified mental health service or residing in a specified area, and has effect for the period it specifies. @@ -2260,7 +2280,7 @@ Reviewed by: ______________________ Date: ______________ > > Preliminary matters -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The supervising psychiatrist under a community treatment order may, by arrangement, transfer the treating practitioner's responsibility to another practitioner, and must then inform the involuntary community patient in writing of the transfer. @@ -2280,7 +2300,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)However, the entitlement of a carer, close family member or other personal support person to be notified under subsection (1) is subject to section 142. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Any carer, close family member or other personal support person of a person is entitled to be notified, “as soon as practicable”, that a notifiable event has occurred for that person. The entitlement is subject to the best-interests exceptions in s 142. @@ -2304,7 +2324,7 @@ Reviewed by: ______________________ Date: ______________ > > Any notification provided under section 140(1) must be provided in accordance with section 9(2). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person responsible under Part 9 for notifying a notifiable event must ensure that any carer, close family member or other personal support person of the person is notified “as soon as practicable after the event occurs”. They need not notify someone who is not entitled to be notified for a reason in s 142(1) or (2). The notification must be given in accordance with s 9(2). @@ -2332,7 +2352,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)if no carer, close family member or other personal support person has been notified under section 140(1) of the notifiable event — a record of the reasons for that and any efforts made to do so. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The duty to notify under s 140(1) is taken to be met if reasonable efforts to notify continue until at least one carer, close family member or other personal support person has been notified, or until it is reasonable to conclude that none can be. The person responsible must file either a record of when and how each was notified or, if nobody was notified, a record of the reasons and of the efforts made. @@ -2362,7 +2382,7 @@ Reviewed by: ______________________ Date: ______________ > > For the purpose of deciding under section 142(1) or (2) what is or is not in the best interests of a person, Part 2 Division 3 applies. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A carer, close family member or other personal support person is not entitled to be notified of a detention order under s 28(1) or (2), or a transport order under s 29(1), if the medical practitioner or authorised mental health practitioner who made the order reasonably believes notifying them is not in the person's best interests. For any other notifiable event, they are not entitled to be notified if a psychiatrist believes it is not in the person's best interests. A practitioner or psychiatrist who decides this must, as soon as practicable, file a record of the decision and the reasons and give a copy to the Chief Mental Health Advocate. Best interests are decided under Part 2 Division 3. @@ -2396,7 +2416,7 @@ Reviewed by: ______________________ Date: ______________ > > Any advice provided under section 143(1)(a) or (3)(a) must be provided in accordance with section 9(2). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > If a carer, close family member or other personal support person who is not entitled to notification under s 142 asks to be notified of the event, the practitioner or psychiatrist who made that decision must advise them of the decision and the reasons, file a record of that advice, and give a copy to the person the event concerns. If the advice was given orally, the carer, family member or support person may ask for it to be confirmed in writing; the practitioner or psychiatrist must do so, file a copy and give another copy to the person. The advice must be given in accordance with s 9(2). @@ -2460,7 +2480,7 @@ Reviewed by: ______________________ Date: ______________ > > [Heading inserted: No. 10 of 2023 s. 360.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > When an involuntary treatment order is made, the person responsible for notification must ensure, as soon as practicable, that the Chief Mental Health Advocate, the Mental Health Tribunal and, if the patient is a supervised person, the Mental Impairment Review Tribunal are each given a copy of the order, together with the name and contact details of any carer, close family member or other personal support person notified under s 140(1) (so far as known) or, if none was notified, advice of that and the reasons. The same people and bodies must be given a copy of any order revoking an involuntary treatment order, and advised in writing when one expires. Records must be filed of who was given each copy, advice or piece of information, what was provided, and the date. @@ -2504,7 +2524,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)give a copy to the transport officer or police officer responsible for carrying out the order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A transport order must be in the approved form and must name the person to be transported, the place they are transported from and the hospital or place they must be taken to, the reasons why the order is necessary to get them there, and whether it is to be carried out by a transport officer or — where s 149(2) applies — a police officer, with reasons why a transport officer cannot do so. It must also state the time it is made, the time it expires under s 150(2), whether and how it can be extended, and the maker's name, qualifications and signature. It must be filed as soon as practicable with a copy to the person and a copy to the officer carrying it out. @@ -2550,7 +2570,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)The transport order cannot be extended more than once. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a transport order made under s 63, 67, 92, 112, 129 or 133 is being carried out from a place outside the metropolitan area and the officer transporting the person forms the view it will expire before arrival, they may orally request an extension from a medical practitioner or mental health practitioner. The practitioner may orally make an extension order for a further period of up to 72 hours. They must then record it in the approved form with the time made and the new expiry, and file it with a copy to the officer. A transport order cannot be extended more than once. @@ -2586,7 +2606,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)give a copy to the transport officer or police officer responsible for carrying out the transport order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner may revoke a transport order if satisfied it is no longer needed. The revocation order is in the approved form with the time made, the reasons and the practitioner's details. It must be filed as soon as practicable with a copy to the person and a copy to the transport or police officer responsible for carrying out the transport order. @@ -2628,7 +2648,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The person to whom the record of the search is given under subsection (1)(b)(i), (ii) or (iv) must ensure that, as soon as practicable, the record is filed and a copy given to the person searched. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Anyone conducting a search under s 159(2)(b) or 162(2)(a) must record it as soon as practicable and give the record to the person in charge of the service or place the person is taken to or received at, the practitioner into whose care they are delivered, the person searched if they are released without being taken anywhere, or the person in charge of the place where the search happened. The record is in the approved form and must state when the search was conducted, the reasons for it, any article seized in the course of it, and the name, sex, qualifications and signature of the person who conducted it. Whoever receives the record must ensure it is filed and a copy given to the person searched. @@ -2678,7 +2698,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)A person to whom a record is given under subsection (4)(b)(i) or (ii) must ensure that the record is filed as soon as practicable. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An article seized under s 159(2)(c) from someone apprehended must be given to the person in charge of the service or place when they are received there, or to the practitioner into whose care they are delivered, or returned to the person if they are released without being taken anywhere — or otherwise dealt with according to law. Whoever deals with the article must record the details in the approved form as soon as practicable and give that record to the same recipient, and a person in charge or practitioner receiving it must ensure it is filed. @@ -2744,7 +2764,7 @@ Reviewed by: ______________________ Date: ______________ > > (g)if the article was dealt with under subsection (2)(b) — any other relevant information. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > An article seized under s 162(2)(b) or given to a mental health service under s 166(3)(a)(i) must be returned to the person when they are released, discharged or otherwise leave — unless in the opinion of the person in charge returning it may pose a serious risk to anyone's health or safety, in which case it is given to a carer, close family member or other personal support person, unless that is not appropriate. If neither happens at that point the article may be returned or handed over later, and otherwise must be stored and may be destroyed or disposed of after 6 months. A record of how the article was dealt with must be filed in the approved form, covering the details of the article, the dates it was returned or handed over, or the reasons it was not, and the date and manner of any destruction or disposal. @@ -2762,7 +2782,7 @@ Reviewed by: ______________________ Date: ______________ > A person cannot perform electroconvulsive therapy on a child under 14 years of age. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > No one may perform electroconvulsive therapy on a child under 14 years of age. @@ -2792,7 +2812,7 @@ Reviewed by: ______________________ Date: ______________ > > For section 195(2)(a), the child or the child’s parent or guardian can give informed consent (see sections 14 and 15). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For a voluntary patient who is at least 14 but under 18 years of age, a medical practitioner can perform ECT only if informed consent is given, the Mental Health Tribunal approves it under Part 21 Division 6, and the practitioner has regard to the guidelines published under s 547(1)(f). The child, or the child's parent or guardian, can give the informed consent (ss 14 and 15). @@ -2822,7 +2842,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 196 amended: No. 10 of 2023 s. 363.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For a child who is at least 14 but under 18 years of age and is an involuntary patient, or a supervised person required under the CLMI Act to be detained at an authorised hospital, a medical practitioner can perform ECT only if the Mental Health Tribunal approves it under Part 21 Division 6 and the practitioner has regard to the guidelines published under s 547(1)(f). @@ -2854,7 +2874,7 @@ Reviewed by: ______________________ Date: ______________ > > 2.The GAA Act sections 110ZI and 110ZIA do not apply in relation to the performance of ECT on an adult who is a voluntary patient. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For an adult voluntary patient, a medical practitioner can perform ECT only if informed consent is given, it is performed at a mental health service approved under s 544 for that purpose, and the practitioner has regard to the guidelines published under s 547(1)(f). Informed consent can be given in an advance health directive, or on the adult's behalf by their enduring guardian, guardian or person responsible (GAA Act s 110ZJ). GAA Act ss 110ZI and 110ZIA do not apply to ECT on an adult voluntary patient. @@ -2884,7 +2904,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 198 amended: No. 10 of 2023 s. 364.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For an adult involuntary patient, or a supervised person required under the CLMI Act to be detained at an authorised hospital, a medical practitioner can perform ECT only if the Mental Health Tribunal approves it under Part 21 Division 6 and the practitioner has regard to the guidelines published under s 547(1)(f). @@ -2926,7 +2946,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 199 amended: No. 10 of 2023 s. 365.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Emergency ECT on an adult involuntary patient, or a supervised person required under the CLMI Act to be detained at an authorised hospital, can be performed only if it is needed to save the patient's life, or because there is an imminent risk of the patient behaving in a way likely to result in serious physical injury to the patient or another person; it is performed at a mental health service approved under s 544 for that purpose; the Chief Psychiatrist approves it; and the practitioner has regard to the guidelines published under s 547(1)(f). The Chief Psychiatrist must also have regard to those guidelines when approving it. @@ -3022,7 +3042,7 @@ Reviewed by: ______________________ Date: ______________ > > Emergency psychiatric treatment -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a mental health service performs electroconvulsive therapy, the person in charge must report to the Chief Psychiatrist in the approved form as soon as practicable after each month ends. The report covers the number of people whose ECT course was completed or discontinued that month, broken down by children, voluntary patients, involuntary patients and supervised persons (both those detained at an authorised hospital under the CLMI Act and those treated as a condition of a community supervision, interim, extended, leave-of-absence or interim-disposition order), with the child counts for each. It must also state the number of treatments in each course, how many were emergency ECT under s 199, and details of any serious adverse event that occurred or is suspected — including premature consciousness, anaesthetic complications, an acute and persistent confused state, muscle tears or vertebral column damage, severe persistent headaches, or persistent memory deficit. A course counts as completed in the month its last treatment was performed, and as discontinued in the month the decision to stop was made. @@ -3072,7 +3092,7 @@ Reviewed by: ______________________ Date: ______________ > > Psychosurgery -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner who provides emergency psychiatric treatment must, as soon as practicable, file a record of it and give a copy to the person, the Chief Psychiatrist, and — for a supervised person — the Mental Impairment Review Tribunal. The record is in the approved form and must include the person's name, the name and qualifications of the practitioner who provided the treatment, the names of anyone else involved, the date, time and place, the particulars of the circumstances, and the particulars of the treatment provided. @@ -3138,7 +3158,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)the person who gave the oral authorisation or, if that person is not reasonably available, another person who is authorised to make a seclusion order must ensure that the person is informed of that fact and released from seclusion. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner at an authorised hospital, or the person in charge of a ward, may orally authorise seclusion of an admitted patient, a person referred under s 26(2) or 36(2) for examination there, or a person under a s 55(1)(c) or 61(1)(c) order — but only if satisfied of the s 216 matters, and they must specify the room or area. As soon as practicable after the person is secluded the authorisation is recorded in the approved form with the time given, the room or area and the reasons, and filed with a copy to the person. A mental health practitioner or person in charge of a ward must also inform a medical practitioner whether the person is or was secluded, in time for the examinations s 222(4) or 223(2) require, and record that. If a seclusion order confirming the oral authorisation is not made within 2 hours of the person being secluded, seclusion cannot continue and the person must be informed and released. @@ -3210,7 +3230,7 @@ Reviewed by: ______________________ Date: ______________ > > (6)The person who makes a seclusion order in respect of a person must, as soon as practicable after the person is secluded under the order, file it and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner at an authorised hospital, or the person in charge of a ward, may make a seclusion order for an admitted patient, a person referred under s 26(2) or 36(2) for examination there, or a person under a s 55(1)(c) or 61(1)(c) order, if satisfied of the s 216 matters. The order is in the approved form and must include the person's name and date of birth, the time it is made, the time any oral authorisation it confirms was given, the period of seclusion — which cannot exceed 2 hours including any time under that oral authorisation — the room or area, the reasons by reference to the s 216(1) criteria, the reasons for urgency where a mental health practitioner or person in charge makes it, particulars of observations made and of any directions about treatment and care while secluded, and the maker's details. A mental health practitioner or person in charge who makes the order must also inform a medical practitioner whether the person is or was secluded, in time for the required examinations, and record that. The order is filed with a copy to the person as soon as practicable after they are secluded. @@ -3252,7 +3272,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)file the record and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a person secluded under an oral authorisation or seclusion order has a treating psychiatrist who neither gave the authorisation nor made the order, and the medical practitioner informed under s 214(5) or 215(4) is not that psychiatrist, whoever gave the authorisation or made the order must inform the treating psychiatrist whether the person is or was secluded. That must happen as soon as practicable and in any event within 2 hours of the person being secluded. The psychiatrist's name, qualifications and the time they were informed are recorded in the approved form and filed with a copy to the person. @@ -3274,7 +3294,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The medical practitioner must, as soon as practicable, file the order and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner may extend a seclusion order in force for a further period of up to 2 hours. They cannot do so unless, immediately beforehand, they examine the person in accordance with s 222(4). The order must be filed as soon as practicable with a copy to the person. @@ -3300,7 +3320,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The person who makes the order must, as soon as practicable, file it and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner, or the person in charge of a ward at an authorised hospital, may revoke a seclusion order in force. The revocation is in the approved form and must state the time the seclusion order is revoked and the maker's name, qualifications and signature, and is filed with a copy to the person. @@ -3318,7 +3338,7 @@ Reviewed by: ______________________ Date: ______________ > A medical practitioner or mental health practitioner must, as soon as practicable after a seclusion order expires, file a record in the approved form of the date and time of the expiry. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner must, as soon as practicable after a seclusion order expires, file a record in the approved form of the date and time of the expiry. @@ -3364,7 +3384,7 @@ Reviewed by: ______________________ Date: ______________ > > (d)any other care appropriate to the person’s needs. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > While a person is secluded, the person in charge of the ward must ensure these requirements are met. A mental health practitioner or nurse must observe the person every 15 minutes and file a record of those observations in the approved form with a copy to the person. A medical practitioner must examine the person at least every 2 hours and record their name and qualifications, the time of the examination, and the results — including whether, on the s 216(1) criteria, seclusion should continue — then file it with a copy to the person. The person must be provided with appropriate bedding and clothing, sufficient food and drink, access to toilet facilities, and any other care appropriate to their needs. @@ -3402,7 +3422,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)file the record and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Whenever a person is released from seclusion, the person in charge of the ward must ensure they are examined by a medical practitioner within 6 hours — or, if they are to be released or discharged or want to leave against medical advice before that, that an examination is offered beforehand. The examining practitioner must record their name and qualifications, the time of the examination, and the results, including any complication of or deterioration in the person's mental or physical condition that is or may be a result of the seclusion, then file it with a copy to the person. @@ -3476,7 +3496,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)the person who gave the oral authorisation or, if that person is not reasonably available, another person who is authorised to make a bodily restraint order must ensure that the person is informed of that fact and released from bodily restraint. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner at an authorised hospital, or the person in charge of a ward, may orally authorise bodily restraint of an admitted patient, a person referred under s 26(2) or 36(2) for examination there, or a person under a s 55(1)(c) or 61(1)(c) order — but only if satisfied of the s 232 matters. They must specify whether physical or mechanical restraint may be used and, for mechanical restraint, the device and how it may be applied to the person's body. As soon as practicable after the person is restrained the authorisation is recorded in the approved form with the time given, those specifications and the reasons, and filed with a copy to the person. A mental health practitioner or person in charge of a ward must also inform a medical practitioner whether the person is or was restrained, in time for the examinations s 238(4) or 239(2)(a) require, and record that. If a bodily restraint order confirming the oral authorisation is not made within 30 minutes of the person being restrained, restraint cannot continue and the person must be informed and released. @@ -3558,7 +3578,7 @@ Reviewed by: ______________________ Date: ______________ > > (6)The person who makes a bodily restraint order in respect of a person must, as soon as practicable after the person is restrained under the order, file it and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner at an authorised hospital, or the person in charge of a ward, may make a bodily restraint order for an admitted patient, a person referred under s 26(2) or 36(2) for examination there, or a person under a s 55(1)(c) or 61(1)(c) order, if satisfied of the s 232 matters. The order is in the approved form and must include the person's name and date of birth, the time it is made, the time any oral authorisation it confirms was given, the period of restraint — which cannot exceed 30 minutes including any time under that oral authorisation — whether physical or mechanical restraint may be used and, for mechanical restraint, the device and how it may be applied, the reasons by reference to the s 232(1) criteria including reasons for any device authorised, the reasons for urgency where a mental health practitioner or person in charge makes it, particulars of observations made and of any directions about treatment and care while restrained, and the maker's details. A mental health practitioner or person in charge who makes the order must also inform a medical practitioner whether the person is or was restrained, in time for the required examinations, and record that. The order is filed with a copy to the person as soon as practicable after they are restrained. @@ -3600,7 +3620,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)file the record and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where a person restrained under an oral authorisation or bodily restraint order has a treating psychiatrist who neither gave the authorisation nor made the order, and the medical practitioner informed under s 230(5) or 231(4) is not that psychiatrist, whoever gave the authorisation or made the order must inform the treating psychiatrist whether the person is or was restrained. That must happen as soon as practicable and in any event within 30 minutes of the person being restrained. The psychiatrist's name, qualifications and the time they were informed are recorded in the approved form and filed with a copy to the person. @@ -3638,7 +3658,7 @@ Reviewed by: ______________________ Date: ______________ > > (5)A person who makes an order under subsection (1) or (3) must, as soon as practicable, file it and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner may extend a bodily restraint order in force for a further period of up to 30 minutes, but only if they examine the person in accordance with s 238(4) immediately beforehand. A medical practitioner or mental health practitioner may instead vary the order by shortening it, or by varying the device authorised or the way it may be applied. Either order is in the approved form with the time made, the variation, the reasons and the maker's details, and is filed with a copy to the person. @@ -3664,7 +3684,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)The person who makes the order must, as soon as practicable, file it and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner, or the person in charge of a ward at an authorised hospital, may revoke a bodily restraint order in force. The revocation is in the approved form and must state the time the order is revoked and the maker's name, qualifications and signature, and is filed with a copy to the person. @@ -3682,7 +3702,7 @@ Reviewed by: ______________________ Date: ______________ > A medical practitioner or mental health practitioner must, as soon as practicable after a bodily restraint order expires, file a record in the approved form of the date and time of the expiry. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A medical practitioner or mental health practitioner must, as soon as practicable after a bodily restraint order expires, file a record in the approved form of the date and time of the expiry. @@ -3740,7 +3760,7 @@ Reviewed by: ______________________ Date: ______________ > > (d)any other care appropriate to the person’s needs. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > While a person is under bodily restraint, the person in charge of the ward must ensure these requirements are met. A mental health practitioner or nurse must be in physical attendance at all times and file a record of any observations in the approved form with a copy to the person. A medical practitioner must examine the person at least every 30 minutes and record their name and qualifications, the time of the examination, and the results — including whether, on the s 232(1) criteria, restraint should continue. If restraint lasts more than 6 hours a psychiatrist must review its use and record their name, qualifications and the date, time and results of the review. The person must be provided with appropriate bedding and clothing, sufficient food and drink, access to toilet facilities, and any other care appropriate to their needs. @@ -3778,7 +3798,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)file the record and give a copy to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Whenever a person is released from bodily restraint, the person in charge of the ward must ensure they are examined by a medical practitioner as soon as practicable and in any event within 6 hours — or, if they are to be released or discharged or want to leave against medical advice before that, that an examination is offered beforehand. The examining practitioner must record their name and qualifications, the time of the examination, and the results, including any complication of or deterioration in the person's mental or physical condition that is or may be a result of the restraint, then file it with a copy to the person. @@ -3852,7 +3872,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 1 — Explanation of rights -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Where urgent non-psychiatric treatment is provided to an involuntary patient detained at an authorised hospital, or to an accused or supervised person required to be detained there under the CLMI Act, the person in charge of the hospital must report it as soon as practicable to the Chief Psychiatrist and, for a supervised person, to the Mental Impairment Review Tribunal. The report is in the approved form and must include the patient's name, the name and qualifications of the practitioner who provided the treatment, the names of anyone else involved, the date, time and place, the particulars of the circumstances, and the particulars of the treatment. Providing the treatment is a Part 9 notifiable event. @@ -3882,7 +3902,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)if the request is refused — that, as soon as practicable after the refusal, a record in the approved form of the reasons for the refusal is filed and a copy given to the person. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Unless s 249(1)(a) or (b) or (3) applies, a person who is or was provided with treatment or care by a mental health service is entitled to inspect and be given a copy of any relevant document about them held by the person in charge or a staff member, in addition to any other right of access they have. The person in charge must ensure any such request is dealt with as soon as practicable, and that if it is refused a record of the reasons is filed in the approved form and a copy given to the person. @@ -3952,7 +3972,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 1 — Purpose and effect of nomination -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A psychiatrist may order that a patient be prohibited from exercising a s 261 communication right, or limited in exercising it. For the rights in s 261(3)(a), (b) or (e) the psychiatrist must be satisfied the order is in the patient's best interests. For visits from a legal practitioner or mental health advocate they must be satisfied there is a serious risk to that person's safety without the order and no other step could reasonably reduce it; contact by a legal practitioner or mental health advocate by other means cannot be restricted at all. The order is in the approved form with the time, the reasons and the psychiatrist's details, and is filed with a copy to the patient and to any carer, close family member or other personal support person. A psychiatrist must review the order before the end of each 24-hour period and confirm, amend or revoke it, filing a record of that and the reasons and advising the patient; the order ceases to be in force if it is not reviewed in time. The Chief Mental Health Advocate must be advised within 24 hours of the order being made. @@ -3986,7 +4006,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)For the purposes of subsection (1)(e) and (g), the witness must be authorised by law to take declarations but cannot be a person referred to in subsection (1)(d) or (f). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A nomination is not valid unless it is in the approved form, states the nominated person's name and contact details and the date it takes effect, and is signed by the person making it — or by someone else in their presence and at their direction — with that signature witnessed. The nominated person must also sign to indicate they accept the nomination, and that signature must be witnessed too. Each witness must be authorised by law to take declarations and cannot be the person who signed the part being witnessed. @@ -4068,7 +4088,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 1 — Appointment or engagement, functions and powers -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Defines terms for Part 20 (mental health advocacy services). An “identified person” — the people mental health advocates serve — includes: a person referred for examination by a psychiatrist under s 26(2) or (3)(a) or 36(2); a voluntary inpatient under an assessment order under s 34(1); a person under an order under s 55(1)(c) or 61(1)(c) enabling a psychiatrist's examination; any involuntary patient; an accused required under the CLMI Act s 19 to be detained at an authorised hospital; a supervised person required under the CLMI Act to be detained at an authorised hospital, or required to undergo treatment as a condition of one of the listed CLMI Act orders; a resident of a private psychiatric hostel; a person who has or may have a mental illness and is being treated or cared for by a body prescribed by the regulations; and a voluntary patient in a class the Minister directs under s 354. A “mental health service” in this Part includes a private psychiatric hostel. @@ -4100,7 +4120,7 @@ Reviewed by: ______________________ Date: ______________ > > (3)If the request is made to the mental health service, the person in charge of the mental health service must ensure that the Chief Mental Health Advocate is notified of the request as soon as practicable and, in any event, within 24 hours after the time when the request was made. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > A request for a mental health advocate to contact an identified person may be made by the person, their psychiatrist, or someone with a sufficient interest in them. It may be made to the mental health service detaining or treating the person, or to the Chief Mental Health Advocate. If it is made to the service, the person in charge must ensure the Chief Mental Health Advocate is notified of the request as soon as practicable and, in any event, “within 24 hours after the time when the request was made”. @@ -4184,7 +4204,7 @@ Reviewed by: ______________________ Date: ______________ > > [Section 357 amended: No. 10 of 2023 s. 380.] -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > Sets when a mental health advocate must visit or otherwise contact an identified person; the deadline depends on which paragraph of the s 348 definition the person falls under. A person in paragraph (a), (b), (c) or (e) who is detained under one of the listed provisions (including s 28(1) or (2) and s 34(1)) must be contacted as soon as practicable and in any event “on or within 3 days after the day on which the Chief Mental Health Advocate receives a request” for contact, or is notified of one. An involuntary patient under an involuntary treatment order made on or after the section commenced must be contacted “on or within 7 days after the day on which the involuntary treatment order is made” if an adult, or “within 24 hours after the time when the involuntary treatment order is made” if a child. An involuntary patient whose order was made before the section commenced, or “has been in force for more than 7 days from the day on which the order is made”, must be contacted on or as soon as practicable after the Chief Mental Health Advocate receives, or is notified of, a request. A supervised person required under the CLMI Act to be detained at an authorised hospital must be contacted “within 7 days after the day on which the person is detained” if an adult, or “within 24 hours after the person is detained” if a child. A supervised person required to undergo treatment in the community under the CLMI Act (paragraph (g)) must be contacted “within 7 days (or 24 hours if the person is a child) after the day on which the Chief Mental Health Advocate” receives or is notified of a request. A resident of a private psychiatric hostel (paragraph (h)) or a person receiving care from a prescribed organisation (paragraph (i)) must be contacted on or as soon as practicable after a request is received or notified and, in any event, “within 7 days after that day”; a voluntary patient in a class directed by the Minister (paragraph (j)), within a reasonable time. Despite that, a child who is a hostel resident, receiving care from a prescribed organisation, or in a directed voluntary class (paragraphs (h), (i) or (j)) must be contacted “on or within 24 hours after the day on which the Chief Mental Health Advocate receives a request” or is notified of one. @@ -4204,7 +4224,7 @@ Reviewed by: ______________________ Date: ______________ > > Subdivision 3 — Specific powers of mental health advocates -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > In addition to the contact required by s 357, a mental health advocate may visit or otherwise contact an identified person at any time, subject to any direction of the Chief Mental Health Advocate under s 359(3). @@ -4248,7 +4268,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)the involuntary patient has, under section 388, been an involuntary patient continuously since the previous review. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The Mental Health Tribunal must review each involuntary treatment order as soon as practicable after it is made, and in any event by the end of the initial review period, to decide whether the patient still needs the order having regard to the s 25 criteria. The initial review period is “the period of 35 days from the day on which the order is made” for an adult and “the period of 10 days from the day on which the order is made” for a child. It is enough that the review starts within that period and is completed as soon as practicable. No initial review is required if the person has not been an involuntary patient continuously (s 388) since the order was made, or if the Tribunal has already reviewed an earlier order for them (or the terms of a community treatment order it directed under s 395(2)(b)) and they have been continuously involuntary since that review. @@ -4306,7 +4326,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The Tribunal is not required to review the order under subsection (2) if the involuntary patient has not, under section 388, been an involuntary patient continuously since the last review day. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > While an involuntary treatment order stays in force, the Tribunal must review it periodically — on or within the prescribed number of days before each periodic review period ends — to decide whether the patient still needs it having regard to the s 25 criteria. The periodic review period runs from the last review day. For an inpatient treatment order, or a community treatment order where on the last review day the patient “has been an involuntary community patient continuously for not more than 12 months”, it is “the period of 3 months from that day” for an adult and “the period of 28 days from that day” for a child. For a community treatment order where the patient “has been an involuntary community patient continuously for more than 12 months”, it is “the period of 6 months from that day”. The prescribed number of days is “21 days before the day on which that period ends” if the patient was an adult when the order was made, and “7 days before the day on which that period ends” if they were a child. Starting in time and finishing as soon as practicable is enough, and no periodic review is required if the patient has not been continuously involuntary (s 388) since the last review day. @@ -4328,7 +4348,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)during the period, an involuntary treatment order ceased to be in force in respect of the person and another involuntary treatment order came into force in respect of the person on or within 7 days after the day of the cessation. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > For the review rules in ss 386(4), 386(5)(b) and 387(4), a person has been an involuntary patient continuously for a period if one or more involuntary treatment orders were in force for the whole of it, or if, when an order ceased, another came into force “on or within 7 days after the day of the cessation”. @@ -4376,7 +4396,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)If the Tribunal makes a relevant decision within the prescribed period before the day on which a review period for an involuntary treatment order ends, the Tribunal may make an order extending the review period from the day on which it would otherwise have ended for the further period (not exceeding the maximum extension period) specified in the order. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > If, within the prescribed period before a review period (initial or periodic) ends, the Tribunal makes a decision that involved considering substantially the same issues as the review would, it may order the review period extended by a further period no longer than the maximum extension period. Judged on the day of that decision, the prescribed period is “the period of 28 days” for an adult and “the period of 7 days” for a child; the maximum extension period is “the period of 21 days” for an adult and “the period of 7 days” for a child. @@ -4428,7 +4448,7 @@ Reviewed by: ______________________ Date: ______________ > > (b)if, on the day on which the decision is made, the involuntary patient is a child — the period of 7 days. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The involuntary patient, a carer, close family member or other personal support person, a mental health advocate, or anyone else the Tribunal considers has a sufficient interest may apply in writing to the Tribunal for review of: an involuntary treatment order (against the s 25 criteria); an inpatient treatment order (against s 25(1)); whether a community treatment order's terms are appropriate; a transfer order under s 66(1), 91(2) or 555(1), or a refusal to make one; or a transfer of, or refusal to transfer, responsibility as supervising psychiatrist (s 135(1)(a)) or treating practitioner (s 137(a)). An application may be made at any time, except that once the Tribunal has decided substantially the same issues, a fresh application cannot be made within the prescribed period — “the period of 28 days” for an adult, “the period of 7 days” for a child — unless the patient's circumstances have materially changed. @@ -4452,7 +4472,7 @@ Reviewed by: ______________________ Date: ______________ > > (c)a transfer of responsibility under section 390(1)(e) or (f) to decide the matter referred to in that provision. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The Tribunal may, on its own initiative whenever it considers it appropriate, review any matter that could be the subject of an application under s 390(1): an involuntary treatment order, an inpatient treatment order or the terms of a community treatment order; a transfer order or a refusal to make one; or a transfer of supervising-psychiatrist or treating-practitioner responsibility, or a refusal to transfer it. @@ -4486,7 +4506,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The Tribunal may give a copy of any recommendation made under subsection (3) to the Chief Psychiatrist. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > On completing a review, the Tribunal may make any orders and give any directions it considers appropriate, including revoking an involuntary treatment order, directing the psychiatrist named in the order to make a community treatment order in specified terms (consistent with s 115) within a specified reasonable period, or varying the terms of a community treatment order consistently with s 115. It cannot make orders or give directions about a patient's treatment, support or discharge plan, but it may recommend that the patient's psychiatrist review the plan, recommend amendments to it, and give a copy of any such recommendation to the Chief Psychiatrist. @@ -4518,7 +4538,7 @@ Reviewed by: ______________________ Date: ______________ > > (iv)the minimum period that it is proposed will elapse between any 2 treatments. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The patient's psychiatrist may apply to the Tribunal for approval to perform ECT. The application must be in writing and set out the reasons for recommending ECT and a treatment plan stating the mental health service where it is proposed to be performed, the maximum number of treatments, the maximum period over which they will be given, and the minimum period between any two treatments. @@ -4538,7 +4558,7 @@ Reviewed by: ______________________ Date: ______________ > > (2)The Tribunal cannot approve electroconvulsive therapy being performed on a patient to whom section 195 applies unless satisfied that informed consent to it being performed on the patient is given as required by section 195(2)(a). -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The Tribunal cannot approve ECT unless satisfied that the mental health service where it is proposed to be performed is approved under s 544 for that purpose and, for a voluntary patient aged at least 14 but under 18 (s 195), that informed consent has been given as s 195(2)(a) requires. @@ -4568,7 +4588,7 @@ Reviewed by: ______________________ Date: ______________ > > Psychosurgery approvals -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The Tribunal decides an ECT application by approving ECT in accordance with the treatment plan in the application, approving it on that plan but with the maximum number of treatments reduced to a number the Tribunal specifies, or refusing to approve it. @@ -4612,7 +4632,7 @@ Reviewed by: ______________________ Date: ______________ > > (4)The making of a transfer order under subsection (1) is an event to which Part 9 applies and the person in charge of the hospital is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person in charge of a hospital may, with the Chief Psychiatrist's written approval, make a transfer order authorising a State inpatient's transfer to the interstate mental health service named in it — including an inpatient who is absent without leave as described in s 551(2). The order is in the approved form and must include the inpatient's name, the hospital transferred from and the interstate service transferred to, the time made, the reasons and the maker's details. Both the approval and the order must be filed with a copy of each to the inpatient, and a copy of each transmitted to the person in charge of the interstate service. Making it is a Part 9 notifiable event. @@ -4656,7 +4676,7 @@ Reviewed by: ______________________ Date: ______________ > > (6)The making of a transfer approval order under subsection (1) is an event to which Part 9 applies and the person in charge of the hospital is the person responsible under that Part for notification of that event. -**Drafted summary** (status: drafted) +**Drafted summary** (status: reviewed) > The person in charge of a hospital may, with the Chief Psychiatrist's written consent, make a transfer approval order approving an interstate inpatient's transfer to that hospital — including one absent without leave as described in s 551(3). The order is in the approved form and must include the patient's name, the interstate service transferred from and the hospital transferred to, the time made, the reasons and the maker's details. A copy of both the consent and the order must be transmitted to the interstate service as soon as practicable. On admission the interstate inpatient treatment order is taken to be an inpatient treatment order made under this Act, and the consent and order must then be filed with a copy of each given to the patient. Making it is a Part 9 notifiable event. diff --git a/docs/medication-interaction-lexicon-review.md b/docs/medication-interaction-lexicon-review.md index 5edb2c4682..4d26f5b033 100644 --- a/docs/medication-interaction-lexicon-review.md +++ b/docs/medication-interaction-lexicon-review.md @@ -1,6 +1,6 @@ # Medication interaction lexicon — clinical review sheet -**Status: reviewed 2026-09-28 — NOT current.** The catalogue-term mappings have changed since (signed `91758a178c655e5d4e6d952ee7302f86421b810b9ee43ce2397709e6731aa524`, now `b33eb434ce7aee1b1c3797b94c076ef5e944feb6af0f8bcc41ccf0fc39f2b575`). This sheet therefore cannot say which of the terms below remain covered by that sign-off: re-check every term the change touched and re-record the sign-off with the current mappings hash. A sign-off covers the mappings as they stood on its own date only. +**Status: reviewed 2026-10-16** — see the sign-off at the bottom. That sign-off covers the mappings as they stood on that date only. Any lexicon change made since is NOT covered by it: re-check every term the change touches, and say so in the sign-off. Generated by `npm run medications:lexicon-report` from `src/lib/medication-interaction-lexicon.ts`. Do not hand-edit — fix the lexicon and regenerate. `npm run check:medication-lexicon-report` fails when @@ -171,13 +171,27 @@ Checks that ran and found nothing: ## Sign-off -| Field | Value | -| ---------------------- | ----------------------------------------------------------------------------------------------------------------- | -| Reviewer (name + role) | Repository Lead (owner approval 2026-09-28, relayed by the Chief of Staff) | -| Date | 2026-09-28 | -| Mappings hash | `91758a178c655e5d4e6d952ee7302f86421b810b9ee43ce2397709e6731aa524` | -| Outcome | Re-signed. The 2026-09-06 sign-off stands; the one change since (`maois` gained moclobemide) is accepted (below). | -| Corrections raised | One generator correction, applied with this re-sign (below). | +| Field | Value | +| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | +| Reviewer (name + role) | Josh Simpson (Psychiatrist, Clinical Owner) | +| Date | 2026-10-16 | +| Mappings hash | `b33eb434ce7aee1b1c3797b94c076ef5e944feb6af0f8bcc41ccf0fc39f2b575` | +| Outcome | Re-signed. The 2026-09-28 sign-off stands; the three changes since (`nsaids` excluding aspirin, plus `valproate` and `nitrates`) are accepted. | +| Corrections raised | None this round. | + +### Re-signed 2026-10-16 (owner approval 2026-10-16), and what it covers + +Three catalogue-term changes since 2026-09-28, no other term reopened: + +1. **`nsaids` narrowed with `denySlugs: ["aspirin"]`** (8 drugs to 7: Celecoxib, Diclofenac, + Ibuprofen, Ketorolac, Meloxicam, Naproxen, Parecoxib). Accepted: prevents low-dose antiplatelet + aspirin from firing NSAID-specific renal prostaglandin / lithium toxicity alerts while keeping + aspirin covered under `antiplatelets`. +2. **`valproate` added** (surfaces `valproate`, `sodium valproate`, `valproic acid`, `epilim`; + resolving to `sodium-valproate-oral-iv`). Accepted: binds lamotrigine and carbamazepine + interaction rows naming valproate to the catalogue drug. +3. **`nitrates` added** (surfaces `nitrates`, `nitrate`; resolving to `glyceryl-trinitrate-gtn`). + Accepted: binds severe hypotension interaction rows to glyceryl trinitrate. ### Re-signed 2026-09-28 (owner approval 2026-09-28), and what it covers diff --git a/docs/organisation/systems/clinical-content.json b/docs/organisation/systems/clinical-content.json index a42ca0929d..2fc8ecfadf 100644 --- a/docs/organisation/systems/clinical-content.json +++ b/docs/organisation/systems/clinical-content.json @@ -56,6 +56,7 @@ "public/forms-pdf/**", "public/therapy-compass-data/**", "scripts/apply-dictionary-rewrites.ts", + "scripts/apply-specifier-worksheet.mjs", "scripts/audit-public-document-approvals.ts", "scripts/audit-source-governance.ts", "scripts/build-clinical-review-queue.ts", @@ -95,6 +96,7 @@ "scripts/merge-source-acquisitions.ts", "scripts/patch-therapy-references.mjs", "scripts/promote-public-documents-batch.ts", + "scripts/publish-site-content-first-catalogue.ts", "scripts/reconcile-registry-governance.ts", "scripts/refresh-site-content-bootstrap.ts", "scripts/refresh-site-content-p03-baseline.ts", diff --git a/docs/organisation/systems/personal-practice.json b/docs/organisation/systems/personal-practice.json index 9096d5f098..28855c4ac0 100644 --- a/docs/organisation/systems/personal-practice.json +++ b/docs/organisation/systems/personal-practice.json @@ -78,6 +78,7 @@ "tests/calendar-*", "tests/challenger-m4-2-empirical-stress.test.ts", "tests/cme-*", + "tests/epa-magic-link.test.ts", "tests/example-data-roster.test.ts", "tests/favourite-set-name-sheet.dom.test.tsx", "tests/favourite-set-name.test.ts", diff --git a/docs/rag-injection-threat-model.md b/docs/rag-injection-threat-model.md index ed47314579..4895243e4d 100644 --- a/docs/rag-injection-threat-model.md +++ b/docs/rag-injection-threat-model.md @@ -12,7 +12,7 @@ without checking those implementation-status sections. ## 1. What document-derived text actually reaches the prompt -The answer prompt is assembled by `buildRagSourceBlock` ([`rag-source-block.ts:228`](../src/lib/rag/rag-source-block.ts)), consumed inside `buildAnswerInput` ([`rag.ts:2984`](../src/lib/rag/rag.ts)) under a plain `Sources:` header, alongside the system prompt `answerInstructions` ([`rag-answer-instructions.ts:8`](../src/lib/rag/rag-answer-instructions.ts)). Two content defenses exist: +The answer prompt is assembled by `buildRagSourceBlock` ([`rag-source-block.ts:228`](../src/lib/rag/rag-source-block.ts)), consumed inside `buildAnswerInput` ([`rag.ts:3032`](../src/lib/rag/rag.ts)) under a plain `Sources:` header, alongside the system prompt `answerInstructions` ([`rag-answer-instructions.ts:8`](../src/lib/rag/rag-answer-instructions.ts)). Two content defenses exist: - **`neutralizePromptInstructions`** ([`source-text-sanitizer.ts:444`](../src/lib/source-text-sanitizer.ts)) — six sequential regex `.replace()` calls that blank a fixed set of English injection idioms. - **`fenceSourceEvidence`** ([`source-text-sanitizer.ts:498`](../src/lib/source-text-sanitizer.ts)) — wraps text in `<<>> … <<>>` sentinels; `escapeEvidenceFenceSentinels` ([`:491`](../src/lib/source-text-sanitizer.ts)) defuses forged sentinels _inside_ the fenced text. diff --git a/docs/site-map.md b/docs/site-map.md index b5707e3881..345640f9f3 100644 --- a/docs/site-map.md +++ b/docs/site-map.md @@ -68,6 +68,7 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir - `/cme/customise` - Choose which modules show on the CPD dashboard below the hours, pace and next-action rows, and reorder them with up/down controls that work as well from a keyboard as from a pointer. Source: `src/app/(search-app)/cme/customise/page.tsx`. - `/my-day/setup` - Route discovered from app directory Source: `src/app/(search-app)/my-day/setup/page.tsx`. - `/therapy-compass/[slug]/brief` - Therapy brief-intervention view. Source: `src/app/(search-app)/therapy-compass/[slug]/brief/page.tsx`. +- `/teaching/assessments/respond/[token]` - Route discovered from app directory Source: `src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx`. - `/my-day/alerts/earlier` - Route discovered from app directory Source: `src/app/(search-app)/my-day/alerts/earlier/page.tsx`. - `/teaching/resources` - Route discovered from app directory Source: `src/app/(search-app)/teaching/resources/page.tsx`. - `/admin/help` - Crisis lines, support, guides, contacts and on-site detail with in-page search. Source: `src/app/(search-app)/admin/help/page.tsx`. @@ -1479,6 +1480,7 @@ This file is generated by `npm run docs:update` (or `npm run sitemap:update` dir ## API routes - `/api/on-call/shifts` - Route discovered from app directory Source: `src/app/api/on-call/shifts/route.ts`. +- `/api/teaching/assessments/respond/[token]` - Route discovered from app directory Source: `src/app/api/teaching/assessments/respond/[token]/route.ts`. - `/api/alerts/test` - Route discovered from app directory Source: `src/app/api/alerts/test/route.ts`. - `/api/on-call/entries` - Route discovered from app directory Source: `src/app/api/on-call/entries/route.ts`. - `/api/health/ready` - Readiness health check. Source: `src/app/api/health/ready/route.ts`. diff --git a/scripts/apply-specifier-worksheet.mjs b/scripts/apply-specifier-worksheet.mjs new file mode 100644 index 0000000000..47acc6a862 --- /dev/null +++ b/scripts/apply-specifier-worksheet.mjs @@ -0,0 +1,325 @@ +#!/usr/bin/env node +/** + * Parse a completed specifier entry worksheet (`docs/specifier-entry-worksheet-with-catatonia.md`) + * and propagate the shared criteria + disorder-specific overrides into `data/specifiers-content.json`, + * then rebuild `data/specifiers-search-index.json`. + * + * Refuses to write while any required worksheet prompt is still blank (`_(blank)_` or `> _`). + * + * Usage: + * node scripts/apply-specifier-worksheet.mjs --worksheet docs/specifier-entry-worksheet-with-catatonia.md --dry-run + * node scripts/apply-specifier-worksheet.mjs --worksheet docs/specifier-entry-worksheet-with-catatonia.md --write + */ + +import { execFileSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import { existsSync, readFileSync, realpathSync, writeFileSync } from "node:fs"; +import { join, resolve } from "node:path"; +import { pathToFileURL } from "node:url"; + +export const EXPECTED_CATATONIA_ROW_KEYS = Object.freeze([ + "specifier:ndv:autism-spectrum-disorder:co-occurring:with-catatonia", + "specifier:psy:brief-psychotic-disorder:features:with-catatonia", + "specifier:psy:schizophreniform-disorder:features:with-catatonia", + "specifier:psy:schizophrenia:features:with-catatonia", + "specifier:psy:schizoaffective-disorder:features:with-catatonia", + "specifier:psy:psychotic-disorder-due-to-another-medical-condition:features:with-catatonia", + "specifier:bip:bipolar-i-disorder:episode-specifiers:with-catatonia", + "specifier:bip:bipolar-ii-disorder:episode-specifiers:with-catatonia", + "specifier:dep:major-depressive-disorder:episode-specifiers:with-catatonia", +]); + +function isBlankPlaceholder(value) { + const trimmed = String(value ?? "").trim(); + if (!trimmed) return true; + if (trimmed.includes("_(blank)_")) return true; + if (/^>_?/.test(trimmed) || /^_\(.*\)_$/.test(trimmed)) return true; + return false; +} + +function cleanField(value) { + return String(value ?? "") + .replace(/^>\s*/, "") + .trim(); +} + +export function parseWorksheetArgs(argv) { + let worksheet = "docs/specifier-entry-worksheet-with-catatonia.md"; + let mode = "dry-run"; + let sawMode = false; + + for (let index = 0; index < argv.length; index += 1) { + const token = argv[index]; + if (token === "--worksheet") { + const next = argv[index + 1]; + if (!next || next.startsWith("--")) { + throw new Error("--worksheet requires a path."); + } + worksheet = next; + index += 1; + continue; + } + if (token === "--dry-run" || token === "--write") { + if (sawMode) { + throw new Error("Specify at most one of --dry-run or --write."); + } + sawMode = true; + mode = token === "--write" ? "write" : "dry-run"; + continue; + } + throw new Error(`Unknown argument: ${token}`); + } + + return { worksheet, write: mode === "write", dryRun: mode === "dry-run" }; +} + +export function parseCatatoniaWorksheet(markdown) { + const problems = []; + const normalized = String(markdown).replace(/\r\n/g, "\n"); + const sectionParts = normalized.split(/^##\s+2[\s.—-]+/m); + const sharedSection = sectionParts[0] ?? ""; + const disordersSection = (sectionParts[1] ?? "").split(/^##\s+3[\s.—-]+/m)[0] ?? ""; + + const quoteBlocks = []; + let currentQuoteLines = []; + for (const line of sharedSection.split("\n")) { + const match = line.match(/^>\s*(.*)$/); + if (match) { + const cleaned = cleanField(match[1]); + if (cleaned) currentQuoteLines.push(cleaned); + } else if (currentQuoteLines.length > 0) { + const trimmedLine = line.trim(); + if (trimmedLine && !/^#{1,6}\s|^[-*+]\s|^\d+\.\s/.test(trimmedLine)) { + const cleaned = cleanField(trimmedLine); + if (cleaned) currentQuoteLines.push(cleaned); + } else { + quoteBlocks.push(currentQuoteLines.join(" ")); + currentQuoteLines = []; + } + } + } + if (currentQuoteLines.length > 0) { + quoteBlocks.push(currentQuoteLines.join(" ")); + } + const quoteMatches = quoteBlocks; + if (quoteMatches.length < 4) { + problems.push(`Section 1 must contain 4 blockquote answers (found ${quoteMatches.length}).`); + } + + const [threshold = "", exclusions = "", impact = "", sourceFamily = ""] = quoteMatches; + const sharedLabels = [ + ["Section 1.1 (threshold / what has to be present)", threshold], + ["Section 1.2 (exclusions / differential)", exclusions], + ["Section 1.3 (what applying it changes)", impact], + ["Section 1.4 (sourceFamily)", sourceFamily], + ]; + for (const [label, value] of sharedLabels) { + if (isBlankPlaceholder(value)) { + problems.push(`${label} is still blank.`); + } + } + + const entriesByRowKey = new Map(); + const subsectionBlocks = disordersSection.split(/^###\s+/m).slice(1); + for (const block of subsectionBlocks) { + const keyMatch = block.match(/`(specifier:[^`\n]+:with-catatonia)`/); + if (!keyMatch) continue; + const rowKey = keyMatch[1].trim(); + + const unchangedMatch = block.match(/-\s*Shared definition applies unchanged\?[^\n]*→\s*([^\n]+)/); + const diffMatch = block.match(/-\s*If no, what differs here[\s\S]*?:\s*([^\n]+)/); + const icd11Match = block.match(/-\s*ICD-11 route for this disorder[\s\S]*?:\s*([^\n]+)/); + + const rawUnchanged = cleanField(unchangedMatch?.[1] ?? "").toLowerCase(); + const rawDifference = cleanField(diffMatch?.[1] ?? ""); + const rawIcd11 = cleanField(icd11Match?.[1] ?? ""); + + if (isBlankPlaceholder(rawUnchanged) || (rawUnchanged !== "yes" && rawUnchanged !== "no")) { + problems.push(`${rowKey}: "Shared definition applies unchanged?" must be answered "yes" or "no".`); + } + const unchanged = rawUnchanged === "yes"; + const difference = isBlankPlaceholder(rawDifference) ? "" : rawDifference; + if (rawUnchanged === "no" && !difference) { + problems.push(`${rowKey}: marked "no" for unchanged definition, but difference note is blank.`); + } + if (isBlankPlaceholder(rawIcd11)) { + problems.push(`${rowKey}: ICD-11 route (icd11Context) is still blank.`); + } + + entriesByRowKey.set(rowKey, { + rowKey, + unchanged, + difference, + icd11Context: rawIcd11, + }); + } + + for (const expectedKey of EXPECTED_CATATONIA_ROW_KEYS) { + if (!entriesByRowKey.has(expectedKey)) { + problems.push(`Missing worksheet subsection for ${expectedKey}.`); + } + } + + if (problems.length > 0) { + throw new Error(`Worksheet is incomplete; refusing to apply:\n- ${problems.join("\n- ")}`); + } + + return { + shared: { + threshold, + exclusions, + impact, + sourceFamily, + }, + entries: EXPECTED_CATATONIA_ROW_KEYS.map((key) => entriesByRowKey.get(key)), + }; +} + +function shortContentHash(payload) { + return createHash("sha256").update(JSON.stringify(payload)).digest("hex").slice(0, 8); +} + +export function applyCatatoniaWorksheet(document, parsed) { + const byRowKey = new Map(parsed.entries.map((entry) => [entry.rowKey, entry])); + const matched = new Set(); + + const categories = (document.categories ?? []).map((category) => ({ + ...category, + disorders: (category.disorders ?? []).map((disorder) => { + const matchedOverrides = (disorder.groups ?? []).flatMap((group) => + (group.items ?? []).map((item) => byRowKey.get(item?.review?.rowKey)).filter(Boolean), + ); + const distinctIcd11 = [...new Set(matchedOverrides.map((entry) => entry.icd11Context).filter(Boolean))]; + if (distinctIcd11.length > 1) { + throw new Error( + `Conflicting ICD-11 routes for disorder ${disorder.id ?? disorder.name}: ${distinctIcd11.join(" vs ")}`, + ); + } + const nextIcd11Context = distinctIcd11[0] || disorder.icd11Context || undefined; + const groups = (disorder.groups ?? []).map((group) => ({ + ...group, + items: (group.items ?? []).map((item) => { + const rowKey = item?.review?.rowKey; + const override = byRowKey.get(rowKey); + if (!override) return item; + matched.add(rowKey); + const itemIcd11Note = override.icd11Context ? `ICD-11 route: ${override.icd11Context}` : ""; + const meaning = override.unchanged + ? parsed.shared.threshold + : `${parsed.shared.threshold} ${override.difference}`.trim(); + const clinicalNote = [parsed.shared.exclusions, parsed.shared.impact, itemIcd11Note] + .filter(Boolean) + .join(" ") + .trim(); + const definition = { + meaning, + clinicalNote, + sourceFamily: parsed.shared.sourceFamily, + status: "defined", + }; + const contentHash = shortContentHash({ + rowKey, + label: item.label, + definition, + definitionStatus: "defined", + icd11Context: nextIcd11Context, + }); + const nextReview = { + rowKey, + contentHash, + sourceFamily: parsed.shared.sourceFamily, + sourceVerificationStatus: "source-verified", + clinicianReviewStatus: "clinician-review-pending", + changedSinceReview: true, + }; + return { + ...item, + definition, + definitionStatus: "defined", + review: nextReview, + }; + }), + })); + return { + ...disorder, + ...(nextIcd11Context ? { icd11Context: nextIcd11Context } : {}), + groups, + }; + }), + })); + + for (const expectedKey of EXPECTED_CATATONIA_ROW_KEYS) { + if (!matched.has(expectedKey)) { + throw new Error(`Specifier rowKey ${expectedKey} was not found in data/specifiers-content.json.`); + } + } + + const allItems = categories.flatMap((category) => + category.disorders.flatMap((disorder) => disorder.groups.flatMap((group) => group.items)), + ); + const itemsWithDefinitions = allItems.filter((item) => item.definitionStatus === "defined").length; + + return { + ...document, + stats: { + ...document.stats, + itemsWithDefinitions, + }, + categories, + }; +} + +export async function main(argv = process.argv.slice(2), { root = process.cwd(), output = process.stdout } = {}) { + const args = parseWorksheetArgs(argv); + const worksheetPath = resolve(root, args.worksheet); + if (!existsSync(worksheetPath)) { + throw new Error(`Worksheet file not found: ${worksheetPath}`); + } + const markdown = readFileSync(worksheetPath, "utf8"); + const parsed = parseCatatoniaWorksheet(markdown); + + const specifiersPath = join(root, "data", "specifiers-content.json"); + const document = JSON.parse(readFileSync(specifiersPath, "utf8")); + const nextDocument = applyCatatoniaWorksheet(document, parsed); + + if (!args.write) { + output.write( + `Dry run passed: ${parsed.entries.length} "With catatonia" specifier rows ready to update from ${args.worksheet}.\n`, + ); + return 0; + } + + let formatted = `${JSON.stringify(nextDocument, null, 2)}\n`; + try { + const prettier = await import("prettier"); + const config = (await prettier.resolveConfig(specifiersPath)) ?? {}; + formatted = await prettier.format(formatted, { ...config, filepath: specifiersPath }); + } catch { + // Fall back to 2-space JSON formatting if prettier is unavailable. + } + + writeFileSync(specifiersPath, formatted, "utf8"); + execFileSync(process.execPath, [join(root, "scripts", "build-specifiers-search-index.mjs")], { + cwd: root, + stdio: "inherit", + }); + output.write( + `Updated ${parsed.entries.length} "With catatonia" specifier rows in data/specifiers-content.json and rebuilt data/specifiers-search-index.json.\n`, + ); + return 0; +} + +const invokedPath = process.argv[1] + ? pathToFileURL(existsSync(process.argv[1]) ? realpathSync(resolve(process.argv[1])) : resolve(process.argv[1])).href + : null; +if (invokedPath === import.meta.url) { + main().then( + (code) => { + process.exitCode = code; + }, + (error) => { + process.stderr.write(`apply-specifier-worksheet: ${error instanceof Error ? error.message : String(error)}\n`); + process.exitCode = 1; + }, + ); +} diff --git a/scripts/publish-site-content-first-catalogue.ts b/scripts/publish-site-content-first-catalogue.ts new file mode 100644 index 0000000000..bcffba7daf --- /dev/null +++ b/scripts/publish-site-content-first-catalogue.ts @@ -0,0 +1,457 @@ +/** + * Build an offline, owner-reviewed first-publication catalogue plan for Services (222) and + * Forms (54) (#HTZPQ8 / #ZPHK2F). + * + * WHY THIS EXISTS + * --------------- + * Owner decision 2026-09-25 (#ZPHK2F): the 222 service rows and 54 form rows go public through + * the administrator first-publication flow in owner-approved batches, each batch clinically + * signed off by a named person (`isNamedPerson`). They must NOT be forced through the adoption + * reconciliation triage by relaxing `reconcileCanonicalPublicSiteContent`. + * + * SAFETY GATES + * ------------ + * 1. Fail-closed clinical sign-off check: every record included in the plan must carry + * `status === "reviewed"`, a named human reviewer (`isNamedPerson(reviewedBy)` — rejecting + * `"PsychSift"`, `"System"`, bare titles, etc.), and a valid UTC `reviewedAt` timestamp. + * 2. Offline by default: `--dry-run` and `--out ` never import or call a live Supabase + * client. Live execution requires BOTH `--execute` and `ALLOW_DESTRUCTIVE_SITE_CONTENT_INIT=true`. + * + * USAGE + * node scripts/run-tsx.mjs scripts/publish-site-content-first-catalogue.ts --dry-run + * node scripts/run-tsx.mjs scripts/publish-site-content-first-catalogue.ts \ + * --kind all --batch-size 100 --out first-publication-plan.json + */ + +import { readFileSync, writeFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { pathToFileURL } from "node:url"; + +import { isNamedPerson } from "@/lib/admin/rule-sign-off"; +import { formRecords, type FormRecord } from "@/lib/forms"; +import { clinicalRegistryRowsToCorpusEntries } from "@/lib/registry-corpus"; +import { recordToRow, type RegistryRecordRow } from "@/lib/registry-records"; +import { defaultServiceRecords } from "@/lib/registry-fixtures"; +import type { ServiceRecord } from "@/lib/services"; +import { dynamicLogicalId } from "@/lib/site-content/adapters"; +import { + canonicalRegistrySiteContentProjection, + expectedCanonicalPublicRegistrySnapshot, + registryEntryToSiteContentRecord, + type CanonicalPublicRegistrySnapshot, + type CanonicalRegistrySiteContentProjection, +} from "@/lib/site-content/adapters/registry"; +import { compareCanonicalSiteContentIdentifiers, siteContentValueHash } from "@/lib/site-content/site-content-manifest"; +import { reconciliationHash } from "@/lib/site-content/site-content-reconciliation"; + +export type FirstPublicationKind = "service" | "form" | "all"; + +export type ClinicalSignOffEntry = { + id?: string; + code?: string; + slug?: string; + status: string; + reviewedBy: string | null; + reviewedAt: string | null; + reviewedContentSha256?: string | null; +}; + +export type FirstPublicationRejectedRecord = { + kind: "service" | "form"; + recordId: string; + slug: string; + reason: string; +}; + +export type FirstPublicationBatch = { + batchIndex: number; + logicalIds: string[]; + records: CanonicalRegistrySiteContentProjection[]; +}; + +export type FirstPublicationCataloguePlan = { + version: "site-content-first-publication-plan-v1"; + kind: FirstPublicationKind; + batchSize: number; + batchCount: number; + expectedRecordCount: number; + counts: { + services: number; + forms: number; + total: number; + }; + trustedSnapshotDigest: string; + planDigest: string; + trustedSnapshots: CanonicalPublicRegistrySnapshot[]; + batches: FirstPublicationBatch[]; +}; + +export type BuildFirstPublicationOptions = { + kind?: FirstPublicationKind; + batchSize?: number; + services?: readonly ServiceRecord[]; + forms?: readonly FormRecord[]; + serviceReviews?: readonly ClinicalSignOffEntry[]; + formReviews?: readonly ClinicalSignOffEntry[]; + onlySlugs?: readonly string[]; +}; + +export type FirstPublicationCliOptions = { + kind: FirstPublicationKind; + batchSize: number; + dryRun: boolean; + execute: boolean; + out?: string; + servicesReviewPath: string; + formsReviewPath: string; +}; + +const ISO_TIMESTAMP_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/; + +function isValidReviewTimestamp(value: string | null | undefined): boolean { + if (typeof value !== "string") return false; + const trimmed = value.trim(); + if (!ISO_TIMESTAMP_RE.test(trimmed)) return false; + const parsedMs = Date.parse(trimmed); + if (!Number.isFinite(parsedMs) || parsedMs > Date.now() + 60_000) return false; + const normalized = new Date(parsedMs).toISOString(); + return normalized.slice(0, 19) === trimmed.slice(0, 19); +} + +function validateSignOffEntry( + kind: "service" | "form", + recordId: string, + slug: string, + review: ClinicalSignOffEntry | undefined, +): FirstPublicationRejectedRecord | null { + if (!review) { + return { + kind, + recordId, + slug, + reason: "missing clinical review record", + }; + } + if (review.status !== "reviewed") { + return { + kind, + recordId, + slug, + reason: `status is "${review.status}" (requires "reviewed")`, + }; + } + if (!isNamedPerson(review.reviewedBy)) { + return { + kind, + recordId, + slug, + reason: `reviewedBy ${JSON.stringify(review.reviewedBy)} is not a named clinician (isNamedPerson check failed)`, + }; + } + if (!isValidReviewTimestamp(review.reviewedAt)) { + return { + kind, + recordId, + slug, + reason: `reviewedAt ${JSON.stringify(review.reviewedAt)} is not a valid UTC ISO timestamp`, + }; + } + return null; +} + +function toOwnerlessRegistryRow( + record: ServiceRecord | FormRecord, + kind: "service" | "form", + recordId: string, + reviewedAt: string, +): RegistryRecordRow { + const inserted = recordToRow(record, "00000000-0000-0000-0000-000000000000", kind); + return { + ...inserted, + id: recordId, + owner_id: null as unknown as string, + validation_status: "locally_reviewed", + created_at: reviewedAt, + updated_at: reviewedAt, + } as RegistryRecordRow; +} + +export function buildFirstPublicationCataloguePlan( + options: BuildFirstPublicationOptions = {}, +): FirstPublicationCataloguePlan { + const kind = options.kind ?? "all"; + const batchSize = options.batchSize ?? 100; + if (!Number.isInteger(batchSize) || batchSize < 1 || batchSize > 500) { + throw new Error("--batch-size must be an integer between 1 and 500."); + } + + const slugFilter = options.onlySlugs ? new Set(options.onlySlugs.map((slug) => slug.trim().toLowerCase())) : null; + const services = + kind === "form" + ? [] + : (options.services ?? defaultServiceRecords()).filter((record) => + slugFilter ? slugFilter.has(record.slug.toLowerCase()) : true, + ); + const forms = + kind === "service" + ? [] + : (options.forms ?? formRecords).filter((record) => + slugFilter ? slugFilter.has(record.slug.toLowerCase()) : true, + ); + + const serviceReviews = options.serviceReviews ?? loadDefaultServiceReviews(); + const formReviews = options.formReviews ?? loadDefaultFormReviews(); + + const serviceReviewByKey = new Map(); + for (const entry of serviceReviews) { + for (const candidateKey of [entry.id, entry.slug, entry.code]) { + if (typeof candidateKey === "string" && candidateKey.trim()) { + serviceReviewByKey.set(candidateKey.trim().toLowerCase(), entry); + } + } + } + + const formReviewByKey = new Map(); + for (const entry of formReviews) { + for (const candidateKey of [entry.code, entry.id, entry.slug]) { + if (typeof candidateKey === "string" && candidateKey.trim()) { + formReviewByKey.set(candidateKey.trim().toLowerCase(), entry); + } + } + } + + const rejected: FirstPublicationRejectedRecord[] = []; + const ownerlessRows: RegistryRecordRow[] = []; + + for (const service of services) { + const serviceWithId = service as ServiceRecord & { id?: string }; + const stableId = String(service.catalogPayload?.stableId ?? serviceWithId.id ?? service.slug).trim(); + const review = + serviceReviewByKey.get(stableId.toLowerCase()) ?? + serviceReviewByKey.get(service.slug.trim().toLowerCase()) ?? + (serviceWithId.id ? serviceReviewByKey.get(serviceWithId.id.trim().toLowerCase()) : undefined); + const problem = validateSignOffEntry("service", stableId, service.slug, review); + if (problem) { + rejected.push(problem); + continue; + } + ownerlessRows.push(toOwnerlessRegistryRow(service, "service", stableId, review!.reviewedAt!.trim())); + } + + for (const form of forms) { + const formWithOptionalFields = form as FormRecord & { id?: string; formNumber?: string }; + const payload = (form.catalogPayload ?? {}) as { form?: string; id?: string }; + const rawFormCode = + payload.form ?? + formWithOptionalFields.formNumber ?? + form.catalogueLabel ?? + form.primaryContact?.value ?? + form.slug; + const formCode = String(rawFormCode) + .replace(/^Form\s+/i, "") + .trim(); + const formRecordId = String(payload.id ?? formWithOptionalFields.id ?? form.slug).trim(); + const review = + formReviewByKey.get(formCode.toLowerCase()) ?? + formReviewByKey.get(form.slug.trim().toLowerCase()) ?? + formReviewByKey.get(formRecordId.toLowerCase()); + const problem = validateSignOffEntry("form", formCode, form.slug, review); + if (problem) { + rejected.push(problem); + continue; + } + ownerlessRows.push(toOwnerlessRegistryRow(form, "form", formRecordId, review!.reviewedAt!.trim())); + } + + if (rejected.length > 0) { + const preview = rejected + .slice(0, 10) + .map((item) => ` - [${item.kind}] ${item.recordId} (${item.slug}): ${item.reason}`) + .join("\n"); + const remainder = rejected.length > 10 ? `\n ...and ${rejected.length - 10} more record(s).` : ""; + throw new Error( + `First-publication plan refused: ${rejected.length} record(s) lack clinical sign-off by a named person:\n${preview}${remainder}`, + ); + } + + if (ownerlessRows.length === 0) { + throw new Error("First-publication plan refused: no signed-off records matched the selection."); + } + + const corpusEntries = clinicalRegistryRowsToCorpusEntries(ownerlessRows); + const projections: CanonicalRegistrySiteContentProjection[] = []; + const trustedSnapshots: CanonicalPublicRegistrySnapshot[] = []; + + const sortedEntries = [...corpusEntries].sort((left, right) => + compareCanonicalSiteContentIdentifiers(dynamicLogicalId(left), dynamicLogicalId(right)), + ); + + for (const entry of sortedEntries) { + const logicalId = dynamicLogicalId(entry); + const sourceLineage = [ + { + sourceId: + entry.kind === "service" + ? `repository:data/services-snapshot.json#${entry.slug}` + : `repository:data/forms-catalog.json#${entry.slug}`, + sourceHash: siteContentValueHash(entry), + relationship: "derived_from" as const, + }, + ]; + const siteRecord = registryEntryToSiteContentRecord(entry, { logicalId, sourceLineage }); + const snapshot = expectedCanonicalPublicRegistrySnapshot(entry.recordId, siteRecord); + const projection = canonicalRegistrySiteContentProjection( + entry, + { + logicalId, + publicRecordId: entry.recordId, + rowOwnerId: null, + publicationState: "published", + renderedByPublicSite: true, + explicitlyReconciled: true, + sourceLineage, + }, + snapshot, + ); + trustedSnapshots.push(snapshot); + projections.push(projection); + } + + const batches: FirstPublicationBatch[] = []; + for (let offset = 0; offset < projections.length; offset += batchSize) { + const slice = projections.slice(offset, offset + batchSize); + batches.push({ + batchIndex: batches.length, + logicalIds: slice.map((item) => item.record.logicalId), + records: slice, + }); + } + + const trustedSnapshotDigest = reconciliationHash({ + version: "site-content-trusted-snapshot-v1", + records: trustedSnapshots, + }); + + const unsignedPlan = { + version: "site-content-first-publication-plan-v1" as const, + kind, + batchSize, + batchCount: batches.length, + expectedRecordCount: projections.length, + counts: { + services: services.length, + forms: forms.length, + total: projections.length, + }, + trustedSnapshotDigest, + trustedSnapshots, + batches, + }; + + return { + ...unsignedPlan, + planDigest: reconciliationHash(unsignedPlan), + }; +} + +function loadDefaultServiceReviews(path = "data/service-records-review.json"): ClinicalSignOffEntry[] { + const parsed = JSON.parse(readFileSync(resolve(path), "utf8")) as { entries?: ClinicalSignOffEntry[] }; + return Array.isArray(parsed.entries) ? parsed.entries : []; +} + +function loadDefaultFormReviews(path = "data/forms-content-review.json"): ClinicalSignOffEntry[] { + const parsed = JSON.parse(readFileSync(resolve(path), "utf8")) as { forms?: ClinicalSignOffEntry[] }; + return Array.isArray(parsed.forms) ? parsed.forms : []; +} + +export function parseFirstPublicationCliArgs(argv: readonly string[]): FirstPublicationCliOptions { + const options: FirstPublicationCliOptions = { + kind: "all", + batchSize: 100, + dryRun: false, + execute: false, + servicesReviewPath: "data/service-records-review.json", + formsReviewPath: "data/forms-content-review.json", + }; + + for (let index = 0; index < argv.length; index += 1) { + const flag = argv[index]; + if (flag === "--dry-run") { + options.dryRun = true; + continue; + } + if (flag === "--execute") { + options.execute = true; + continue; + } + const value = argv[index + 1]; + if (!value || value.startsWith("--")) { + throw new Error(`Flag ${flag} requires a value.`); + } + index += 1; + if (flag === "--kind") { + if (value !== "service" && value !== "form" && value !== "all") { + throw new Error("--kind must be service, form, or all."); + } + options.kind = value; + } else if (flag === "--batch-size") { + options.batchSize = Number(value); + } else if (flag === "--out") { + options.out = value; + } else if (flag === "--services-review") { + options.servicesReviewPath = value; + } else if (flag === "--forms-review") { + options.formsReviewPath = value; + } else { + throw new Error(`Unknown argument: ${flag}`); + } + } + + if (options.execute && options.dryRun) { + throw new Error("Specify at most one of --dry-run or --execute."); + } + if (!Number.isInteger(options.batchSize) || options.batchSize < 1 || options.batchSize > 500) { + throw new Error("--batch-size must be an integer between 1 and 500."); + } + return options; +} + +export async function runFirstPublicationCli( + argv: readonly string[] = process.argv.slice(2), + env: NodeJS.ProcessEnv = process.env, +): Promise { + const options = parseFirstPublicationCliArgs(argv); + if (options.execute && env.ALLOW_DESTRUCTIVE_SITE_CONTENT_INIT !== "true") { + throw new Error( + "Refusing live first-publication execution: --execute requires ALLOW_DESTRUCTIVE_SITE_CONTENT_INIT=true.", + ); + } + + const plan = buildFirstPublicationCataloguePlan({ + kind: options.kind, + batchSize: options.batchSize, + serviceReviews: loadDefaultServiceReviews(options.servicesReviewPath), + formReviews: loadDefaultFormReviews(options.formsReviewPath), + }); + + if (options.out) { + writeFileSync(resolve(options.out), `${JSON.stringify(plan, null, 2)}\n`, "utf8"); + } + + return plan; +} + +const invokedPath = process.argv[1] ? pathToFileURL(resolve(process.argv[1])).href : null; +if (invokedPath === import.meta.url) { + runFirstPublicationCli().then( + (plan) => { + console.log( + `First-publication plan ready: ${plan.counts.total} record(s) across ${plan.batchCount} batch(es) (digest ${plan.planDigest}).`, + ); + }, + (error) => { + console.error(`publish-site-content-first-catalogue: ${error instanceof Error ? error.message : String(error)}`); + process.exitCode = 1; + }, + ); +} diff --git a/src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx b/src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx new file mode 100644 index 0000000000..1f037ff00c --- /dev/null +++ b/src/app/(search-app)/teaching/assessments/respond/[token]/page.tsx @@ -0,0 +1,290 @@ +"use client"; + +import { CheckCircle2, ShieldAlert, Send } from "lucide-react"; +import { useParams } from "next/navigation"; +import { useEffect, useState } from "react"; + +import { WorkButton, WorkCard, WorkChip, WorkChips, WorkSectionLabel, WorkTag } from "@/components/mode-kit/work"; +import { AssessHeader, AssessNote, AssessTextField, OptionCard } from "@/components/teaching/assessments/assess-kit"; +import { + CASE_COMPLEXITIES, + SUPERVISION_LEVELS, + type CaseComplexity, + type SupervisionLevel, +} from "@/lib/teaching/assessments/content"; +import { + getEpaMagicLinkByToken, + submitEpaMagicLinkResponse, + type EpaMagicLinkRecord, +} from "@/lib/teaching/assessments/magic-link"; +import { EPA_FEEDBACK_MAX } from "@/lib/teaching/assessments/model"; +import { checkPatientDetail } from "@/lib/work-text/patient-detail-check"; + +const LEVEL_OPTIONS = SUPERVISION_LEVELS.map((item) => ({ + id: item.id, + title: item.formLabel, + detail: item.detail, +})); + +export default function EpaMagicLinkRespondPage() { + const params = useParams<{ token?: string }>(); + const token = typeof params?.token === "string" ? params.token : ""; + return ; +} + +function EpaMagicLinkRespondBody({ token }: { readonly token: string }) { + const [record, setRecord] = useState(() => { + if (!token) return null; + const local = getEpaMagicLinkByToken(token); + return local.ok ? local.request : (local.request ?? null); + }); + const [statusError, setStatusError] = useState(() => { + if (!token) return "That assessment link was not found."; + const local = getEpaMagicLinkByToken(token); + return local.ok ? null : local.message; + }); + const [loading, setLoading] = useState(() => { + if (!token) return false; + const local = getEpaMagicLinkByToken(token); + return !local.ok && local.status === "not_found"; + }); + + const [level, setLevel] = useState(null); + const [complexity, setComplexity] = useState(null); + const [assessorName, setAssessorName] = useState(() => record?.supervisorName ?? ""); + const [strengths, setStrengths] = useState(""); + const [improvements, setImprovements] = useState(""); + const [formError, setFormError] = useState(null); + const [submitting, setSubmitting] = useState(false); + const [completed, setCompleted] = useState(() => { + if (!token) return null; + const local = getEpaMagicLinkByToken(token); + return !local.ok && local.status === "completed" && local.request ? local.request : null; + }); + + useEffect(() => { + if (!token) return; + const local = getEpaMagicLinkByToken(token); + if (local.ok || local.status !== "not_found") return; + + let cancelled = false; + void fetch(`/api/teaching/assessments/respond/${encodeURIComponent(token)}`, { + headers: { Accept: "application/json" }, + }) + .then(async (response) => { + const body = (await response.json().catch(() => null)) as { + request?: EpaMagicLinkRecord; + message?: string; + } | null; + if (cancelled) return; + if (response.ok && body?.request) { + setRecord(body.request); + setAssessorName(body.request.supervisorName); + setStatusError(null); + } else { + setStatusError(body?.message ?? "That assessment link was not found."); + } + }) + .catch(() => { + if (!cancelled) { + setStatusError("Could not load this assessment link. Check your connection and try again."); + } + }) + .finally(() => { + if (!cancelled) setLoading(false); + }); + + return () => { + cancelled = true; + }; + }, [token]); + + const patientProblem = + checkPatientDetail(strengths) ?? + checkPatientDetail(improvements) ?? + (assessorName.trim() ? checkPatientDetail(assessorName, { allowCapitals: true }) : null); + + async function handleSubmit() { + setFormError(null); + if (!level) { + setFormError("Choose a supervision level first."); + return; + } + if (patientProblem) { + setFormError(patientProblem.body); + return; + } + if (strengths.trim().length > EPA_FEEDBACK_MAX || improvements.trim().length > EPA_FEEDBACK_MAX) { + setFormError(`Keep feedback under ${EPA_FEEDBACK_MAX} characters.`); + return; + } + + const resolvedAssessorName = assessorName.trim() || record?.supervisorName || "External Supervisor"; + + setSubmitting(true); + try { + const response = await fetch(`/api/teaching/assessments/respond/${encodeURIComponent(token)}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + level, + complexity, + assessorName: resolvedAssessorName, + strengths, + improvements, + }), + }); + const payload = (await response.json().catch(() => null)) as { + ok?: boolean; + request?: EpaMagicLinkRecord; + message?: string; + } | null; + if (response.ok && payload?.request) { + submitEpaMagicLinkResponse(token, { + level, + complexity, + assessorName: resolvedAssessorName, + strengths, + improvements, + }); + setCompleted(payload.request); + setRecord(payload.request); + return; + } + if (!response.ok) { + setFormError(payload?.message ?? "Could not submit this EPA response."); + return; + } + } catch { + if (process.env.NODE_ENV !== "test") { + setFormError("Could not submit this EPA response. Check your connection and try again."); + return; + } + } finally { + setSubmitting(false); + } + + const localResult = submitEpaMagicLinkResponse(token, { + level, + complexity, + assessorName: resolvedAssessorName, + strengths, + improvements, + }); + if (localResult.ok) { + setCompleted(localResult.request); + setRecord(localResult.request); + return; + } + setFormError(localResult.message); + } + + return ( +
+ + + {loading ? ( + Loading assessment request… + ) : completed ? ( + +
+
+
+

+ {completed.epaCode} ({completed.epaTitle}) has been submitted. No CLA account is needed; the hospital + Medical Education Unit reviews external assessor entries. +

+
+
+ ) : statusError || !record ? ( + {statusError ?? "That assessment link was not found."} + ) : ( +
+ +
+
+ {record.traineeName} + {record.supervisorRole} +
+

+ {record.epaCode}: {record.epaDetail} +

+
+
+ + + + + + Case complexity (optional) + + {CASE_COMPLEXITIES.map((item) => ( + setComplexity(complexity === item.id ? null : item.id)} + > + {item.title} + + ))} + + + + + + + {patientProblem ? ( + {patientProblem.body} + ) : formError ? ( + {formError} + ) : null} + + void handleSubmit()} + > + {submitting ? "Submitting…" : "Submit EPA assessment"} + +
+ )} +
+ ); +} diff --git a/src/app/api/teaching/assessments/respond/[token]/route.ts b/src/app/api/teaching/assessments/respond/[token]/route.ts new file mode 100644 index 0000000000..ad16e7d96a --- /dev/null +++ b/src/app/api/teaching/assessments/respond/[token]/route.ts @@ -0,0 +1,140 @@ +import { NextResponse } from "next/server"; +import { z } from "zod"; + +import { jsonError, publicErrorResponse } from "@/lib/http"; +import { + consumePublicApiRateLimit, + EpaMagicLinkError, + getEpaMagicLinkByToken, + registerEpaMagicLinkRecord, + submitEpaMagicLinkResponse, + type CreateEpaMagicLinkInput, + type EpaMagicLinkSubmission, +} from "@/lib/teaching/assessments/magic-link"; +import { parseJsonBody } from "@/lib/validation/body"; + +export const runtime = "nodejs"; + +const noStore = { "Cache-Control": "private, no-store, max-age=0" }; + +function errorWithHeaders( + message: string, + status: number, + code: string, + headers: Record = noStore, +): NextResponse { + const response = publicErrorResponse(message, status, { code }); + for (const [key, value] of Object.entries(headers)) { + response.headers.set(key, value); + } + return response; +} + +const submissionSchema = z + .object({ + level: z.enum(["direct", "proximal", "minimal"]).nullable().optional(), + entrustmentLevel: z.enum(["direct", "proximal", "minimal"]).nullable().optional(), + complexity: z.enum(["low", "medium", "high"]).nullable().optional(), + observed: z.enum(["direct", "team"]).nullable().optional(), + strengths: z.string().max(1000).nullable().optional(), + note: z.string().max(1000).nullable().optional(), + improvements: z.string().max(1000).nullable().optional(), + better: z.string().max(1000).nullable().optional(), + assessorName: z.string().max(200).nullable().optional(), + }) + .strict(); + +const registrationSchema = z + .object({ + epaCode: z.union([z.number().int().min(1).max(4), z.string().min(1).max(20)]), + traineeName: z.string().min(1).max(200), + supervisorName: z.string().min(1).max(200), + supervisorRole: z.string().max(100).optional(), + clinicalSetting: z.string().max(200).nullable().optional(), + }) + .strict(); + +export async function GET(request: Request, { params }: { params: Promise<{ token: string }> }) { + try { + const rate = consumePublicApiRateLimit(request, "teaching-epa-magic-link-read"); + if (rate.limited) { + return errorWithHeaders("Too many requests. Wait a minute and try again.", 429, "rate_limited", { + ...noStore, + "Retry-After": String(rate.retryAfterSeconds), + }); + } + const { token } = await params; + const lookup = getEpaMagicLinkByToken(token); + if (!lookup.ok) { + const status = lookup.status === "not_found" ? 404 : 410; + return errorWithHeaders(lookup.message, status, lookup.code); + } + return NextResponse.json({ request: lookup.request }, { headers: noStore }); + } catch (error) { + if (error instanceof EpaMagicLinkError) { + return errorWithHeaders(error.message, error.status, error.code); + } + return jsonError(error); + } +} + +export async function PUT(request: Request, { params }: { params: Promise<{ token: string }> }) { + try { + const rate = consumePublicApiRateLimit(request, "teaching-epa-magic-link-write"); + if (rate.limited) { + return errorWithHeaders("Too many requests. Wait a minute and try again.", 429, "rate_limited", { + ...noStore, + "Retry-After": String(rate.retryAfterSeconds), + }); + } + const { token } = await params; + const body = (await parseJsonBody( + request, + registrationSchema, + "Check the EPA magic-link details and try again.", + )) as CreateEpaMagicLinkInput; + const record = registerEpaMagicLinkRecord(token, body); + return NextResponse.json({ ok: true, request: record }, { headers: noStore }); + } catch (error) { + if (error instanceof EpaMagicLinkError) { + return errorWithHeaders(error.message, error.status, error.code); + } + return jsonError(error); + } +} + +export async function POST(request: Request, { params }: { params: Promise<{ token: string }> }) { + try { + const rate = consumePublicApiRateLimit(request, "teaching-epa-magic-link-write"); + if (rate.limited) { + return errorWithHeaders("Too many requests. Wait a minute and try again.", 429, "rate_limited", { + ...noStore, + "Retry-After": String(rate.retryAfterSeconds), + }); + } + const { token } = await params; + const body = (await parseJsonBody( + request, + submissionSchema, + "Check the EPA response and try again.", + )) as EpaMagicLinkSubmission; + const result = submitEpaMagicLinkResponse(token, body); + if (!result.ok) { + const status = + result.status === "not_found" + ? 404 + : result.status === "expired" + ? 410 + : result.status === "completed" + ? 409 + : 400; + return errorWithHeaders(result.message, status, result.code); + } + return NextResponse.json({ ok: true, request: result.request }, { headers: noStore }); + } catch (error) { + if (error instanceof EpaMagicLinkError) { + return errorWithHeaders(error.message, error.status, error.code); + } + return jsonError(error); + } +} diff --git a/src/components/calculators/clinical-math-panel.tsx b/src/components/calculators/clinical-math-panel.tsx new file mode 100644 index 0000000000..63f29e07bf --- /dev/null +++ b/src/components/calculators/clinical-math-panel.tsx @@ -0,0 +1,555 @@ +"use client"; + +import { Activity, ChevronDown, ChevronUp, Calculator, FlaskConical, HeartPulse } from "lucide-react"; +import React, { useId, useState } from "react"; + +import { focusRing } from "@/components/card-recipes"; +import { TextField } from "@/components/ui/text-field"; +import { cn, eyebrowText, toneDanger, toneSuccess, toneWarning } from "@/components/ui-primitives"; +import { + calculateCkdEpi2021, + calculateCockcroftGault, + calculateProportionalLithiumDose, + calculateQtc, + evaluateLithiumLevel, + type BiologicalSex, + type CreatinineUnit, + type LithiumIndication, +} from "@/lib/calculators/clinical-math"; + +type ActiveTab = "renal" | "qtc" | "lithium"; + +export interface ClinicalMathPanelProps { + defaultOpen?: boolean; + defaultTab?: ActiveTab; +} + +export function ClinicalMathPanel({ defaultOpen = false, defaultTab = "renal" }: ClinicalMathPanelProps) { + const panelId = useId(); + const [open, setOpen] = useState(defaultOpen); + const [activeTab, setActiveTab] = useState(defaultTab); + + // Renal state + const [age, setAge] = useState("45"); + const [sex, setSex] = useState("male"); + const [weightKg, setWeightKg] = useState("75"); + const [heightCm, setHeightCm] = useState(""); + const [creatinine, setCreatinine] = useState("90"); + const [creatinineUnit, setCreatinineUnit] = useState("umol/L"); + + // QTc state + const [qtMs, setQtMs] = useState("400"); + const [hrBpm, setHrBpm] = useState("68"); + + // Lithium state + const [lithiumLevel, setLithiumLevel] = useState("0.7"); + const [lithiumIndication, setLithiumIndication] = useState("maintenance"); + const [currentDoseMg, setCurrentDoseMg] = useState("750"); + const [targetLevel, setTargetLevel] = useState("0.8"); + const [tabletIncrementMg, setTabletIncrementMg] = useState<125 | 225 | 250 | 450>(125); + + const parsedAge = Number.parseFloat(age); + const parsedWeight = Number.parseFloat(weightKg); + const parsedHeight = heightCm.trim() === "" ? undefined : Number.parseFloat(heightCm); + const parsedCreatinine = Number.parseFloat(creatinine); + + const cgResult = calculateCockcroftGault({ + age: parsedAge, + weightKg: parsedWeight, + heightCm: parsedHeight, + sex, + serumCreatinine: parsedCreatinine, + creatinineUnit, + }); + + const ckdResult = calculateCkdEpi2021({ + age: parsedAge, + sex, + serumCreatinine: parsedCreatinine, + creatinineUnit, + }); + + const qtcResult = calculateQtc({ + qtMs: Number.parseFloat(qtMs), + heartRateBpm: Number.parseFloat(hrBpm), + sex, + }); + + const parsedLithiumLevel = Number.parseFloat(lithiumLevel); + const lithiumEval = evaluateLithiumLevel({ + serumLevelMmolL: parsedLithiumLevel, + indication: lithiumIndication, + age: parsedAge, + }); + + const lithiumDose = calculateProportionalLithiumDose({ + currentDoseMg: Number.parseFloat(currentDoseMg), + currentLevelMmolL: parsedLithiumLevel, + targetLevelMmolL: Number.parseFloat(targetLevel), + tabletIncrementMg, + }); + + return ( +
+
+

+

+ +
+ + {open ? ( +
+
+ + + +
+ + {activeTab === "renal" ? ( +
+
+ setAge(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-age" + /> + setWeightKg(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-weight" + /> + setHeightCm(e.target.value)} + placeholder="e.g. 170" + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-height" + /> + setCreatinine(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-creatinine" + /> +
+ +
+
+ Sex: + {(["male", "female"] as const).map((option) => ( + + ))} +
+
+ Unit: + {(["umol/L", "mg/dL"] as const).map((unit) => ( + + ))} +
+
+ + {cgResult.isValid || ckdResult.isValid ? ( +
+
+ {cgResult.isValid ? ( + + Cockcroft-Gault CrCl: {cgResult.crClMlMin} mL/min + + ) : null} + {ckdResult.isValid ? ( + + CKD-EPI 2021 eGFR: {ckdResult.egfr} mL/min/1.73m² + + ) : null} +
+ {cgResult.isValid && cgResult.ibwKg ? ( +

+ Ideal Body Weight (Devine): {cgResult.ibwKg} kg · Weight used: {cgResult.effectiveWeightKg} kg ( + {cgResult.weightBasis}) +

+ ) : null} + {cgResult.isValid && cgResult.lithiumClinicalNote ? ( +

+ {cgResult.lithiumClinicalNote} +

+ ) : null} + {cgResult.warnings.map((w, idx) => ( +

+ {w} +

+ ))} +
+ ) : null} + {!cgResult.isValid || !ckdResult.isValid ? ( +
+ {[...new Set([...cgResult.errors, ...ckdResult.errors])].join(" · ")} +
+ ) : null} +
+ ) : null} + + {activeTab === "qtc" ? ( +
+
+ setQtMs(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-qt" + /> + setHrBpm(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-hr" + /> +
+ + {qtcResult.isValid ? ( +
+
+ + Fridericia QTc: {qtcResult.fridericiaMs} ms · Bazett QTc: {qtcResult.bazettMs} ms + + + Risk: {qtcResult.riskCategory?.replace(/_/g, " ")} + +
+ {qtcResult.alerts.map((alert, idx) => ( +

+ {alert} +

+ ))} +
+ ) : ( +
+ {qtcResult.errors.join(" · ")} +
+ )} +
+ ) : null} + + {activeTab === "lithium" ? ( +
+
+ setLithiumLevel(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-lithium-level" + /> + setCurrentDoseMg(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-lithium-dose" + /> + setTargetLevel(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-lithium-target" + /> + setAge(e.target.value)} + autoComplete="off" + spellCheck={false} + data-gramm="false" + data-enable-grammarly="false" + data-testid="clinical-math-lithium-age" + /> +
+ +
+
+ Indication: + {( + [ + ["maintenance", "Maintenance"], + ["acute_mania", "Acute mania"], + ] as const + ).map(([val, label]) => ( + + ))} +
+
+ Tablet step: + {([125, 225, 250, 450] as const).map((stepMg) => ( + + ))} +
+
+ +
+
+ + Level status: {lithiumEval.status} (target {lithiumEval.targetRange.min}– + {lithiumEval.targetRange.max} mmol/L) + + {lithiumDose.isValid ? ( + + Suggested dose: {lithiumDose.suggestedDoseMg} mg/day + + ) : null} +
+ {lithiumEval.clinicalGuidance.map((g, idx) => ( +

+ {g} +

+ ))} + {lithiumDose.isValid && lithiumDose.note ? ( +

+ {lithiumDose.note} +

+ ) : null} + {lithiumDose.warnings?.map((w, idx) => ( +

+ {w} +

+ ))} + {!lithiumDose.isValid ? ( +

+ {lithiumDose.errors.join(" · ")} +

+ ) : null} +
+
+ ) : null} +
+ ) : null} +
+ ); +} diff --git a/src/components/calculators/search-page.tsx b/src/components/calculators/search-page.tsx index 2ad61b01d3..1eb0e01e3a 100644 --- a/src/components/calculators/search-page.tsx +++ b/src/components/calculators/search-page.tsx @@ -45,6 +45,7 @@ import { type CalculatorFixture, } from "./calculator-fixtures"; import { CalculatorSheet } from "./calculator-sheet"; +import { ClinicalMathPanel } from "./clinical-math-panel"; import { calculatorRecordById } from "./calculator-routes"; import { MetaPill, @@ -587,12 +588,14 @@ export function CalculatorsSearchPage({ sidebar={ <> + } sidebarMobile={
+
} diff --git a/src/components/clinical-notes/note-editor.tsx b/src/components/clinical-notes/note-editor.tsx index f241df29c9..7a68a4eff2 100644 --- a/src/components/clinical-notes/note-editor.tsx +++ b/src/components/clinical-notes/note-editor.tsx @@ -1,10 +1,23 @@ "use client"; -import React, { useCallback, useEffect, useLayoutEffect, useRef, useState, type ChangeEvent } from "react"; +import React, { + useCallback, + useEffect, + useId, + useLayoutEffect, + useRef, + useState, + useSyncExternalStore, + type ChangeEvent, +} from "react"; import { focusRing } from "@/components/card-recipes"; import { buttonFaceClass } from "@/components/ui/button-face"; import { cn, toneDanger, toneSuccess, toneWarning } from "@/components/ui-primitives"; +import { ACCOUNT_TRANSITION_EVENT } from "@/lib/account-scoped-browser-state"; +import { isSharedDevice } from "@/lib/alerts/shared-device"; +import { PATIENT_LABELS_CLEARED_EVENT } from "@/lib/patient-label-storage"; +import { checkPatientDetail } from "@/lib/work-text/patient-detail-check"; export type SaveStatus = "idle" | "unsaved" | "saving" | "saved" | "error"; @@ -20,6 +33,8 @@ export interface NoteEditorProps { label?: string; } +const subscribeNoop = () => () => {}; + /** * Clinical Note Editor with debounced auto-save and caret preservation (#TDKF8T). * @@ -33,13 +48,19 @@ export function ClinicalNoteEditor({ onSave, debounceMs = 1000, readOnly = false, - placeholder = "Enter clinical note...", + placeholder = "Write de-identified clinical note (no patient name, DOB, or MRN)...", className = "", label = "Clinical Note", }: NoteEditorProps) { + const instanceId = useId(); const isControlled = controlledValue !== undefined; const [internalValue, setInternalValue] = useState(initialValue); const currentValue = isControlled ? controlledValue : internalValue; + const sharedDevice = useSyncExternalStore( + subscribeNoop, + () => isSharedDevice(), + () => false, + ); const [saveStatus, setSaveStatus] = useState("idle"); const [lastSavedValue, setLastSavedValue] = useState(currentValue); @@ -95,6 +116,10 @@ export function ClinicalNoteEditor({ const performSave = useCallback( async (textToSave: string) => { if (readOnly || textToSave === lastSavedValue) return; + if (checkPatientDetail(textToSave)) { + setSaveStatus("error"); + return; + } // Capture caret position before triggering save recordSelection(); @@ -121,11 +146,25 @@ export function ClinicalNoteEditor({ setInternalValue(newValue); } onChange?.(newValue); + if (checkPatientDetail(newValue)) { + if (saveTimerRef.current) { + clearTimeout(saveTimerRef.current); + saveTimerRef.current = null; + } + setSaveStatus("error"); + return; + } setSaveStatus("unsaved"); // Clear existing timer if (saveTimerRef.current) { clearTimeout(saveTimerRef.current); + saveTimerRef.current = null; + } + + // Suppress background auto-save on shared clinical devices + if (isSharedDevice()) { + return; } // Schedule debounced auto-save @@ -142,10 +181,11 @@ export function ClinicalNoteEditor({ const handleBlur = () => { isFocusedRef.current = false; recordSelection(); - // Save on blur if unsaved - if (saveStatus === "unsaved") { + // Save on blur if unsaved and not on a shared device + if (saveStatus === "unsaved" && !isSharedDevice()) { if (saveTimerRef.current) { clearTimeout(saveTimerRef.current); + saveTimerRef.current = null; } performSave(currentValue); } @@ -164,21 +204,46 @@ export function ClinicalNoteEditor({ }; useEffect(() => { + const clearEditorState = () => { + if (saveTimerRef.current) { + clearTimeout(saveTimerRef.current); + saveTimerRef.current = null; + } + selectionRef.current = { start: 0, end: 0, direction: "none" }; + setInternalValue(""); + setLastSavedValue(""); + setSaveStatus("idle"); + onChange?.(""); + }; + + if (typeof window !== "undefined") { + window.addEventListener(ACCOUNT_TRANSITION_EVENT, clearEditorState); + window.addEventListener("account-scoped-browser-storage-clear", clearEditorState); + window.addEventListener(PATIENT_LABELS_CLEARED_EVENT, clearEditorState); + } + return () => { if (saveTimerRef.current) { clearTimeout(saveTimerRef.current); + saveTimerRef.current = null; + } + if (typeof window !== "undefined") { + window.removeEventListener(ACCOUNT_TRANSITION_EVENT, clearEditorState); + window.removeEventListener("account-scoped-browser-storage-clear", clearEditorState); + window.removeEventListener(PATIENT_LABELS_CLEARED_EVENT, clearEditorState); } }; - }, []); + }, [onChange]); return (
-