Files
alpha-id/tests/pipeline_mode_c_tests.rs
T
Brummel 6647a66bd0 feat: Mode C pipeline end-to-end (lexical + tags + fusion)
Implement Pipeline::load/suggest for Mode C: lexical search per segment,
cross-segment dedup via fusion, tag derivation, filter application.
Add meta_lookup fallback (exact → strip trailing 0 → 3-char root) to
bridge the ICD code granularity gap between the corpus (E11.90-style
6-char codes) and ClaML (which only stores E11, E11.0-style entries).
2026-05-18 17:04:34 +02:00

28 lines
1.0 KiB
Rust

use alpha_id::pipeline::Pipeline;
use alpha_id::model::{Config, Filter, Mode};
fn cfg() -> Config {
Config::load("config/default.toml").unwrap()
}
#[test]
fn mode_c_end_to_end_real_data() {
let p = Pipeline::load(&cfg()).unwrap();
let dictation = "Patient mit Diabetes mellitus Typ 2\n\nArterielle Hypertonie";
let res = p.suggest(dictation, Mode::C, &Filter::default(), 10);
assert!(!res.suggestions.is_empty());
assert!(res.suggestions.len() <= 10);
assert!(res.suggestions.iter().any(|s| s.icd_code.starts_with("E11")));
assert!(res.suggestions.iter().any(|s| s.icd_code.starts_with("I10")));
assert_eq!(res.diagnostics.segment_count, 2);
assert_eq!(res.diagnostics.mode, "C");
}
#[test]
fn billable_only_filter_excludes_three_digit_v_codes() {
let p = Pipeline::load(&cfg()).unwrap();
let f = Filter { billable_only: true, valid_only: true, chapters: None, exclude_exotic: false };
let res = p.suggest("Cholera", Mode::C, &f, 10);
assert!(res.suggestions.iter().all(|s| s.tags.billable && s.tags.valid));
}