chronic-care / onc-ac-project

ONC LEAP grant with AllianceChicago (AC) project planning and documentation
Apache License 2.0
0 stars 0 forks source link

Validate create Patient Resource structure #103

Closed kbertodatti closed 6 months ago

kbertodatti commented 6 months ago

US Core Patient (6.1.0): https://hl7.org/fhir/us/core/STU6.1/StructureDefinition-us-core-patient.html Generic: https://hl7.org/fhir/R4/patient.html

sravandigitalhie commented 6 months ago
{
        "resourceType": "Patient",
        "active": true,
        "name": [
            {
                "use": "official",
                "family": lastName,
                "given": [firstName]
            }
        ],
        "gender": gender,
        "birthDate": dateOfBirth,
        "telecom": [
            {
                "system": "phone",
                "value": phoneNumber
            },
            {
                "system": "email",
                "value": email
            }
        ],
        "address": [
            {
                "use": "home",
                "line": [address1, address2],
                "city": city,
                "state": state,
                "postalCode": zipcode
            }
        ],
        "communication": [
            {
                "language": {
                    "coding": [
                        {
                            "system": "urn:ietf:bcp:47",
                            "code": code, // to be mapped
                            "display":language
                        }
                    ],
                    "text": language
                },
                "preferred": true
            }
        ],
        "extension": [
            {
                "url": "http://hl7.org/fhir/StructureDefinition/us-core-race",
                "extension": [
                    {
                        "url": "ombCategory",
                        "valueCoding": {
                            "system": "urn:oid:2.16.840.1.113883.6.238",
                            "code": "12455132", // to be mapped 
                            "display": race  
                        }
                    },
                    {
                        "url": "text",
                        "valueString": race
                    }
                ]
            },
            {
                "url": "http://hl7.org/fhir/StructureDefinition/us-core-ethnicity",
                "extension": [
                    {
                        "url": "ombCategory",
                        "valueCoding": {
                            "system": "urn:oid:2.16.840.1.113883.6.238",
                            "code": "2028-9", // to be mapped
                            "display": ethnicity
                        }
                    },
                    {
                        "url": "text",
                        "valueString": ethnicity
                    }
                ]
            },
            {
                "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex",
                "valueCode": sexAtBirth // to be mapped
            }
        ],
        "managingOrganization": { // Remove it
            "reference": managingOrganization
        }
}

    // Optional fields
    if (genderIdentity) {
        patient.extension.push({
                "url": "https://docs.mydata.athenahealth.com/fhir-r4/StructureDefinition/athena-patient-extension-genderIdentity",
                "valueCodeableConcept": {
                    "coding": [
                        {
                            "system": "https://docs.mydata.athenahealth.com/fhir-r4/athenaFlex/genderIdentity",
                            "code": "446141000124107", // to be decided
                            "display": genderIdentity
                        }
                    ],
                    "text": genderIdentity
                }
            });
    }

    if (sexualOrientation) {
        patient.extension.push({
                "url": "https://docs.mydata.athenahealth.com/fhir-r4/StructureDefinition/athena-patient-extension-sexualOrientation",
                "valueCodeableConcept": {
                    "coding": [
                        {
                            "system": "https://docs.mydata.athenahealth.com/fhir-r4/athenaFlex/sexualOrientation",
                            "code": "42035005", // to be decided
                            "display": sexualOrientation
                        }
                    ],
                    "text": sexualOrientation
                }
            });
    }