New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'id' property gets lost in translation from JSON to XML #335

Closed
vadi2 opened this Issue Apr 16, 2016 · 8 comments

Comments

Projects
None yet
2 participants
@vadi2
Contributor

vadi2 commented Apr 16, 2016

fhir3 seems to lose the 'id' property on datatypes, tested with a modified json-edge-cases.json from the FHIR spec. Search case-sensitive for q4 in data below and you'll see it, POST resource to HAPI and you won't find it.

{
    "resourceType": "Patient",
    "identifier": [{
        "period": {"start": "2001-05-06"},
        "assigner": {"display": "Acme\u202fHealthcare"},
        "use": "usual",
        "system": "urn:oid:1.2.36.146.595.217.0.1",
        "value": "12345"
    }],

    "_active": {"extension": [{
        "url": "http://example.org/fhir/StructureDefinition/recordStatus",
        "valueCode": "archived"
    }]},
    "name": [
        {
            "given": [
                "Peter",
                "James"
            ],
            "use": "official",
            "family": ["Chalmers"]
        },
        {
            "given": ["Jim"],
            "use": "usual"
        }
    ],
    "extension": [
        {
            "url": "http://example.org/fhir/StructureDefinition/patientAvatar",
            "valueReference": {
                "reference": "#pic1",
                "display": "Duck image"
            }
        },
        {
            "url": "http://example.org/fhir/StructureDefinition/complexExtensionExample",
            "extension": [
                {
                    "url": "nestedA",
                    "valueCoding": {
                        "system": "http://demo.org/id/4",
                        "code": "AB45",
                        "extension": [
                            {
                                "url": "http://example.org/fhir/StructureDefinition/extraforcodingWithExt",
                                "extension": [{
                                    "url": "extra1",
                                    "valueString": "extra info"
                                }]
                            },
                            {
                                "url": "http://example.org/fhir/StructureDefinition/extraforcodingWithValue",
                                "valueInteger": 45
                            }
            ]
                    }
                },
                {
                    "url": "nestedB",
                    "id": "q4",
                    "extension": [{
                        "url": "nestedB1",
                        "valueString": "hello"
                    }]
                }
            ]
        }
    ],
    "modifierExtension": [
        {
            "url": "http://example.org/fhir/StructureDefinition/pi",
            "valueDecimal": 3.141592653589793
        },
        {
            "url": "http://example.org/fhir/StructureDefinition/avogadro",
            "valueDecimal": 6.0221416246424E23
        }
    ],
    "gender": "male",
    "birthDate": "1974-12",
    "deceasedBoolean": true,
    "address": [{
        "use": "home",
        "line": ["534 Erewhon St"],
        "city": "PleasantVille",
        "state": "Vic",
        "postalCode": "3999"
    }],
    "maritalStatus": {
      "coding": [{
        "system": "http://hl7.org/fhir/v3/NullFlavor",
        "code": "UNK",
        "display": "unknown"
      }]
    },
    "multipleBirthInteger": 3,
    "text": {
        "status": "generated",
        "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n      <table>\n        <tbody>\n          <tr>\n            <td>Name<\/td>\n            <td>Peter James <b>Chalmers<\/b> (&quot;Jim&quot;)<\/td>\n          <\/tr>\n          <tr>\n            <td>Address<\/td>\n            <td>534 Erewhon, Pleasantville, Vic, 3999<\/td>\n          <\/tr>\n          <tr>\n            <td>Contacts<\/td>\n            <td>Home: unknown. Work: (03) 5555 6473<\/td>\n          <\/tr>\n          <tr>\n            <td>Id<\/td>\n            <td>MRN: 12345 (Acme Healthcare)<\/td>\n          <\/tr>\n        <\/tbody>\n      <\/table>\n    <\/div>"
    },
    "contained": [
        {
            "resourceType": "Binary",
            "id": "pic1",
            "contentType": "image/gif",
            "content": "R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/eAP/eCP/eEP/eGP/nAP/nCP/nEP/nIf/nKf/nUv/nWv/vAP/vCP/vEP/vGP/vIf/vKf/vMf/vOf/vWv/vY//va//vjP/3c//3lP/3nP//tf//vf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAATABEAAAi+AAMIDDCgYMGBCBMSvMCQ4QCFCQcwDBGCA4cLDyEGECDxAoAQHjxwyKhQAMeGIUOSJJjRpIAGDS5wCDly4AALFlYOgHlBwwOSNydM0AmzwYGjBi8IHWoTgQYORg8QIGDAwAKhESI8HIDgwQaRDI1WXXAhK9MBBzZ8/XDxQoUFZC9IiCBh6wEHGz6IbNuwQoSpWxEgyLCXL8O/gAnylNlW6AUEBRIL7Og3KwQIiCXb9HsZQoIEUzUjNEiaNMKAAAA7"
        },
        {
            "resourceType": "Organization",
            "id": "org3141",
            "text": {
                "status": "generated",
                "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n      <p>Good Health Clinic<\/p>\n    <\/div>"
            },
            "identifier": [{
                "system": "urn:ietf:rfc:3986",
                "value": "2.16.840.1.113883.19.5"
            }],
            "name": "Good Health Clinic"
        }
    ],
    "contact": [{
        "name": {
            "family": [
                null,
                "du",
                null,
                "Marché",
                null
            ],
            "_family": [
                {"extension": [{
                    "url": "http://example.org/fhir/StructureDefinition/nullFlavor",
                    "valueCode": "ASKU"
                }]},
                {
                    "id": "a2",
                    "extension": [{
                        "url": "http://example.org/fhir/StructureDefinition/qualifier",
                        "valueCode": "VV"
                    }]
                },
                {"extension": [{
                    "url": "http://hl7.org/fhir/StructureDefinitioniso-21090#nullFlavor",
                    "valueCode": "ASKU"
                }]},
                null,
                {"extension": [{
                    "url": "http://hl7.org/fhir/StructureDefinition/nullFlavor",
                    "valueCode": "ASKU"
                }]}
            ],
            "_given": [
                null,
                {
                    "id": "a3",
                    "extension": [{
                        "url": "http://hl7.org/fhir/StructureDefinition/qualifier",
                        "valueCode": "MID"
                    }]
                },
                null
            ],
            "given": [
                "Bénédicte",
                "Denise",
                "Marie"
            ]
        },
        "relationship": [{"coding": [{
            "system": "http://hl7.org/fhir/patient-contact-relationship",
            "code": "partner"
        }]}],
        "telecom": [{
            "system": "phone",
            "value": "+33 (237) 998327"
        }]
    }],
    "careProvider": [{"reference": "#org3141"}],
    "telecom": [
        {"use": "home"},
        {
            "system": "phone",
            "value": "(03) 5555 6473",
            "use": "work"
        }
    ]
}

