Metadata-Version: 2.4
Name: meddeid-language-en
Version: 0.2.0
Summary: English en-GB and en-US language profiles for MedDeID
Author: Stig Hellemans
License-Expression: AGPL-3.0-only
Project-URL: Homepage, https://stighellemans.github.io/meddeid.github.io/
Project-URL: Documentation, https://stighellemans.github.io/meddeid.github.io/concepts/architecture/
Project-URL: Source, https://github.com/stighellemans/meddeid-language-en
Project-URL: Issues, https://github.com/stighellemans/meddeid-language-en/issues
Keywords: de-identification,clinical-nlp,english,healthcare
Classifier: Development Status :: 4 - Beta
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: meddeid-core<0.3,>=0.2
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == "dev"
Dynamic: license-file

# meddeid-language-en

Versioned English language capabilities for MedDeID. The package deliberately
contains two locale profiles rather than a generic `en` profile:

- `en-GB` covers England, Scotland, Wales, and Northern Ireland.
- `en-US` covers the 50 states, District of Columbia, Puerto Rico, U.S.
  Virgin Islands, Guam, American Samoa, and the Northern Mariana Islands.

Bare `en` is rejected because numeric dates, addresses, identifiers, clinical
terminology, and synthetic-safe phone ranges differ materially between the two
profiles.

The Python package provides post-processing, structured lookup records,
resource manifests, date/age parsing and pseudonymization. The npm package
provides matching subannotation profiles for the browser toolchain.

English parsing and wording use the same suite-wide declarative age policy as
every other profile; there is no independent English maximum-age algorithm.
Trusted full `patient.birth_date` values are expanded only into bounded,
locale-correct full-year representations.

## Mixed-locale subannotation

`meddeid-subannotate` can route a mixed corpus without splitting it. Install
this package and pin both ordinary profiles in one workspace:

```bash
npm install --no-save @meddeid/language-en@0.2.0
npm run profile -- set en-GB en-US
```

The application selects a child profile by an exact `metadata.lang` match for
each document. It fails when metadata is missing or unsupported rather than
guessing. The router manifest pins both profile descriptors and their lookup
hashes, while every document continues to use only its locale's rules.

## Resource workflow

```bash
python -m meddeid_language_en.resources audit --profile en-GB
python -m meddeid_language_en.resources audit --profile en-US
python -m meddeid_language_en.resources fetch --profile en-US --cache-dir .cache/sources
python -m meddeid_language_en.resources build --profile en-US --cache-dir .cache/sources
python -m meddeid_language_en.resources diff --profile en-US --cache-dir .cache/sources
```

`fetch` verifies the source hash recorded in `sources/*/sources.lock.json`.
`build` is deterministic and writes only licence-compatible derived records.
Unrestricted raw downloads remain in the ignored cache. Each runtime record
retains its source identifier and regional scope.

The committed audits enforce minimum counts and category-level regional
coverage, verify provenance completeness and logical multi-file hashes, and
report malformed values, duplicate keys, semantic collisions, count
regressions, and source drift. Current builds contain roughly 326,000 GB and
345,000 US structured lookup records; exact counts and hashes are recorded in
the profile audit manifests.

The included resources are designed for recognition and deterministic
synthetic generation. Real given-name and family-name tokens are sampled
independently; no person-level source records are ingested. Public institution,
street, and locality names may be used, while phones, email domains, and
identifiers use official fictional/test or deliberately non-assignable forms.

## Synthetic labels

English synthetic generation uses the 14-label token-classifier taxonomy and
must never emit `Anonymize_Other`. The full 15-label MedDeID taxonomy remains
valid for annotation import and other interoperability paths.

The generation allowlist, in its load-bearing order, is exactly:

```text
Address_Location:Caregiver
Address_Location:Other
Address_Location:Patient
Age_Birthdate
Contactdetails
Date
ID:Caregiver
ID:Patient
Name:Caregiver
Name:Other
Name:Patient
Organization:Healthcare
Organization:Other
Profession
```
