amida-tech / blue-button

Blue Button (CCDA/CMS Blue Button/etc) to JSON Parser.
Other
49 stars 44 forks source link

performers in medication do not conform to model #261

Closed psalaets closed 2 years ago

psalaets commented 2 years ago

Background

There can be two performers in a medication record:

and both parse phone as a 0..1 (see here) field.

Problem

In the model, phone is supposed to be an array.

See

Invalid document

When I run the example in the README and print out bb.validator.lastError, it contains some related errors

{
    code: 'INVALID_TYPE',
    params: [ 'array', 'object' ],
    message: 'Expected type array but found type object',
    path: '#/data/medications/0/dispense/performer/phone',
    schemaId: 'document_model'
}

and

{
    code: 'INVALID_TYPE',
    params: [ 'array', 'object' ],
    message: 'Expected type array but found type object',
    path: '#/data/medications/0/performer/phone',
    schemaId: 'document_model'
}

If this is a legit issue and I'm not overlooking something, are you open to accepting a PR with the fix? I would change the phone's 0..1 to 0..*.

Manhydra commented 2 years ago

@psalaets Yes, send a PR for this issue when ready.