An upload of this resource is available on fhir3.

@vadi2

This comment has been minimized.

Contributor

vadi2 commented Apr 16, 2016

id value of a3 seems missing as well, for an additional test.

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Apr 17, 2016

Thanks for reporting! This was pretty significant, since it could result in data getting dropped, but also in extensions getting associated with the wrong field.

I've got a fix, just running some tests and then I'll check it in.

@vadi2

This comment has been minimized.

Contributor

vadi2 commented Apr 17, 2016

Thanks James. Is the latest master deployed anywhere - I've got a third case I found as well, but didn't report yet as I didn't want to spam the bugtracker. I'd like to test it still affects HAPI before reporting :)

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Apr 17, 2016

Yup, just pushed a new snapshot build with these fixes, as it happens :)

sent from my phone.
On Apr 17, 2016 4:04 PM, "Vadim Peretokin" notifications@github.com wrote:

Thanks James. Is the latest master deployed anywhere - I've got a third
case I found as well, but didn't report yet as I didn't want to spam the
bugtracker. I'd like to test it still affects HAPI before reporting :)


You are receiving this because you modified the open/close state.
Reply to this email directly or view it on GitHub
#335 (comment)

@vadi2

This comment has been minimized.

Contributor

vadi2 commented Apr 17, 2016

Is it pushed to http://fhirtest.uhn.ca/baseDstu3? It still seems to have the problem. Or did you mean you pushed a new HAPI snapshot to Maven? I haven't got it running locally.

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Apr 17, 2016

Ah right, no I've pushed a snapshot build of the library to Maven but I haven't yet deployed a new version of the public test server with the fix in. I'll be doing that first thing tomorrow.

@jamesagnew

This comment has been minimized.

Owner

jamesagnew commented Apr 18, 2016

Ok, updated server is being pushed now.

@vadi2

This comment has been minimized.

Contributor

vadi2 commented Apr 18, 2016

Awesome, thanks. I can confirm that the two issues listed already - third one wasn't, so filed it as #338. Big thanks for the quick turnaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment