gender Must Be male, female, other, or unknown
The administrative-gender element is bound to a required value set with exactly four codes: male, female, other, unknown. Any other value is invalid.
FHIR · Error
The error
gender must be one of: male | female | other | unknownWhy it happens
Carrying an HL7v2 sex code straight into FHIR (M, F), using a display label (Male), or sending an empty string. HL7v2-to-FHIR conversions frequently miss this mapping.
How to fix it
Map the value to one of male, female, other, unknown (lowercase). When converting from HL7v2 PID-8, map M to male, F to female, O to other, U to unknown.
Example
The snippet below triggers the error:
{
"resourceType": "Patient",
"gender": "M"
}The corrected version:
{
"resourceType": "Patient",
"gender": "male"
}Frequently asked questions
How do I map HL7v2 sex codes to FHIR gender?
M to male, F to female, O to other, U or unknown sources to unknown. The A (ambiguous) and N (not applicable) HL7v2 codes typically map to other or unknown depending on context.
Related
- Open the FHIR Validator
- All validation errors
- resourceType Is Required
- Unknown FHIR R4 Resource Type
- Required Element Is Missing for This Resource
- birthDate Must Be YYYY, YYYY-MM, or YYYY-MM-DD
- instant Must Include a Timezone
- Resource id Has an Invalid Format
- subject Must Be a Reference Object, Not a String
- Reference Should Be Type/id, urn:uuid, or an Absolute URL