code wiki / (root) / nx_climbout_docs.nx

nx_climbout_docs.nx source

↩ module page · 29 lines · 1778 B

1// nx_climbout_docs.nx -- R5c: feed REAL documents into the climb-out plan. Composes the doc-intelligence 2// extractor (nx_doc_extract: a bill's TEXT -> structured line-items) with the audit (nx_fin_audit: 3// line-items -> overcharges), so the climb-out "recover" figure comes from the person's ACTUAL bill text 4// (what the browser/scanner/upload produces via nx_html_to_text / nx_doc_scan), not pre-structured demo 5// arrays. The full chain: bill document -> extract -> audit -> the dollars to dispute. No floats, no hardware 6// writes. license_tier: ORIGINAL 7import "nx_syscalls.nx" 8import "nx_money.nx" 9import "nx_doc_extract.nx" 10import "nx_fin_audit.nx" 11 12// recover amount (cents) = overcharges found by auditing the line-items EXTRACTED from a bill's text. 13// packs (data): NCCI bundle pairs (pairA/pairB, np) + MUE limits (mcode/mmax, nm). Writes the extracted 14// line-item count to out_count[0]. 15func cor_recover_from_bill(bill_text: *u8, n: i64, pairA: *i64, pairB: *i64, np: i64, mcode: *i64, mmax: *i64, nm: i64, out_count: *i64) -> i64 { 16 let codes: *i64 = sys_mmap(8 * 64) as *i64 17 let dates: *i64 = sys_mmap(8 * 64) as *i64 18 let units: *i64 = sys_mmap(8 * 64) as *i64 19 let billed: *i64 = sys_mmap(8 * 64) as *i64 20 let cnt: i64 = dx_extract_bill(bill_text, n, codes, dates, units, billed, 64) 21 out_count[0] = cnt 22 let idx: *i64 = sys_mmap(8 * 64) as *i64 23 let amt: *i64 = sys_mmap(8 * 64) as *i64 24 let oc: *i64 = sys_mmap(16) as *i64 25 aud_duplicates(codes, dates, billed, cnt, idx, amt, oc); let r1: i64 = oc[0] 26 aud_unbundle(codes, cnt, pairA, pairB, np, billed, idx, amt, oc); let r2: i64 = oc[0] 27 aud_mue(codes, units, billed, cnt, mcode, mmax, nm, idx, amt, oc); let r3: i64 = oc[0] 28 return mny_add(mny_add(r1, r2), r3) 29}