nazrulworld / fhir.resources

FHIR Resources https://www.hl7.org/fhir/resourcelist.html
https://pypi.org/project/fhir.resources/
Other
373 stars 104 forks source link

Getting validation errors that don't make sense #19

Closed mmabey closed 4 years ago

mmabey commented 4 years ago

Description

I'm attempting to use FHIR (DSTU2) Bundles I already had in my tests against the current version of fhir.resources (all tests pass with version 5.1.1 of fhir.resources) and I'm getting lots of validation errors. This one is the first I've looked into in depth, but I'm hoping that by figuring out this one I'll have a better chance debugging the others on my own.

I have a JSON bundle (attached below, but renamed to .txt so GitHub would let me upload it) I have tried to use to create a resource object. I continue to get the error value is not a valid list (type=type_error.list), but that doesn't make any sense since the value for the coding is a Python list.

What I Did

See iPython screenshot below. The output from [7] is the most informative, yet super confusing since the value is truly a list. I've triple-checked the FHIR spec (DSTU2) and everything seems to conform to it, and nothing that I can see in the pydantic model seems to be causing the problem. And creating a Coding object from data["entry"][0]["resource"]['participant'][0]['type'][0]['coding'][0] causes no problems either.

image

test_encounter_bundle.txt

nazrulworld commented 4 years ago

@mmabey thanks a lot for reporting continues to grow up. My first confession: all resources in DSTU2 written manually, so there is a good chance for error in each field type!. I will use look at it soon, hope will be an easy fix.

Side Note: will it be possible for you to add more resources in DSTU2? actually I cannot manage so much time, (have to looking on a professional job, and other open-source products), now actually waiting for those manual resources (DSTU2) to be completed to make the final release. But I am very happy that you are already doing extensive testing.

nazrulworld commented 4 years ago

There was a missing field value Bundle.type in text file other I have tested and it's working fine after 🐛 fixes.

mmabey commented 4 years ago

@nazrulworld thanks so much for the bugfix! It also helped me figure out what was causing the other validation issues I was experiencing. As you can see ☝️ I've opened a PR with the fixes.

As far as my availability to contribute to the project, at the moment I only have time to work on contributions as part of my day job. I have received permission to make contributions to this project from my management, but I need to be able to make a case for the business value my efforts will give to my own company. I know I can make the case for adding more tests, but I'm not sure I'll be able to do the same for manually adding resources that we don't use. I'll have to talk with my team lead and see what I can do, then I'll get back to you with an answer.

mmabey commented 4 years ago

Hey @nazrulworld, I just had a chat with my team lead, and it would be really helpful if there was an issue filed on this GitHub project that outlines the work remaining to be done on DSTU2 so that my leadership can gauge how much of my time would be spent contributing to this project and if it would be worth it to the company to have me do that. Can you create an issue that lists all the DSTU2 resources you need added to be ready for final release?

nazrulworld commented 4 years ago

Hey @nazrulworld, I just had a chat with my team lead, and it would be really helpful if there was an issue filed on this GitHub project that outlines the work remaining to be done on DSTU2 so that my leadership can gauge how much of my time would be spent contributing to this project and if it would be worth it to the company to have me do that. Can you create an issue that lists all the DSTU2 resources you need added to be ready for final release?

@mmabey please have a look at #21