chronic-care/onc-ac-project

Validate create Patient Resource structure

Closed this issue · 1 comments

{
        "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
                }
            });
    }