Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
Job has been terminated due to a temporary spike in resource usage and may be restarted later.
Error code: JobManagerCrashedError
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
text string |
|---|
# Current approach |
Paths here are relative to `final_submit/`, the working folder. The repository |
root above it is context only. For the extraction/WER background and the history |
of measured variants, see [`md/RAW_JSON_EXTRACTION_AND_WER.md`](md/RAW_JSON_EXTRACTION_AND_WER.md). |
## 1. Extraction |
`src/exp_wer.py::gen_rule_drugs_extra3_spans` is the extraction entry point. |
It calls the rule extractor and assertion annotator with candidate mapping |
disabled, adds the extra3 gazetteers, removes non-drug procedures, and applies |
the vital-sign policy. |
Temperature, pulse, heart rate, respiratory rate, and blood pressure are not |
lab tests. Their measured values are removed with them. SpO2 is the explicit |
exception: `SpO2` is `TÊN_XÉT_NGHIỆM` and values such as `98%` are |
`KẾT_QUẢ_XÉT_NGHIỆM`. |
The extraction database `data/rxterms.db` is used only to discover additional |
drug spans. It does not produce RxNorm candidates. |
## 2. Drug candidates |
`src/exact_candidates.py::DrugMapper` loads the complete drug source flow and |
executes its dictionary build and `FixedClinicalPipeline` stages. Only external |
filesystem paths are replaced with paths inside this bundle. Source lineage and |
engine integrity are protected by SHA-256 checks. |
Inputs: |
- `engines/drug/RXNCONSO.RRF` |
- `engines/drug/vietnamese_to_us_generic_drugs_corrected.json` |
The resulting mapper runs only for `THUỐC`. It produces at most the candidate |
returned by the source flow pipeline. Measured parity is 269/269 drug entities |
against the supplied Desktop output. |
## 3. ICD candidates |
`IcdMapper` executes the current ICD engine stages for: |
- ICD loading and normalization. |
- Exact indexes and hard aliases. |
- BGE-M3 dense and sparse embeddings. |
- Character n-gram TF-IDF and BM25. |
- Reciprocal-rank fusion. |
- `BAAI/bge-reranker-v2-m3` cross-encoder reranking. |
- Manual exact, multi-code, and abstention rules. |
- The prediction function with `OUTPUT_TOP_K=1`. |
It maps `CHẨN_ĐOÁN` only. It does not create new candidates for |
`TRIỆU_CHỨNG`, matching the source flow's batch-update cell. |
Repeated identical diagnosis strings are memoized in memory. This does not |
change deterministic outputs; it avoids repeating the same reranker and Qwen |
work within one run. |
## 4. Runtime and accelerator adaptations |
Two environment adaptations make the source flow portable: |
1. The default device is CUDA and startup fails if CUDA/ROCm is unavailable. |
CUDA follows the float16 branch; explicit MPS and CPU modes use |
float32. An opt-in `auto` mode selects CUDA, then MPS, then CPU. |
2. The Hugging Face BitsAndBytes Qwen loader is replaced by local |
Ollama transport using the same system prompt, user prompt, candidate list, |
JSON parsing, and greedy selection behavior. |
Ollama is pinned to version `0.32.1`; the Qwen name and complete model digest |
are hard-coded and verified through the Ollama API before inference. This also |
works when Ollama runs under a Linux systemd service account or on another host. |
No environment variable can select a different model. |
These adaptations preserve the pipeline and prompt semantics, but Ollama's |
quantized model is not byte-identical to the CUDA BitsAndBytes NF4 |
runtime. Exact numerical equivalence across those runtimes must not be claimed |
without a passing parity test. |
## 5. Fail-closed policy |
The old lightweight mapping functions raise `RuntimeError`. Production never |
imports the legacy RapidFuzz/exact-match candidate implementations. Startup |
also fails on source checksum drift, missing models, wrong model manifest, |
wrong Ollama version, or unavailable Ollama. |
## 6. Historical reference conflict |
The current checksummed ICD source flow and the historical reference output cannot |
both be the source of truth. In the first six completed files, 29 candidate |
lists differed. Examples: |
| Diagnosis | Current source flow | Desktop output | |
|---|---|---| |
| `hẹp tắc mạch vành` | `I25.0` | `I66` | |
| `ung thư tuyến giáp` | `C73` | `D09.3` | |
| `suy thận cấp` | `N17.9` | `N17` | |
| `ung thư biểu mô tuyến` | `C80.9` | `D05.1` | |
The source flow's regression checks explicitly require several values in the |
middle column. Reproducing the Desktop directory at 100% therefore requires |
End of preview.
No dataset card yet
- Downloads last month
- 11