arkhn / fhir-store

Serve FHIR standard in json, yml, etc.
Apache License 2.0
13 stars 2 forks source link

Add unittests to the json_to_yml converter and json cleaner #3

Open LaRiffle opened 5 years ago

LaRiffle commented 5 years ago

Add unittests

We already have a parser for hl7 resources which convert it in our yml format and conventions. The input format can be found for example for Patient in the Json tab: it looks like JSON but is not valid. We'd like to improve our parser and to add unittests to ensure that it's working well. If you have already done Unittest, this is a very good first issue!

jblemoine commented 5 years ago

How would you assess a yaml has a correct format ? Meaning that json_to_yml function ouput is correct ? For json file,it is easy to validate format with json.loads(text), however there is no yaml equivalent.

LaRiffle commented 5 years ago

@jblemoine I think there is two options: Either use a yaml python library, do like json.loads and check that it loads correctly, and optionnaly check that the python object is the same than the original one (before json_to_yaml) Or, just write plain yml target files from json using an online tool and check that our converter matches the yml expected file (beware the the online json_to_ymal tools or not always very clever)