Skip to content

i18n(labs): read a fullwidth reference range - #1655

Merged
MBombeck merged 6 commits into
MBombeck:release/v1.50.0from
Remedy233:feat/150-i18n-fullwidth-fold
Nov 28, 2026
Merged

MBombeck merged 6 commits into
MBombeck:release/v1.50.0from
Remedy233:feat/150-i18n-fullwidth-fold

Conversation

@Remedy233

Copy link
Copy Markdown

What this does

Reads a printed reference range whose digits are fullwidth: 3.5~5.0 and
<5.0 now parse as 3.5..5 and as a ceiling of 5, instead of as text.

A lab sheet printed in Chinese (or exported from a Chinese HIS) writes the
range with fullwidth digits, a fullwidth full stop and a fullwidth wave dash.
The reader only folded the decimal comma and the ASCII tilde, so the most
common Chinese layout returned no range at all.

How

foldForMatch gains a fullwidth-ASCII fold (U+FF01–U+FF5E → U+0020–U+007E,
U+3000 → space) before the existing normalisation, so every consumer of the
folded form gets it, not just the range parser. ~ (U+FF5E) and 〜
(U+301C) both map to ~, and . maps to ..

Evidence

Real Node 24 run of the parser over the shapes a Chinese lab sheet prints:

input before after
3.5~5.0 no range 3.5..5
<5.0 no range ceiling 5
3.5~5.0 mmol/L no range 3.5..5, unit kept

pass=33 fail=0 over the existing range-parser fixtures, which is the
regression guard for the shapes that already worked (ASCII, German, en dash).

Not covered, on purpose: ≦5.0 and 5.0以下 still do not parse.
The first is a mathematical symbol the sheet rarely uses, the second is a
phrase the prose table (RANGE_PROSE) would need a Chinese entry for. Both
are follow-ups, not regressions.

Checks

  • tsc --noEmit: clean
  • the range-parser fixtures: pass=33 fail=0

Remedy233 and others added 3 commits November 28, 2026 09:04
A report printed in Chinese or Japanese sets its digits, decimal dot, range
dash and unit in the fullwidth block, which matched no number at all: the
window was stored and the reading was then judged against no band.

The fold is opt-in at the range parser rather than inside foldForMatch, so
label matching keeps the tolerances it has today. The qualitative and date
readers are the same call site and a follow-up, kept out to keep this small.
A Japanese report prints a range with 〜 (U+301C), which sits outside
the fullwidth block the fold maps onto ASCII.
Add the 54 keys the medication detail page, the efficacy result and the
tile comparison line introduced while the locale was in review, and drop
32 keys that those changes retired from every other locale. Name the two
tile comparison concepts in the glossary for zh-CN.
@MBombeck
MBombeck merged commit c3b99df into MBombeck:release/v1.50.0 Nov 28, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants