fairpractice-supply-pricing 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ - First version (Fairpractice wave 2, ver 1).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kurt Francisco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,175 @@
1
- # Temporary Holding Version
1
+ <!-- Generated by scripts/readme.mjs from the agent itself. Edit the manifest or fixtures/README.md, then run npm run readme. -->
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ # Fairpractice Supply Pricing (`fairpractice-supply-pricing`)
4
+
5
+ Checks supply and implant invoices: lines priced above the contract or GPO price, items bought off contract, bill-only implants with no purchase order, invoice prices that differ from the PO, duplicate invoice lines and rebates your spend should earn. No patient data is needed.
6
+
7
+ **Fairpractice Supply Pricing never pays, short-pays or approves invoices. Fairpractice Supply Pricing never sends disputes or credit requests to vendors.**
8
+
9
+ Fairpractice wave 2 ver 1 · Hospital and facility finance · MIT · Node 20 or newer · local files only · patient and staff identifiers masked before results reach the model · built on [`fairpractice-core`](../fairpractice-core)
10
+
11
+ ```bash
12
+ npx -y fairpractice-supply-pricing demo
13
+ npx -y fairpractice-supply-pricing mcp --root ./practice-files
14
+ ```
15
+
16
+ ## What the sample data shows
17
+
18
+ Fictional data only: Elmswood Community Hospital and made-up vendors (Quillmark Surgical, Fenwold Medical Supply). Item numbers and prices are invented.
19
+
20
+ - [`invoice-lines.csv`](fixtures/invoice-lines.csv): seven lines from October 2026. Planted: CV-1101 bills the glove line twice (1,480.00); MS-3300 is invoiced at 96.00 against the 82.00 contract and PO price (280.00 over for 20); the knee implant on MD-8802 is bill-only with no PO; MD-8803 bills suture kits at 18.50 against a 17.90 PO; CV-777 has no contract price. Quillmark's spend (8,065.00) passes the example 5,000.00 rebate threshold.
21
+ - [`contract-prices.csv`](fixtures/contract-prices.csv): contract prices with effective dates.
22
+ - [`purchase-orders.csv`](fixtures/purchase-orders.csv): PO prices by item.
23
+ - [`settings.json`](fixtures/settings.json): a 1% price tolerance and an example 2% Quillmark rebate above 5,000.00. [`settings-typo.json`](fixtures/settings-typo.json) misspells a setting and is refused.
24
+
25
+ ## A demo run
26
+
27
+ `npx -y fairpractice-supply-pricing demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
28
+
29
+ ```text
30
+ Fairpractice Supply Pricing demo (fictional practice, patients, staff and payers)
31
+
32
+ ▶ Check supply and implant invoices against contract prices
33
+ status: executed decision: allow
34
+ 7 invoice line(s), 11800 spend. 7 finding(s): duplicate_invoice 1, over_contract_price 1, implant_no_po 1, po_price_mismatch 2, off_contract 1, rebate_owed 1. Overpaid on duplicates and prices: 1778.
35
+ duplicate_invoice Fenwold Medical Supply invoice CV-1101 bills item CV-450 again (first on line 5), 1480.
36
+ over_contract_price Quillmark Surgical invoice MD-8801: MS-3300 (Laparoscopic trocar) at 96 against the contract price 82, 280 over for 20.
37
+ implant_no_po Quillmark Surgical invoice MD-8802: implant MS-9001 (Knee implant femoral component) billed with no purchase order.
38
+ po_price_mismatch Quillmark Surgical invoice MD-8803: MS-2210 at 18.5; the PO price is 17.9.
39
+ po_price_mismatch Quillmark Surgical invoice MD-8801: MS-3300 at 96; the PO price is 82.
40
+ off_contract Fenwold Medical Supply invoice CV-1102: CV-777 (Specialty wound dressing) has no contract price on the invoice date.
41
+ rebate_owed Quillmark Surgical: spend of 8065 reaches the rebate threshold; 2% is about 161.3.
42
+
43
+ ▶ Write the AP hold list
44
+ status: executed decision: allow
45
+ Supply and implant pricing written: 7 invoice line(s), 11800 spend. 7 finding(s): duplicate_invoice 1, over_contract_price 1, implant_no_po 1, po_price_mismatch 2, off_contract 1, rebate_owed 1. Overpaid on duplicates and prices: 1778. Files: fairpractice-out/supplies/supply-pricing.csv, fairpractice-out/supplies/supply-pricing.html.
46
+
47
+ ▶ Agent tries to pay an invoice itself
48
+ status: blocked decision: block
49
+ reason: Fairpractice Supply Pricing never pays, short-pays or approves invoices.
50
+ ```
51
+
52
+ ## Tools
53
+
54
+ | Tool | What it does | Policy |
55
+ |---|---|---|
56
+ | `supplies_check` | List duplicate lines, prices over contract, implants with no PO, PO price differences, off-contract items and rebates earned. | runs |
57
+ | `supplies_write_report` | Write supply-pricing.csv (one row per item, with blank owner and decision columns) and supply-pricing.html into out_dir (default fairpractice-out/supplies). | runs |
58
+ | `supplies_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
59
+ | `supplies_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
60
+ | `supplies_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
61
+ | `supplies_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
62
+ | `invoice_pay` | Fairpractice Supply Pricing never pays, short-pays or approves invoices. | refused |
63
+ | `vendor_dispute_send` | Fairpractice Supply Pricing never sends disputes or credit requests to vendors. | refused |
64
+
65
+ Any tool name not in this table is blocked, including names a model invents. Refused tools are listed so a model can see they exist and are refused.
66
+
67
+ ### `supplies_check` arguments
68
+
69
+ | Argument | What it is |
70
+ |---|---|
71
+ | `ap_lines` (required) | Supply and implant invoice lines under --root: invoice, vendor, PO, item number, description, quantity, unit price, invoice date and implant or bill-only flag |
72
+ | `contracts` (required) | Contract or GPO price file: vendor, item number, contract price and effective dates |
73
+ | `pos` | Optional purchase order lines: PO, item number and PO price |
74
+ | `settings` | Optional settings JSON: tolerance_pct, rebates |
75
+ | `status` | Only items with this status |
76
+ | `limit` | Most items to return to the model (the report file always has all of them) |
77
+
78
+ ## Columns it reads
79
+
80
+ Tables can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the names below (any case and punctuation), and by their usual names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`. Columns marked *masked* hold patient or staff identifiers.
81
+
82
+ The PointClickCare, MatrixCare and American HealthTech style names were written from public help pages and general knowledge, **not checked against real exports**. Run `npx fairpractice-supply-pricing inspect <file>` (column names and shapes only, never values) and name any column it misses in `remedy-sources.json`.
83
+
84
+ ### Invoice lines (`ap_lines`)
85
+
86
+ | Column | Type | Read from |
87
+ |---|---|---|
88
+ | `invoice` | text | Invoice, Invoice #, Invoice Number |
89
+ | `vendor` (required) | text | Vendor, Supplier, Vendor Name, Manufacturer |
90
+ | `po` | text | PO, PO #, PO Number, Purchase Order |
91
+ | `item` (required) | text | Item, Item #, Catalog #, Catalog Number, Mfr Part #, SKU, Product Code |
92
+ | `description` | text | Description, Item Description |
93
+ | `qty` | number | Qty, Quantity, Units |
94
+ | `unit_price` | amount | Unit Price, Price, Invoice Price |
95
+ | `date` | date | Date, Invoice Date |
96
+ | `implant` | text | Implant, Bill Only, Bill-Only, Implant Flag |
97
+
98
+ ### Contract prices (`contracts`)
99
+
100
+ | Column | Type | Read from |
101
+ |---|---|---|
102
+ | `vendor` (required) | text | Vendor, Supplier, Vendor Name, Manufacturer |
103
+ | `item` (required) | text | Item, Item #, Catalog #, Catalog Number, Mfr Part #, SKU, Product Code |
104
+ | `contract_price` (required) | amount | Contract Price, GPO Price, Tier Price, Price |
105
+ | `effective_from` | date | Effective, Effective From, Start Date |
106
+ | `effective_to` | date | Effective To, End Date, Expires |
107
+
108
+ ### Purchase orders (`pos`)
109
+
110
+ | Column | Type | Read from |
111
+ |---|---|---|
112
+ | `po` (required) | text | PO, PO #, PO Number, Purchase Order |
113
+ | `item` (required) | text | Item, Item #, Catalog #, Catalog Number, Mfr Part #, SKU, Product Code |
114
+ | `unit_price` | amount | Unit Price, PO Price, Price |
115
+
116
+ ## Settings file (`supplies_settings`)
117
+
118
+ A small JSON file you pass by path. A misspelled setting is refused by name rather than ignored, so a typo never silently changes a check.
119
+
120
+ | Setting | What it does |
121
+ |---|---|
122
+ | `tolerance_pct` | Invoice prices up to this percent above contract are not listed; default 1 |
123
+ | `rebates` | Rebate terms from your contracts: vendor, percent and spend threshold |
124
+
125
+ ## Memory
126
+
127
+ `supplies_learn` only proposes a fact; nothing changes until a named person accepts it with `supplies_accept_learning`, which is one click even in Auto. Facts live in a hash-chained file under `.remedy/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused.
128
+
129
+ | Kind | What an accepted fact does |
130
+ |---|---|
131
+
132
+ ## Install
133
+
134
+ Node 20 or newer. No other runtime dependencies besides `fairpractice-core` and `fairclaim-core`.
135
+
136
+ ```json
137
+ {
138
+ "mcpServers": {
139
+ "fairpractice-supply-pricing": {
140
+ "command": "npx",
141
+ "args": [
142
+ "-y",
143
+ "fairpractice-supply-pricing",
144
+ "mcp",
145
+ "--root",
146
+ "/path/to/practice-files"
147
+ ]
148
+ }
149
+ }
150
+ }
151
+ ```
152
+
153
+ Claude Code: `claude mcp add fairpractice-supply-pricing -- npx -y fairpractice-supply-pricing mcp --root .`, or use the plugin files in this folder.
154
+
155
+ ## CLI
156
+
157
+ ```bash
158
+ fairpractice-supply-pricing tools # every tool, its policy and arguments
159
+ fairpractice-supply-pricing sources # the columns each input is read from
160
+ fairpractice-supply-pricing inspect <file> # how a file would be read (names and shapes, never values)
161
+ fairpractice-supply-pricing call supplies_check '{"ap_lines":"<ap_lines>","contracts":"<contracts>"}'
162
+ fairpractice-supply-pricing eval # the private eval cases on the fictional fixtures
163
+ fairpractice-supply-pricing demo
164
+ ```
165
+
166
+ ## Patient and staff data
167
+
168
+ Results go to an AI model, so identifiers are masked before they leave the agent: patient and staff names become stable pseudonyms such as `PT-3f9a1c2e`, record and account numbers become `MRN-…` or `ACCT-…`, and e-mails and phone numbers are removed, also inside free text. Report files written to disk keep real names because staff work from them: keep them in a folder only your staff can open. The shared tests check that no fictional identifier from the fixtures reaches any eval result, and the hostile-input check plants spreadsheet formulas, HTML and AI-aimed instructions in the data. This keeps PHI away from the model; it is **not** a HIPAA compliance determination. Your business associate agreements, access controls and policies still apply.
169
+
170
+ ## Limits
171
+
172
+ - Reads only the files you give it. It does not log in to an EHR, practice-management system, payer portal, clearinghouse, state system, HR or payroll system, or bank.
173
+ - Payer, Medicare, Medicaid, state and federal rules are summarised from public material as of 2026, and the numbers are settings you supply; a billing, compliance or legal professional checks them before you rely on them.
174
+ - Not legal, billing, coding, tax, clinical or HIPAA advice. It does not diagnose or recommend care. A person decides what to bill, pay, report, file or send.
175
+ - Every call is written to a hash-chained audit log under `.remedy/` in the root. No network calls, no telemetry, no credentials. The bundled data is fictional.
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { main } from 'fairpractice-core';
4
+ import { manifest } from '../src/manifest.js';
5
+ import { demo } from '../src/demo.js';
6
+
7
+ main(manifest, { bin: 'fairpractice-supply-pricing', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
@@ -0,0 +1,304 @@
1
+ {
2
+ "suite": "fairpractice-supply-pricing",
3
+ "root": "..",
4
+ "data_note": "Fictional data in ../fixtures. Deterministic checks; no model is called.",
5
+ "no_names_in_report": true,
6
+ "cases": [
7
+ {
8
+ "id": "recall-empty-memory",
9
+ "tool": "supplies_recall",
10
+ "args": {},
11
+ "expect": {
12
+ "status": "executed",
13
+ "contains": [
14
+ "memory is empty"
15
+ ]
16
+ }
17
+ },
18
+ {
19
+ "id": "refuses-invoice_pay",
20
+ "tool": "invoice_pay",
21
+ "args": {},
22
+ "expect": {
23
+ "status": "blocked"
24
+ }
25
+ },
26
+ {
27
+ "id": "refuses-vendor_dispute_send",
28
+ "tool": "vendor_dispute_send",
29
+ "args": {},
30
+ "expect": {
31
+ "status": "blocked"
32
+ }
33
+ },
34
+ {
35
+ "id": "report",
36
+ "tool": "supplies_write_report",
37
+ "args": {
38
+ "ap_lines": "fixtures/invoice-lines.csv",
39
+ "contracts": "fixtures/contract-prices.csv",
40
+ "pos": "fixtures/purchase-orders.csv",
41
+ "settings": "fixtures/settings.json"
42
+ },
43
+ "expect": {
44
+ "status": "executed",
45
+ "matches": [
46
+ "\\.csv",
47
+ "\\.html"
48
+ ]
49
+ }
50
+ },
51
+ {
52
+ "id": "totals",
53
+ "tool": "supplies_check",
54
+ "args": {
55
+ "ap_lines": "fixtures/invoice-lines.csv",
56
+ "contracts": "fixtures/contract-prices.csv",
57
+ "pos": "fixtures/purchase-orders.csv",
58
+ "settings": "fixtures/settings.json"
59
+ },
60
+ "expect": {
61
+ "status": "executed",
62
+ "equals": {
63
+ "result.lines": 7,
64
+ "result.spend": 11800,
65
+ "result.overpaid": 1778
66
+ }
67
+ }
68
+ },
69
+ {
70
+ "id": "every-planted-status-in-order",
71
+ "tool": "supplies_check",
72
+ "args": {
73
+ "ap_lines": "fixtures/invoice-lines.csv",
74
+ "contracts": "fixtures/contract-prices.csv",
75
+ "pos": "fixtures/purchase-orders.csv",
76
+ "settings": "fixtures/settings.json"
77
+ },
78
+ "expect": {
79
+ "equals": {
80
+ "result.items.0.status": "duplicate_invoice",
81
+ "result.items.1.status": "over_contract_price",
82
+ "result.items.2.status": "implant_no_po",
83
+ "result.items.3.status": "po_price_mismatch",
84
+ "result.items.4.status": "po_price_mismatch",
85
+ "result.items.5.status": "off_contract",
86
+ "result.items.6.status": "rebate_owed"
87
+ },
88
+ "length": {
89
+ "result.items": 7
90
+ }
91
+ }
92
+ },
93
+ {
94
+ "id": "status-filter",
95
+ "tool": "supplies_check",
96
+ "args": {
97
+ "ap_lines": "fixtures/invoice-lines.csv",
98
+ "contracts": "fixtures/contract-prices.csv",
99
+ "pos": "fixtures/purchase-orders.csv",
100
+ "settings": "fixtures/settings.json",
101
+ "status": "duplicate_invoice"
102
+ },
103
+ "expect": {
104
+ "status": "executed",
105
+ "equals": {
106
+ "result.items.0.status": "duplicate_invoice"
107
+ }
108
+ }
109
+ },
110
+ {
111
+ "id": "limit-one",
112
+ "tool": "supplies_check",
113
+ "args": {
114
+ "ap_lines": "fixtures/invoice-lines.csv",
115
+ "contracts": "fixtures/contract-prices.csv",
116
+ "pos": "fixtures/purchase-orders.csv",
117
+ "settings": "fixtures/settings.json",
118
+ "limit": 1
119
+ },
120
+ "expect": {
121
+ "status": "executed",
122
+ "length": {
123
+ "result.items": 1
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "id": "report-spanish",
129
+ "tool": "supplies_write_report",
130
+ "args": {
131
+ "ap_lines": "fixtures/invoice-lines.csv",
132
+ "contracts": "fixtures/contract-prices.csv",
133
+ "pos": "fixtures/purchase-orders.csv",
134
+ "settings": "fixtures/settings.json",
135
+ "language": "es"
136
+ },
137
+ "expect": {
138
+ "status": "executed"
139
+ }
140
+ },
141
+ {
142
+ "id": "report-japanese",
143
+ "tool": "supplies_write_report",
144
+ "args": {
145
+ "ap_lines": "fixtures/invoice-lines.csv",
146
+ "contracts": "fixtures/contract-prices.csv",
147
+ "pos": "fixtures/purchase-orders.csv",
148
+ "settings": "fixtures/settings.json",
149
+ "language": "ja"
150
+ },
151
+ "expect": {
152
+ "status": "executed",
153
+ "matches": [
154
+ "\\.html"
155
+ ]
156
+ }
157
+ },
158
+ {
159
+ "id": "typo-setting-refused",
160
+ "tool": "supplies_check",
161
+ "args": {
162
+ "ap_lines": "fixtures/invoice-lines.csv",
163
+ "contracts": "fixtures/contract-prices.csv",
164
+ "pos": "fixtures/purchase-orders.csv",
165
+ "settings": "fixtures/settings-typo.json"
166
+ },
167
+ "expect": {
168
+ "status": "error"
169
+ }
170
+ },
171
+ {
172
+ "id": "null-settings-refused",
173
+ "tool": "supplies_check",
174
+ "args": {
175
+ "ap_lines": "fixtures/invoice-lines.csv",
176
+ "contracts": "fixtures/contract-prices.csv",
177
+ "pos": "fixtures/purchase-orders.csv",
178
+ "settings": null
179
+ },
180
+ "expect": {
181
+ "status": "error"
182
+ }
183
+ },
184
+ {
185
+ "id": "file-outside-root-refused",
186
+ "tool": "supplies_check",
187
+ "args": {
188
+ "ap_lines": "../../outside-root.csv",
189
+ "contracts": "fixtures/contract-prices.csv",
190
+ "pos": "fixtures/purchase-orders.csv",
191
+ "settings": "fixtures/settings.json"
192
+ },
193
+ "expect": {
194
+ "status": "error",
195
+ "contains": [
196
+ "outside the allowed root"
197
+ ]
198
+ }
199
+ },
200
+ {
201
+ "id": "missing-file-named",
202
+ "tool": "supplies_check",
203
+ "args": {
204
+ "ap_lines": "fixtures/missing-export.csv",
205
+ "contracts": "fixtures/contract-prices.csv",
206
+ "pos": "fixtures/purchase-orders.csv",
207
+ "settings": "fixtures/settings.json"
208
+ },
209
+ "expect": {
210
+ "status": "error",
211
+ "contains": [
212
+ "not found",
213
+ "missing-export.csv"
214
+ ]
215
+ }
216
+ },
217
+ {
218
+ "id": "no-settings-defaults",
219
+ "tool": "supplies_check",
220
+ "args": {
221
+ "ap_lines": "fixtures/invoice-lines.csv",
222
+ "contracts": "fixtures/contract-prices.csv",
223
+ "pos": "fixtures/purchase-orders.csv"
224
+ },
225
+ "expect": {
226
+ "status": "executed",
227
+ "not_contains": [
228
+ "\"rebate_owed\""
229
+ ],
230
+ "equals": {
231
+ "result.by_status.over_contract_price": 1
232
+ }
233
+ }
234
+ },
235
+ {
236
+ "id": "over-contract",
237
+ "tool": "supplies_check",
238
+ "args": {
239
+ "ap_lines": "fixtures/invoice-lines.csv",
240
+ "contracts": "fixtures/contract-prices.csv",
241
+ "pos": "fixtures/purchase-orders.csv",
242
+ "settings": "fixtures/settings.json",
243
+ "status": "over_contract_price"
244
+ },
245
+ "expect": {
246
+ "equals": {
247
+ "result.items.0.item": "MS-3300",
248
+ "result.items.0.contract_price": 82,
249
+ "result.items.0.amount": 280
250
+ }
251
+ }
252
+ },
253
+ {
254
+ "id": "duplicate-line",
255
+ "tool": "supplies_check",
256
+ "args": {
257
+ "ap_lines": "fixtures/invoice-lines.csv",
258
+ "contracts": "fixtures/contract-prices.csv",
259
+ "pos": "fixtures/purchase-orders.csv",
260
+ "settings": "fixtures/settings.json",
261
+ "status": "duplicate_invoice"
262
+ },
263
+ "expect": {
264
+ "equals": {
265
+ "result.items.0.invoice": "CV-1101",
266
+ "result.items.0.amount": 1480
267
+ }
268
+ }
269
+ },
270
+ {
271
+ "id": "rebate-estimate",
272
+ "tool": "supplies_check",
273
+ "args": {
274
+ "ap_lines": "fixtures/invoice-lines.csv",
275
+ "contracts": "fixtures/contract-prices.csv",
276
+ "pos": "fixtures/purchase-orders.csv",
277
+ "settings": "fixtures/settings.json",
278
+ "status": "rebate_owed"
279
+ },
280
+ "expect": {
281
+ "equals": {
282
+ "result.items.0.vendor": "Quillmark Surgical",
283
+ "result.items.0.extended": 8065,
284
+ "result.items.0.amount": 161.3
285
+ }
286
+ }
287
+ },
288
+ {
289
+ "id": "without-po-file",
290
+ "tool": "supplies_check",
291
+ "args": {
292
+ "ap_lines": "fixtures/invoice-lines.csv",
293
+ "contracts": "fixtures/contract-prices.csv",
294
+ "settings": "fixtures/settings.json"
295
+ },
296
+ "expect": {
297
+ "status": "executed",
298
+ "not_contains": [
299
+ "\"po_price_mismatch\""
300
+ ]
301
+ }
302
+ }
303
+ ]
304
+ }
@@ -0,0 +1,8 @@
1
+ # Fixtures
2
+
3
+ Fictional data only: Elmswood Community Hospital and made-up vendors (Quillmark Surgical, Fenwold Medical Supply). Item numbers and prices are invented.
4
+
5
+ - `invoice-lines.csv`: seven lines from October 2026. Planted: CV-1101 bills the glove line twice (1,480.00); MS-3300 is invoiced at 96.00 against the 82.00 contract and PO price (280.00 over for 20); the knee implant on MD-8802 is bill-only with no PO; MD-8803 bills suture kits at 18.50 against a 17.90 PO; CV-777 has no contract price. Quillmark's spend (8,065.00) passes the example 5,000.00 rebate threshold.
6
+ - `contract-prices.csv`: contract prices with effective dates.
7
+ - `purchase-orders.csv`: PO prices by item.
8
+ - `settings.json`: a 1% price tolerance and an example 2% Quillmark rebate above 5,000.00. `settings-typo.json` misspells a setting and is refused.
@@ -0,0 +1,133 @@
1
+ {
2
+ "case": "totals",
3
+ "id": [
4
+ ["invoice", "item"],
5
+ [
6
+ "vendor"
7
+ ]
8
+ ],
9
+ "planted": [
10
+ ["CV-1101/CV-450", "duplicate_invoice"],
11
+ ["MD-8801/MS-3300", "over_contract_price"],
12
+ ["MD-8802/MS-9001", "implant_no_po"],
13
+ ["MD-8803/MS-2210", "po_price_mismatch"],
14
+ ["MD-8801/MS-3300", "po_price_mismatch"],
15
+ ["CV-1102/CV-777", "off_contract"],
16
+ ["Quillmark Surgical", "rebate_owed"]
17
+ ],
18
+ "clean": [
19
+ {
20
+ "arg": "ap_lines",
21
+ "drop": [
22
+ ["Invoice #", "CV-1101"]
23
+ ],
24
+ "set": [
25
+ {
26
+ "where": [
27
+ ["Invoice #", "MD-8801"],
28
+ ["Catalog #", "MS-3300"]
29
+ ],
30
+ "column": "Unit Price",
31
+ "value": "82.00"
32
+ },
33
+ {
34
+ "where": ["Invoice #", "MD-8802"],
35
+ "column": "PO #",
36
+ "value": "PO-5020"
37
+ },
38
+ {
39
+ "where": ["Invoice #", "MD-8803"],
40
+ "column": "Unit Price",
41
+ "value": "17.90"
42
+ }
43
+ ],
44
+ "add": [
45
+ {
46
+ "Invoice #": "CV-1101",
47
+ "Vendor": "Fenwold Medical Supply",
48
+ "PO #": "PO-5010",
49
+ "Catalog #": "CV-450",
50
+ "Description": "Exam gloves box",
51
+ "Qty": "200",
52
+ "Unit Price": "7.40",
53
+ "Invoice Date": "2026-10-06",
54
+ "Bill Only": "no"
55
+ }
56
+ ]
57
+ },
58
+ {
59
+ "arg": "contracts",
60
+ "add": [
61
+ {
62
+ "Vendor": "Fenwold Medical Supply",
63
+ "Catalog #": "CV-777",
64
+ "Contract Price": "31.00",
65
+ "Effective From": "2026-01-01",
66
+ "Effective To": "2026-12-31"
67
+ }
68
+ ]
69
+ },
70
+ {
71
+ "arg": "settings",
72
+ "json": {
73
+ "rebates.0.threshold": 10000
74
+ }
75
+ }
76
+ ],
77
+ "mutations": [
78
+ {
79
+ "name": "suture kit billed 50 cents over contract and PO",
80
+ "edits": [
81
+ {
82
+ "arg": "ap_lines",
83
+ "set": [
84
+ {
85
+ "where": [
86
+ ["Invoice #", "MD-8801"],
87
+ ["Catalog #", "MS-2210"]
88
+ ],
89
+ "column": "Unit Price",
90
+ "value": "19.00"
91
+ }
92
+ ]
93
+ }
94
+ ],
95
+ "expect": [
96
+ ["MD-8801/MS-2210", "over_contract_price"],
97
+ ["MD-8801/MS-2210", "po_price_mismatch"]
98
+ ]
99
+ },
100
+ {
101
+ "name": "rebate threshold reached",
102
+ "edits": [
103
+ {
104
+ "arg": "settings",
105
+ "json": {
106
+ "rebates.0.threshold": 7000
107
+ }
108
+ }
109
+ ],
110
+ "expect": [
111
+ ["Quillmark Surgical", "rebate_owed"]
112
+ ]
113
+ },
114
+ {
115
+ "name": "glove contract ended in September",
116
+ "edits": [
117
+ {
118
+ "arg": "contracts",
119
+ "set": [
120
+ {
121
+ "where": ["Catalog #", "CV-450"],
122
+ "column": "Effective To",
123
+ "value": "2026-09-30"
124
+ }
125
+ ]
126
+ }
127
+ ],
128
+ "expect": [
129
+ ["CV-1101/CV-450", "off_contract"]
130
+ ]
131
+ }
132
+ ]
133
+ }
@@ -0,0 +1,5 @@
1
+ Vendor,Catalog #,Contract Price,Effective From,Effective To
2
+ Quillmark Surgical,MS-2210,18.50,2026-01-01,2026-12-31
3
+ Quillmark Surgical,MS-3300,82.00,2026-01-01,2026-12-31
4
+ Quillmark Surgical,MS-9001,4850.00,2026-01-01,2026-12-31
5
+ Fenwold Medical Supply,CV-450,7.40,2026-01-01,2026-12-31
@@ -0,0 +1,8 @@
1
+ Invoice #,Vendor,PO #,Catalog #,Description,Qty,Unit Price,Invoice Date,Bill Only
2
+ MD-8801,Quillmark Surgical,PO-5001,MS-2210,Suture kit,40,18.50,2026-10-05,no
3
+ MD-8801,Quillmark Surgical,PO-5001,MS-3300,Laparoscopic trocar,20,96.00,2026-10-05,no
4
+ MD-8802,Quillmark Surgical,,MS-9001,Knee implant femoral component,1,4850.00,2026-10-09,yes
5
+ MD-8803,Quillmark Surgical,PO-5007,MS-2210,Suture kit,30,18.50,2026-10-12,no
6
+ CV-1101,Fenwold Medical Supply,PO-5010,CV-450,Exam gloves box,200,7.40,2026-10-06,no
7
+ CV-1101,Fenwold Medical Supply,PO-5010,CV-450,Exam gloves box,200,7.40,2026-10-06,no
8
+ CV-1102,Fenwold Medical Supply,PO-5011,CV-777,Specialty wound dressing,25,31.00,2026-10-15,no
@@ -0,0 +1 @@
1
+ { "note": "This agent reads no patient data. The canaries are contract and invoice dates, which never appear in a result.", "values": ["2026-01-01", "2026-12-31", "2026-10-05"] }
@@ -0,0 +1,6 @@
1
+ PO #,Catalog #,PO Price
2
+ PO-5001,MS-2210,18.50
3
+ PO-5001,MS-3300,82.00
4
+ PO-5007,MS-2210,17.90
5
+ PO-5010,CV-450,7.40
6
+ PO-5011,CV-777,31.00
@@ -0,0 +1 @@
1
+ { "tolerance_percent": 1 }
@@ -0,0 +1 @@
1
+ { "tolerance_pct": 1, "rebates": [ { "vendor": "Quillmark Surgical", "pct": 2, "threshold": 5000 } ] }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
2
  "name": "fairpractice-supply-pricing",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "mcpName": "io.github.fpavia111-creator/fairpractice-supply-pricing",
5
+ "description": "Supply and implant pricing: invoice lines above the contract price, items bought off contract, bill-only implants with no purchase order, invoice prices that differ from the PO, duplicate invoices and rebates your spend should earn.",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "Kurt Francisco",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "main": "src/index.js",
13
+ "exports": {
14
+ ".": "./src/index.js",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "bin": {
18
+ "fairpractice-supply-pricing": "bin/fairpractice-supply-pricing.js"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "bin",
23
+ "fixtures",
24
+ "evals",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "LICENSE",
28
+ "server.json"
29
+ ],
30
+ "scripts": {
31
+ "test": "node scripts/run-tests.cjs",
32
+ "demo": "node bin/fairpractice-supply-pricing.js demo",
33
+ "eval": "node bin/fairpractice-supply-pricing.js eval"
34
+ },
35
+ "dependencies": {
36
+ "fairpractice-core": "^0.3.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/fpavia111-creator/fairpractice2-agents.git",
41
+ "directory": "packages/fairpractice-supply-pricing"
42
+ },
43
+ "homepage": "https://github.com/fpavia111-creator/fairpractice2-agents/tree/master/packages/fairpractice-supply-pricing#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/fpavia111-creator/fairpractice2-agents/issues"
46
+ },
47
+ "keywords": [
48
+ "mcp",
49
+ "mcp-server",
50
+ "healthcare",
51
+ "medical-billing",
52
+ "revenue-cycle",
53
+ "healthcare-compliance",
54
+ "supply-chain",
55
+ "implants",
56
+ "gpo",
57
+ "contract-pricing",
58
+ "hospital"
59
+ ]
60
+ }
package/server.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.fpavia111-creator/fairpractice-supply-pricing",
4
+ "title": "Fairpractice Supply Pricing",
5
+ "description": "Supply and implant pricing: invoice lines above the contract price, items bought off contract…",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/fpavia111-creator/fairpractice2-agents",
9
+ "source": "github",
10
+ "subfolder": "packages/fairpractice-supply-pricing"
11
+ },
12
+ "websiteUrl": "https://fair-agents.com/fairpractice.html",
13
+ "packages": [
14
+ {
15
+ "registryType": "npm",
16
+ "identifier": "fairpractice-supply-pricing",
17
+ "version": "0.1.0",
18
+ "transport": {
19
+ "type": "stdio"
20
+ },
21
+ "packageArguments": [
22
+ {
23
+ "type": "positional",
24
+ "value": "mcp"
25
+ },
26
+ {
27
+ "type": "named",
28
+ "name": "--root",
29
+ "description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
30
+ "isRequired": true,
31
+ "format": "filepath",
32
+ "valueHint": "exports_folder"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
package/src/demo.js ADDED
@@ -0,0 +1,9 @@
1
+ import { runDemo } from 'fairpractice-core';
2
+ import { manifest } from './manifest.js';
3
+
4
+ const f = { ap_lines: 'invoice-lines.csv', contracts: 'contract-prices.csv', pos: 'purchase-orders.csv', settings: 'settings.json' };
5
+ export const demo = () => runDemo(manifest, new URL('../fixtures', import.meta.url), 'Fairpractice Supply Pricing', [
6
+ { label: 'Check supply and implant invoices against contract prices', tool: 'supplies_check', args: f, list: (i) => `${i.status.padEnd(20)} ${i.message}` },
7
+ { label: 'Write the AP hold list', tool: 'supplies_write_report', args: f },
8
+ { label: 'Agent tries to pay an invoice itself', tool: 'invoice_pay', args: {} },
9
+ ]);
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { manifest } from './manifest.js';
2
+ export * from './logic.js';
package/src/logic.js ADDED
@@ -0,0 +1,44 @@
1
+ // Supply and implant pricing logic: invoice lines against contract prices and purchase orders, bill-only implants, duplicates and rebates. No I/O.
2
+ import { str, num, isoDate, payerKey, idKey, yes, round2, sortByStatus, countBy } from 'fairpractice-core';
3
+
4
+ const ORDER = { duplicate_invoice: 0, over_contract_price: 1, implant_no_po: 2, po_price_mismatch: 3, off_contract: 4, rebate_owed: 5 };
5
+
6
+ /**
7
+ * lines: [{ invoice, vendor, po, item, description, qty, unit_price, date, implant }]
8
+ * contracts: [{ vendor, item, contract_price, effective_from, effective_to }]
9
+ * pos: [{ po, item, unit_price }]
10
+ * opts: { tolerancePct = 1, rebates = [{ vendor, pct, threshold }] }
11
+ */
12
+ export function checkSupplies(lines, contracts, pos, { tolerancePct = 1, rebates = [] } = {}) {
13
+ const items = []; const seenInv = new Map(); const spend = new Map();
14
+ // Contract prices by vendor and item, PO lines by PO and item: looked up, not scanned, for each invoice line. The first row in file order wins, as before.
15
+ const cIndex = new Map(); for (const c of contracts) { const k = `${payerKey(c.vendor)}|${idKey(c.item)}`; if (!cIndex.has(k)) cIndex.set(k, []); const list = cIndex.get(k); const from = isoDate(c.effective_from), to = isoDate(c.effective_to); if (!list.some((x) => x.from === from && x.to === to && x.c.contract_price === c.contract_price)) list.push({ c, from, to }); }
16
+ const pIndex = new Map(); for (const p of pos) { const k = `${idKey(p.po)}|${idKey(p.item)}`; if (!pIndex.has(k)) pIndex.set(k, p); }
17
+ const priceOn = (vendor, item, date) => { const hit = (cIndex.get(`${payerKey(vendor)}|${idKey(item)}`) || []).find((x) => (!x.from || !date || x.from <= date) && (!x.to || !date || x.to >= date)); return hit ? hit.c : undefined; };
18
+ const poLine = (po, item) => pIndex.get(`${idKey(po)}|${idKey(item)}`);
19
+ for (const [i, l] of lines.entries()) {
20
+ const qty = num(l.qty) || 0; const price = num(l.unit_price); const date = isoDate(l.date); const vendor = str(l.vendor);
21
+ const ext = round2(qty * (price || 0)); spend.set(payerKey(vendor), { vendor, amount: round2(((spend.get(payerKey(vendor)) || {}).amount || 0) + ext) });
22
+ const base = { invoice: str(l.invoice) || `line ${i + 1}`, vendor, po: str(l.po) || null, item: str(l.item) || null, description: str(l.description) || null, qty, unit_price: price, extended: ext, amount: 0 };
23
+ const dupKey = `${payerKey(vendor)}|${idKey(l.invoice)}|${idKey(l.item)}`;
24
+ if (str(l.invoice) && seenInv.has(dupKey)) { items.push({ ...base, status: 'duplicate_invoice', first_line: seenInv.get(dupKey), amount: ext }); continue; }
25
+ seenInv.set(dupKey, i + 1);
26
+ const c = priceOn(vendor, l.item, date); let over = false;
27
+ if (c && price !== null) { const cp = num(c.contract_price); if (price > cp * (1 + tolerancePct / 100)) over = items.push({ ...base, status: 'over_contract_price', contract_price: cp, amount: round2((price - cp) * qty) }); }
28
+ else if (!c) items.push({ ...base, status: 'off_contract' });
29
+ if (yes(l.implant) && !str(l.po)) items.push({ ...base, status: 'implant_no_po' });
30
+ if (str(l.po) && pos.length) { const p = poLine(l.po, l.item); if (p && price !== null && Math.abs(price - num(p.unit_price)) > 0.005) items.push({ ...base, status: 'po_price_mismatch', po_price: num(p.unit_price), amount: over ? 0 : round2(Math.max(price - num(p.unit_price), 0) * qty), counted_above: over }); }
31
+ }
32
+ for (const r of rebates) { const s = spend.get(payerKey(r.vendor)); if (s && s.amount >= (num(r.threshold) || 0)) items.push({ invoice: null, vendor: s.vendor, po: null, item: null, description: null, qty: null, unit_price: null, extended: s.amount, status: 'rebate_owed', rebate_pct: num(r.pct), amount: round2(s.amount * (num(r.pct) || 0) / 100) }); }
33
+ const T = {
34
+ duplicate_invoice: (x) => [`${x.vendor} invoice ${x.invoice} bills item ${x.item} again (first on line ${x.first_line}), ${x.extended}.`, 'Hold the duplicate line from payment and confirm with the vendor.'],
35
+ over_contract_price: (x) => [`${x.vendor} invoice ${x.invoice}: ${x.item} (${x.description}) at ${x.unit_price} against the contract price ${x.contract_price}, ${x.amount} over for ${x.qty}.`, 'Short-pay or request a credit for the difference.'],
36
+ implant_no_po: (x) => [`${x.vendor} invoice ${x.invoice}: implant ${x.item} (${x.description}) billed with no purchase order.`, 'Match it to the bill-only form and raise the PO before payment.'],
37
+ po_price_mismatch: (x) => [`${x.vendor} invoice ${x.invoice}: ${x.item} at ${x.unit_price}; the PO price is ${x.po_price}.`, 'Pay the PO price, or correct the PO if the price change was agreed.'],
38
+ off_contract: (x) => [`${x.vendor} invoice ${x.invoice}: ${x.item} (${x.description}) has no contract price on the invoice date.`, 'Check for a contract or a substitute item on contract.'],
39
+ rebate_owed: (x) => [`${x.vendor}: spend of ${x.extended} reaches the rebate threshold; ${x.rebate_pct}% is about ${x.amount}.`, 'Confirm the rebate with the vendor or GPO and track its receipt.'],
40
+ };
41
+ for (const it of items) { const [m, f] = T[it.status](it); it.message = m; it.fix = f; }
42
+ sortByStatus(items, ORDER);
43
+ return { lines: lines.length, spend: round2([...spend.values()].reduce((s, x) => s + x.amount, 0)), overpaid: round2(items.filter((x) => ['duplicate_invoice', 'over_contract_price', 'po_price_mismatch'].includes(x.status)).reduce((s, x) => s + x.amount, 0)), by_status: countBy(items, 'status'), items };
44
+ }
@@ -0,0 +1,73 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { medAgent, fileArg, PRACTICE_LIMITS } from 'fairpractice-core';
3
+ import { checkSupplies } from './logic.js';
4
+
5
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
6
+ const t = (aliases, extra = {}) => ({ aliases, ...extra });
7
+ const VENDOR = t(['Vendor', 'Supplier', 'Vendor Name', 'Manufacturer'], { translate: 'vendor', required: true });
8
+ const ITEM = t(['Item', 'Item #', 'Catalog #', 'Catalog Number', 'Mfr Part #', 'SKU', 'Product Code'], { translate: 'item', required: true });
9
+ const PRICE = (aliases) => t(aliases, { type: 'money', translate: 'unit_price' });
10
+
11
+ export const LINE_FIELDS = Object.freeze({
12
+ invoice: t(['Invoice', 'Invoice #', 'Invoice Number'], { translate: 'invoice' }),
13
+ vendor: VENDOR, po: t(['PO', 'PO #', 'PO Number', 'Purchase Order'], { translate: 'po' }), item: ITEM,
14
+ description: t(['Description', 'Item Description'], { translate: 'description' }),
15
+ qty: t(['Qty', 'Quantity', 'Units'], { type: 'number', translate: 'qty' }),
16
+ unit_price: PRICE(['Unit Price', 'Price', 'Invoice Price']),
17
+ date: t(['Date', 'Invoice Date'], { type: 'date', translate: 'date' }),
18
+ implant: t(['Implant', 'Bill Only', 'Bill-Only', 'Implant Flag'], { translate: false }),
19
+ });
20
+ export const CONTRACT_FIELDS = Object.freeze({
21
+ vendor: VENDOR, item: ITEM, contract_price: { ...PRICE(['Contract Price', 'GPO Price', 'Tier Price', 'Price']), required: true },
22
+ effective_from: t(['Effective', 'Effective From', 'Start Date'], { type: 'date', translate: false }),
23
+ effective_to: t(['Effective To', 'End Date', 'Expires'], { type: 'date', translate: 'expires' }),
24
+ });
25
+ export const PO_FIELDS = Object.freeze({ po: t(['PO', 'PO #', 'PO Number', 'Purchase Order'], { translate: 'po', required: true }), item: ITEM, unit_price: PRICE(['Unit Price', 'PO Price', 'Price']) });
26
+
27
+ const REBATE = { type: 'object', additionalProperties: false, required: ['vendor', 'pct'], properties: { vendor: { type: 'string', maxLength: 120, description: 'Vendor name' }, pct: { type: 'number', minimum: 0, maximum: 100, description: 'Rebate percent of spend' }, threshold: { type: 'number', minimum: 0, description: 'Spend in the period needed to earn it' } } };
28
+ const SETTINGS = { type: 'object', additionalProperties: false, properties: {
29
+ tolerance_pct: { type: 'number', minimum: 0, maximum: 50, description: 'Invoice prices up to this percent above contract are not listed; default 1' },
30
+ rebates: { type: 'array', items: REBATE, maxItems: 100, description: 'Rebate terms from your contracts: vendor, percent and spend threshold' },
31
+ } };
32
+
33
+ const args = {
34
+ ap_lines: fileArg('Supply and implant invoice lines under --root: invoice, vendor, PO, item number, description, quantity, unit price, invoice date and implant or bill-only flag'),
35
+ contracts: fileArg('Contract or GPO price file: vendor, item number, contract price and effective dates'),
36
+ pos: fileArg('Optional purchase order lines: PO, item number and PO price'),
37
+ settings: fileArg('Optional settings JSON: tolerance_pct, rebates'),
38
+ };
39
+ const run = (a, ctx) => {
40
+ const s = a.settings ? ctx.readJson(a.settings, 'supplies_settings') : {};
41
+ return checkSupplies(ctx.records(a.ap_lines, 'lines'), ctx.records(a.contracts, 'contracts'), a.pos ? ctx.records(a.pos, 'pos') : [], { tolerancePct: s.tolerance_pct ?? 1, rebates: s.rebates || [] });
42
+ };
43
+ const summary = (o) => `${o.lines} invoice line(s), ${o.spend} spend. ${Object.values(o.by_status).reduce((s, x) => s + x, 0)} finding(s): ${Object.entries(o.by_status).map(([k, v]) => `${k} ${v}`).join(', ') || 'none'}. Overpaid on duplicates and prices: ${o.overpaid}.`;
44
+
45
+ export const manifest = medAgent({
46
+ pkg, prefix: 'supplies', title: 'Fairpractice Supply Pricing',
47
+ description: 'Checks supply and implant invoices: lines priced above the contract or GPO price, items bought off contract, bill-only implants with no purchase order, invoice prices that differ from the PO, duplicate invoice lines and rebates your spend should earn. No patient data is needed.',
48
+ args, required: ['ap_lines', 'contracts'],
49
+ sources: { lines: { label: 'Invoice lines', args: ['ap_lines'], fields: LINE_FIELDS }, contracts: { label: 'Contract prices', args: ['contracts'], fields: CONTRACT_FIELDS }, pos: { label: 'Purchase orders', args: ['pos'], fields: PO_FIELDS } },
50
+ configSchemas: { supplies_settings: SETTINGS }, memoryKinds: {},
51
+ run, summary,
52
+ check: { title: 'Check supply pricing', description: 'List duplicate lines, prices over contract, implants with no PO, PO price differences, off-contract items and rebates earned.' },
53
+ report: {
54
+ title: { en: 'Supply and implant pricing', es: 'Precios de suministros e implantes', de: 'Preise für Material und Implantate', fr: 'Prix des fournitures et implants', pt: 'Preços de suprimentos e implantes', it: 'Prezzi di forniture e impianti', ja: '診療材料・インプラントの価格', zh: '耗材与植入物价格', ko: '진료 재료·임플란트 가격' },
55
+ base: 'supply-pricing',
56
+ rows: (o) => o.items.map((i) => ({ status: i.status, invoice: i.invoice || '', vendor: i.vendor, po: i.po || '', item: i.item || '', description: i.description || '', qty: i.qty ?? '', unit_price: i.unit_price ?? '', amount: i.amount, message: i.message, fix: i.fix })),
57
+ htmlColumns: ['status', 'invoice', 'vendor', 'item', 'description', 'unit_price', 'amount', 'message'],
58
+ sections: (o) => [{ title: { en: 'Findings by type' }, rows: Object.entries(o.by_status).map(([status, count]) => ({ status, count })), columns: ['status', 'count'] }],
59
+ limits: [PRACTICE_LIMITS.files, PRACTICE_LIMITS.estimate, 'Item numbers must match between the invoice and the price file; tier pricing, freight and contract exceptions need setup. It pays and disputes nothing.', PRACTICE_LIMITS.advice],
60
+ },
61
+ refused: [
62
+ { name: 'invoice_pay', category: 'move_money', description: 'Fairpractice Supply Pricing never pays, short-pays or approves invoices.' },
63
+ { name: 'vendor_dispute_send', category: 'binding_send', description: 'Fairpractice Supply Pricing never sends disputes or credit requests to vendors.' },
64
+ ],
65
+ prompt: { title: 'Supply pricing review', description: 'Walks the host model through a weekly supply invoice review.', text: `You are helping a supply chain or accounts payable lead with fairpractice-supply-pricing.
66
+
67
+ Rules: it only reads files.
68
+
69
+ 1. Call supplies_check with the invoice lines, contract prices, POs and settings.
70
+ 2. Lead with duplicates and prices over contract, with the dollars.
71
+ 3. Then implants with no PO and off-contract items; name rebates to track.
72
+ 4. Call supplies_write_report for the AP hold list.` },
73
+ });