dcarbone / php-fhir

Tools for consuming data from a FHIR server with PHP
Apache License 2.0
129 stars 40 forks source link

User Notice: Could not find mapped property called "_value" on object "Identifier". #41

Closed jjwdesign closed 5 years ago

jjwdesign commented 5 years ago

First, thank you very much for this excellent project. This has saved people thousands of hours of development time!

I was trying to work with the Cerner API (Sandbox) at https://fhir-open.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca - it's an open sandbox. It used the DSTU2 standard. When trying to retrieve Person and Patient data I was seeing a notice that the "_value" property could not be mapped.

 PHPFHIRResponseParser->_parseJsonObject(array('use' => 'usual', 'type' => array('coding' => array(array('system' => 'http://hl7.org/fhir/v2/0203', 'code' => 'AN', 'display' => 'Account number', 'userSelected' => false)), 'text' => 'Federated Person Principal'), 'system' => 'urn:oid:2.16.840.1.113883.3.13.6', 'value' => 'URN:CERNER:IDENTITY-FEDERATION:REALM:0B8A0111-E8E6-4C26-A91C-5069CBC6B1CA:PRINCIPAL:ABC123', '_value' => array('extension' =>array(array('url' => 'http://hl7.org/fhir/StructureDefinition/rendered-value', 'valueString' => 'URN:CERNER:IDENTITY-FEDERATION:REALM:0B8A0111-E8E6-4C26-A91C-5069CBC6B1CA:PRINCIPAL:ABC123'))), 'period' => array('start' => '2017-09-26T05:00:00.000Z', 'end' => '2019-01-02T05:00:00.000Z')), 'Identifier')in PHPFHIRResponseParser.php line 197

I know it's just a notice, so it shouldn't be effecting production. In case anyone else see's this error, you could skip the parameter using the switch statement. Just a quick fix. I'm sure there's a better way of handling this issue.

switch($k) { case 'resourceType': case '_value': continue 2; case 'fhir_comments': continue 2; }

dcarbone commented 5 years ago

Yeah, the current version does not have a way to handle extended json attributes on a "primitive container" type.

The refactor version is being designed with these specific use-cases in mind for both serialization and unserialization purposes.

XML should work just fine, however.

dcarbone commented 5 years ago

@jjwdesign: could you please try the latest output from v1.0 and see if this addresses the issue for you?

dcarbone commented 5 years ago

Closing as I believe this to be resolved.