3. Validate your first Patient
In this chapter you validate a Patient produced by a typical hospital system, read the errors, and fix
them one by one until the resource conforms to NP Core Patient. It takes about 15 minutes.
You need an account (pending is fine). Open the Validator in another tab.
Step 1 — Start from what your system produces today#
Many systems export something like this. Paste it into the validator editor:
{
"resourceType": "Patient",
"meta": {
"profile": [ "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-patient" ]
},
"identifier": [
{ "system": "urn:hospital:mrn", "value": "MRN-000123" }
],
"name": [ { "family": "Shrestha", "given": [ "Aarav" ] } ],
"gender": "M",
"birthDate": "2047-02-01",
"address": [ { "city": "Kathmandu" } ]
}
The profile picker shows Auto-detect: because meta.profile names NP Core Patient, the sandbox
validates against that profile. Press Validate.
Step 2 — Read the summary#
The result panel starts with a verdict and counts by severity, for example:
| Fatal | Errors | Warnings | Information |
|---|---|---|---|
| 0 | 3 or more | some | some |
The exact number depends on the validator version; what matters is that every error must be fixed for the resource to conform. Warnings are advice; read them, but they do not make the resource invalid.
Step 3 — Fix the missing Health ID#
One of the errors is titled something like "Nepal Health ID is required for every Patient". The raw validator message (open Raw validator message) reads:
Patient.identifier:healthId: minimum required = 1, but only found 0 (from http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-patient|1.0.0)
How to read it:
Patient.identifier:healthId— the slicehealthIdofPatient.identifier. A slice is a named kind of identifier the profile expects.minimum required = 1, but only found 0— the profile requires exactly one Health ID and found none. Our MRN identifier does not count because itssystemis not the Health ID system.
NP Core defines the Nepal Health ID identifier like this:
| Element | Value |
|---|---|
use |
official |
type.coding.system |
http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type |
type.coding.code |
health-id |
system |
http://fhir.digitalhealth.gov.np/core/NamingSystem/nepal-health-id |
value |
the Health ID number |
Click Location on the issue card to jump to the line in the editor, then add the Health ID next to your hospital number (keep your MRN — extra identifiers are allowed):
"identifier": [
{
"use": "official",
"type": {
"coding": [ {
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type",
"code": "health-id"
} ]
},
"system": "http://fhir.digitalhealth.gov.np/core/NamingSystem/nepal-health-id",
"value": "12345678901"
},
{ "system": "urn:hospital:mrn", "value": "MRN-000123" }
]
Copy, do not retype
Every issue card has an Example with a Copy button, and the Profiles browser shows every identifier system. Copying avoids typos in system URIs — the most common error we see.
Step 4 — Fix the gender code#
Next error: Patient.gender — the value M is not in the value set. gender is bound with required
strength to the FHIR administrative-gender codes: male, female, other, unknown. Map your internal
codes when you export:
"gender": "male"
This is a terminology error. Required bindings produce errors; extensible/preferred bindings usually produce warnings.
Step 5 — Fix the Bikram Sambat date#
"birthDate": "2047-02-01" is a valid-looking date, so the validator may not complain — but it is
wrong. NP Core requires all FHIR dates to be Gregorian (AD). 2047 is a Bikram Sambat year. Convert
before sending, and if you want to keep the original BS date, put it in the Bikram Sambat extension:
"birthDate": "1990-05-15",
"_birthDate": {
"extension": [ {
"url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-bikram-sambat-date",
"valueString": "2047-02-01"
} ]
}
Note the underscore: extensions on a primitive value such as birthDate go in _birthDate. Read more in
Nepal-specific rules.
Validators cannot catch everything
The validator cannot know that 2047-02-01 was meant as BS. Conformance scenarios include checks for such mistakes, but your own conversion code is responsible for correctness.
Step 6 — Complete the address#
NP Core addresses SHALL have a country. For Nepal, add the coded province, district and local level
extensions and the human-readable names:
"address": [ {
"extension": [
{ "url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-province",
"valueCoding": { "system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location", "code": "3", "display": "Bagmati Province" } },
{ "url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-district",
"valueCoding": { "system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location", "code": "306", "display": "Kathmandu" } },
{ "url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-local-level",
"valueCoding": { "system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location", "code": "30608", "display": "Kathmandu Metropolitan City" } }
],
"use": "home",
"line": [ "Ward 10", "Naxal" ],
"city": "Kathmandu Metropolitan City",
"district": "Kathmandu",
"state": "Bagmati Province",
"country": "NP"
} ]
The codes above are taken from the official NP Core example patient. Look up your own codes in the Profiles browser (value sets Nepal Province, Nepal District, Nepal Local Level).
Step 7 — Validate again#
Press Validate. The verdict should now say the resource is valid (0 errors). You may still see warnings or information messages — read them and decide whether they apply to you.
The complete conformant Patient from the IG, for comparison:
{
"resourceType": "Patient",
"id": "ExampleNPCorePatient",
"meta": {
"profile": [
"http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-patient"
]
},
"identifier": [
{
"use": "official",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "NI",
"display": "National unique individual identifier"
}
]
},
"system": "http://donidcr.gov.np",
"value": "1234-5678-9012-3"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type",
"code": "health-id",
"display": "Nepal Health ID"
}
]
},
"system": "http://fhir.digitalhealth.gov.np/core/NamingSystem/nepal-health-id",
"value": "10000000001"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type",
"code": "citizenship-number",
"display": "Nepal Citizenship Certificate Number"
}
]
},
"system": "http://moha.gov.np",
"value": "12-34-56-78901"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type",
"code": "health-insurance-id",
"display": "Nepal Health Insurance ID"
}
]
},
"system": "http://hib.gov.np",
"value": "HIB-000123456"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "PPN",
"display": "Passport number"
}
]
},
"system": "http://nepalpassport.gov.np",
"value": "PA1234567"
},
{
"use": "official",
"type": {
"coding": [
{
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/np-core-identifier-type",
"code": "ssf-number",
"display": "Nepal Social Security Fund Number"
}
]
},
"system": "http://ssf.gov.np",
"value": "1-01-01-00001234"
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Shrestha",
"given": [
"Aarav"
]
}
],
"gender": "male",
"birthDate": "1990-05-15",
"_birthDate": {
"extension": [
{
"url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-bikram-sambat-date",
"valueString": "2047-02-01"
}
]
},
"address": [
{
"extension": [
{
"url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-province",
"valueCoding": {
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location",
"code": "3",
"display": "Bagmati Province"
}
},
{
"url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-district",
"valueCoding": {
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location",
"code": "306",
"display": "Kathmandu"
}
},
{
"url": "http://fhir.digitalhealth.gov.np/core/StructureDefinition/np-core-local-level",
"valueCoding": {
"system": "http://fhir.digitalhealth.gov.np/core/CodeSystem/nepal-administrative-location",
"code": "30608",
"display": "Kathmandu Metropolitan City"
}
}
],
"use": "home",
"type": "physical",
"text": "Ward 10, Naxal, Kathmandu Metropolitan City, Kathmandu, Bagmati Province, Nepal",
"line": [
"Ward 10",
"Naxal"
],
"city": "Kathmandu Metropolitan City",
"district": "Kathmandu",
"state": "Bagmati Province",
"postalCode": "44600",
"country": "NP"
}
]
}
What you learned#
meta.profiletells the sandbox which profile to check.- A slice such as
identifier:healthIdis recognised by itssystem(and type). - Required bindings (like
gender) produce errors when the code is not allowed. - Dates must be Gregorian; Bikram Sambat goes in an extension.
- Each issue card links to the IG page that defines the rule.
Next: Reading the error report.