store_lab_values
Store and manage cancer patient lab values from documents for trend tracking, with deduplication checks and standardized parameter handling.
Instructions
Store parsed lab values from a document for trend tracking.
Includes deduplication checks:
If document_id already has stored values, returns skipped (unless force=True to update/replace).
If another document has values for the same lab_date, warns about collision (stores anyway but flags it).
Standardized parameter names: WBC, ABS_NEUT, ABS_LYMPH, PLT, HGB, ANC, ALT, AST, GMT, ALP, BILIRUBIN, CREATININE, eGFR, CEA, CA19_9, SII, NE_LY_RATIO
Args: document_id: Source document ID (should be a labs document). lab_date: Date of the lab test (YYYY-MM-DD). values: JSON array of objects, each with: parameter, value, unit, and optionally reference_low, reference_high, flag. Example: [{"parameter": "WBC", "value": 6.8, "unit": "10^9/L", "reference_low": 4.0, "reference_high": 10.0, "flag": ""}] force: If True, store even if document already has values (replaces existing via INSERT OR REPLACE).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | ||
| lab_date | Yes | ||
| values | Yes | ||
| force | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |