Skip to content

feat(tables): add accent-free province columns to the clinic and patient static tables - #30

Open
TatianaTchouakam wants to merge 1 commit into
devfrom
feat/clinic-province-ascii
Open

TatianaTchouakam wants to merge 1 commit into
devfrom
feat/clinic-province-ascii

Conversation

@TatianaTchouakam

@TatianaTchouakam TatianaTchouakam commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Ticket 2.

Accent-free province columns

Follow-up to the question on #21. The official province name keeps its spelling ("Takéo"); a second column holds the same name without accents ("Takeo"), case and spaces kept. The accent-free copy is safe for joins, filters and maps that may not handle accented characters.

Table Official name New column
clinic_data_static clinic_province clinic_province_ascii
patient_data_static province province_ascii

Examples: "Takéo" → "Takeo", "Hà Nội" → "Ha Noi", "Đà Nẵng" → "Da Nang", "Bangkok" → "Bangkok".

Changes

  • src/a4d/tables/accents.py (new), shared by both tables:
    • fold_accents: NFKD normalisation, then combining marks removed; "đ"/"Đ" mapped by hand (they are letters of their own in Unicode, not "d" with an accent).
    • add_ascii_columns(df, columns): adds <column>_ascii for each listed column present in the frame.
  • src/a4d/tables/clinic.py: clinic_province_ascii added right after the forward fill, so every row already has its province. Columns listed in _ASCII_COLUMNS, so other name columns can be added later.
  • src/a4d/tables/patient.py: province_ascii added to patient_data_static, after the one-row-per-patient grouping.
  • Tests (invented IDs only):
    • tests/test_tables/test_accents.py (new): 3 tests for the shared functions.
    • tests/test_tables/test_patient.py: 1 test, the static table keeps province and adds province_ascii.

Checks

  • ruff format, ruff check: clean.
  • pytest: 1,405 passed, 66 skipped.
  • On the current clinic_data.xlsx (59 rows): clinic_province_ascii is present. No province in the clinic master data has an accent today, so both clinic columns are identical for now. The accented names appear in the patient table, where province holds the canonical names from allowed_provinces.yaml.

@TatianaTchouakam
TatianaTchouakam force-pushed the feat/clinic-province-ascii branch from 52b40b9 to d163148 Compare October 28, 2026 11:53
The official name keeps its spelling ("Takéo"); a new <column>_ascii
column holds it without accents ("Takeo"), for joins, filters and maps:
clinic_province_ascii in clinic_data_static and province_ascii in
patient_data_static. Shared helpers in src/a4d/tables/accents.py.
Tests in test_accents.py and test_patient.py.
@TatianaTchouakam
TatianaTchouakam force-pushed the feat/clinic-province-ascii branch from d163148 to a6de9c1 Compare October 28, 2026 11:55
@TatianaTchouakam TatianaTchouakam changed the title Add accent-free province columns to the clinic and patient static tables feat(tables): add accent-free province columns to the clinic and patient static tables Oct 28, 2026
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.

1 participant