Write metrics
write_metricsSave the readings of one lab report to the user's freddy, for one lab and one collection day. A report can also be a body composition scan (BIA or DEXA), a bone density scan, body measurements, a fitness test, a sleep study, a lung function test (spirometry) or an ECG: save each value that the report prints, also each value per arm, leg or trunk. Their new markers match only by a LOINC code that the report prints or by id: get the ids of a group with list, and pick the marker that fits the name, the body part, the side and the unit. For such a report, send the id of the group's marker that names the measurement the report prints, also when the name matches another marker. One save holds one reading per marker and day: freddy refuses a save that repeats a marker (lactate at each stage of a step test). Before you save: show the user every reading in a table and get an explicit yes. Copy each name, value, unit and range exactly as printed. Leave a field out when the report does not print it. Each reading must match a marker of freddy's list. Send the LOINC code only when the report prints it. When the report is not in English, also send the English name of each test in english. Call first with check: true: freddy then says which marker each reading matches and suggests markers for the others, and stores nothing. For a reading with no match, call with list (and day) to get the markers of a group. Then save each reading with the id of its marker. Also send each reading with no matching marker in the save: freddy does not save it, but files a request for the marker, and the user can import the report again once the marker is added. To correct a reading, save it again. To delete one, put its marker id in remove. Saved readings (source "Lab results", metrics lab_*) are as the report printed them: the range is the lab's own range, and one marker from two labs can have two names and two units.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"day": "<day>"
},
"name": "write_metrics"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| day | Yes | The collection day as printed, YYYY-MM-DD. | |
| list | No | Send alone with day, no readings and no remove: freddy lists the markers of one group (id, name, units) and stores nothing, so you can send the exact id. Add words to list only the markers whose name or other name holds them; a group with many markers needs words. | |
| time | No | The collection time as printed, local, with no offset. | |
| check | No | true: match the readings to markers and store nothing. | |
| issuer | No | The lab name as printed. | |
| remove | No | Saved readings of this day and lab to delete: the marker id (or lab_<id>) of each. | |
| readings | No |