Am trying to store a Clinical Document Architecture (CDA) Continuity of Care Document (CCD) into HealthKit to display under HK's Health Records sub-section.
HealthKit's CDADocumentSampleWithData:startDate:endDate:metadata:validationError:
gives me:
Error code 3
and userInfo
shows:
[0]
Key: NSLocalizedDescription
Value: Failed to validate XML, error code 1871
[1]
Key: HKDetailedCDAValidationErrorKey
Value: Element '{urn:hl7-org:v3}reference': This element is not expected. Expected is ( {urn:hl7-org:v3}translation ).\nElement '{urn:hl7-org:v3}reference': This element is not expected. Expected is ( {urn:hl7-org:v3}translation ).\n
Which gives no clue as to where (in which line) the issue exists in the CDA CCD. And to make it a little more confusing the Value element shows the string twice as shown above... and no line numbers.
"reference
" vs "translation
" is perhaps a clue. Unfortunately the word "reference
" is found on 422 lines in the CCD, "translation
" found 46 on 46 lines.
I wish I could post the CCD but it contains PHI (protected health information) so I cannot.
Any hints or tips appreciated!