Correct a recorded value
correct_valueFix a wrongly recorded health value by appending a corrected row with the original date and marking the old row entered-in-error. Nothing is deleted; a mismatch in expected value refuses the change.
Instructions
Fix a value that was recorded wrongly. This appends a new row with the corrected number and the ORIGINAL date, and marks the old row "entered-in-error" — permanently. Nothing is deleted or overwritten. unit says what newValue is in — lab tests too; omit it when the number already is the row’s stored unit. Read the record first: you need the row id, and expectedValue — the value you believe the row holds right now. On the hosted server it is required and the call is refused without it; everywhere, a mismatch refuses the call and writes nothing. On the hosted server this takes two calls: the first answers with what it would do and a confirm receipt; show it to the user and call again with confirm and approval (the user’s own words, quoted verbatim) only after their own yes, in their own words.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The id of the active row to correct. | |
| unit | No | The unit `newValue` is in. Omit when it already is the row’s stored unit. | |
| confirm | No | Hosted server, second call only: the receipt the first call returned, after the user’s own yes. | |
| approval | No | ||
| newValue | Yes | The corrected number. | |
| expectedValue | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The row id — cite this to correct the row later. | |
| unit | Yes | The unit the corrected value is stored in. | |
| value | Yes | The number as stored. | |
| metric | Yes | The metric or test the row is for. | |
| confirm | No | The receipt to send back, unchanged, after the user’s own yes. | |
| proposal | No | True on the first call of a two-phase write: nothing was written yet. | |
| correctsId | Yes | The row now marked "entered-in-error". | |
| recordedAt | Yes | The clinical day the row is filed under. | |
| confirmFrom | No | When the receipt becomes usable. Do not call before it. |