Child pages
  • Person Resource
Skip to end of metadata
Go to start of metadata

Introduction

  • This page documents the implementation of the FHIR Person resource (DSTU2) for the OpenMRS FHIR Module

  • Person Resource represents demographics and administrative information about a person independent of a specific health-related context.
  • For more information on the FHIR Person resource, please refer http://hl7-fhir.github.io/person.html

Populating the FHIR Person Resource 

Shown below is how attributes of the FHIR Person Resource map to the attributes of the OpenMRS Person object. The left side of the relationship indicates the OpenMRS attribute; the right indicates the FHIR Person resource mapping.

Person
 Integer personId :: [base]/Person/[personId]
 Set<PersonAddress> addresses = null :: Person.address
   Integer personAddressId :: not mapped
   Person person :: not mapped
   Boolean preferred = false :: Patient.address.use ? mapping
   String address1 :: Person.address.line
   String address2 :: Person.address.line
   String address3 :: Person.address.line
   String address4 :: Person.address.line
   String address5 :: Person.address.line
   String address6 :: Person.address.line
   String cityVillage :: Patient.address.city
   String countyDistrict :: Person.address.extension : "http://hl7.org/fhir/Profile/iso-21090#address-part-county", valueString
   String stateProvince :: Person.address.state
   String country :: Person.address.country
   String postalCode :: Person.address.zip
   String latitude :: Person.address.extension -> Location
   String longitude :: Person.address.extension -> Location
   Date startDate :: Person.address.period.start
   Date endDate ::  Person.address.period.end
 Set<PersonName> names = null :: Person.name
   Integer personNameId :: not mapped
   Person person ::  not mapped
   Boolean preferred = false :: Patient.name.use = usual/old
   String prefix :: Person.name.prefix
   String givenName :: Person.name.given
   String middleName :: Person.name.given
   String familyNamePrefix :: folded into Patent.name.family (else, Patient.name.family with extension http://hl7.org/fhir/Profile/iso-21090#name-qualifer, valueCode = PFX)
   String familyName :: Person.name.family
   String familyName2 :: Person.name.family
   String familyNameSuffix :: Person.name.suffix
   String degree :: Person.name.suffix
 Set<PersonAttribute> attributes = null ::
   integer personAttributeTypeId :: mapping table that defines how attributes map - whether existing elements or extensions
   String value :: depends on mapping
 String gender :: Person.gender (mapped: code = M or code = F, code system is http://hl7.org/fhir/v2/0001)
 Date birthdate :: Person.birthDate
 Boolean birthdateEstimated = false :: Extension if worth mapping
 Boolean deathdateEstimated = false :: Extension if worth mapping
 Boolean dead = false :: if true, and no date, then Patient.deceasedBoolean= true
 Date deathDate :: Person.deceasedDate
 Concept causeOfDeath :: Patient.extension
 User personCreator :: not mapped (would be in provenance if worth mapping)
 Date personDateCreated :: not mapped (would be in provenance if worth mapping)
 User personChangedBy :: not mapped (would be in provenance if worth mapping)
 Date personDateChanged :: not mapped (would be in provenance if worth mapping)
 Boolean personVoided = false :: if true, Patient.active = false, else Patient.active = true
 User personVoidedBy ::  not mapped (would be in provenance if worth mapping)
 Date personDateVoided ::  not mapped (would be in provenance if worth mapping)
 String personVoidReason :: not mapped (would be in provenance if worth mapping)
 boolean isPatient :: not mapped

Example FHIR Person Resource

Shown below is a fleshed out FHIR Person Resource.

FHIR Person Resource
{
  "resourceType": "Person",
  "id": "dda12af7-1691-11df-97a5-7038c432aabf",
  "name": [
    {
      "use": "official",
      "family": [
        "Chalmers"
      ],
      "given": [
        "Peter",
        "James"
      ]
    },
    {
      "use": "usual",
      "given": [
        "Jim"
      ]
    }
  ],
  "gender": "male",
  "birthDate": "1974-12-25",
  "address": [
    {
      "use": "home",
      "line": [
        "534 Erewhon St"
      ],
      "city": "PleasantVille",
      "state": "Vic",
      "postalCode": "3999"
    }
  ],
  "active": true
}

Available RESTful web services for the Person Resource supported by the API

GET Requests

Read
urldescription
/ws/fhir/Person/{id}

Returns a FHIR Person resource identified by a Person UUID

Outcomes:

  • Returns a FHIR Person resource if the specified Person exists
  • Returns an Operation Outcome resource with a 404 error message if the specified Person does not exist
Search
/ws/fhir/Person?_id={id}Returns a list of FHIR Person resources identified by a Person UUID
/ws/fhir/Person?name={name}This request will fetch all Persons using the name parameter. This will return a List of Persons as the response. Here the name parameter represents the name of the person.
/ws/fhir/Person?name={name}&birthdate={birthdate/birthyear}&gender={gender}This request will fetch all Persons using similar to name, birthdate and gender parameters. This will return a List of Persons as the response. Here the name parameter represents the name of the person. The birthdate parameter should be given in the yyyy-mm-dd format (Any person with a null/missing birthdate is included and anyone with a birth year plus/minus one year from the given birth year is also included). It is sufficient to provide only birth year in the yyyy format. The gender parameter represents the gender of the person (typically "M" or "F")

POST Requests

Create
UrlDescription
/ws/fhir/Person

Create a Person Resource for the given representation.

one none delete name, birthday and gender attributes are compulsory.

PUT Requests

Update
UrlDescription
/ws/fhir/Person/{id}
  • If the Person with the given uuid exists, update the existing attributes according to the representation.
  • If the Person with the given uuid doesn't exists, Create a Person Resource with the given uuid.

Update operation cannot update an existing name or address. If you don't wish to update an existing name or address, you should keep those fields empty. All names and addresses contain in the representation will be added to the Person resource, as new names and addresses.

Given below is a JSON body that will update attributes of an Person Resource.

JSON Representation of a Person
{
"resourceType": "Person",
"id": "e6bbecc5-5b87-49a2-85ad-008bd7d9rrrr",
"gender": "male",
"birthDate": "1981-03-05T00:00:00",
"name": [
	{
		"use": "usual",
		"family": [
			"uui"
		],
		"given": [
			"vvi"
		]
	},
	{
		"use": "old",
		"family": [
			"vddi"
		],
		"given": [
			"vvvvvvid"
		]
	}
 ],
  "address": [
	{
		"use": "home",
		"line": [
			"17",
			"sdfds",
			"fgfg",
			"hnghn",
            ""
		],
		"city": "fgbfgb",
		"state": "ghnghn",
		"postalCode": "4444",
		"country": "Kenya"
	}
	],
 "active": true
}
Conditional Update
/ws/fhir/Person?[search parameters]

When the server processes this update, it performs a search using its standard search facilities for the resource type, with the goal of resolving a single logical id for this request. The action it takes depends on how many matches are found:

  • No matches: The server performs a create operation
  • One Match: The server performs the update against the matching resource
  • Multiple matches: The server returns a 412 Precondition Failed error indicating the the client's criteria were not selective enough

Ex: /ws/fhir/Person?name=John

DELETE (Delete Requests)

Operations
URLDescription
/ws/fhir/Person/{id}

If the person with given id exists, makes it void and responds with 203.

If the person already voided, does nothing and responds with 203.

If API refuses to void the person, responds with 405

If person with given id is not found, responds with 404.

OpenMRS specified constraints

  • When you POST a Person name and gender attributes are compulsory. In the name attribute there should be atleast one "usual"/"official" name.
  • When you Update an existing Person Name/Adresses, the existing names and addresses will be retired and new name/addresses will be created. 

 

  • No labels