MeridianMERIDIAN

Gender Code

identity.person.gender_code

Single-character sex/gender code. ICAO Doc 9303 passport sex field uses M (male), F (female), X (unspecified). ISO/IEC 5218 numeric coding uses 0 (not known), 1 (male), 2 (female), 9 (not applicable). Matched case-insensitively (ac-02).

Background

Origin

ISO/IEC 5218, Information technology — Codes for the representation of human sexes, is an international standard that represents human sexes with a language-neutral single-digit code.[1] Its four codes are 0 for not known, 1 for male, 2 for female and 9 for not applicable.[1] The standard was proposed in November 1976 and updated in June 2022.[1] It is maintained by the ISO/IEC JTC 1 subcommittee on data management and interchange, ISO/IEC JTC 1/SC 32.[1] The standard states that no significance is to be placed on male being coded 1 and female 2, which merely reflects existing practice in the countries that initiated it.[1] Since its 2022 revision, the standard states that its scope does not cover human gender identities.[1]

Use

The TEI Guidelines for encoding texts define a data.sex datatype whose values are 0, 1, 2 and 9.[2] TEI states that those values are taken from ISO 5218:2004.[2]

Keep 0 and 9 apart when you clean the column: not known and not applicable answer different questions, and folding both into a null loses that. (Meridian's view)

Where you'll meet it

Insee's Fichier des personnes décédées, published on data.gouv.fr, stores sex as a one-character numeric field at position 81 of each record.[3] In that file, 1 means male and 2 means female.[3]

Sources

  1. [1]ISO/IEC 5218 - Wikipediasecondary source
  2. [2]TEI macro data.sexdocumentation
  3. [3]Fichier des personnes décédéesdataset

Detection notes

Sourced to ICAO Doc 9303 (alpha M/F/X) and ISO/IEC 5218 (numeric 0/1/2/9). The prior ^[MFX]$ pattern was uppercase-only and its description wrongly listed `O` as valid — ICAO uses X (not O) for unspecified. Converted to an enum so case-insensitive matching flows from ac-02; the transform still uppercases for materialisation.

Use it

CLI · DuckDB
$ finetype infer -i "M" --mode column
→ identity.person.gender_code

SELECT ft_infer('M');
-- → 'identity.person.gender_code'
Cast expression
CAST(UPPER({col}) AS VARCHAR)

Schema

https://meridian.online/schemas/identity.person.gender_code · Frictionless type string

finetype taxonomy identity.person.gender_code -o json-schema

Type Registry