fhir-parser icon indicating copy to clipboard operation
fhir-parser copied to clipboard

fhir-parser rendering some strange ASCII...

Open ryanbaldwin opened this issue 8 years ago • 4 comments

Hey Pascal,

I almost have my RealmSwiftFHIR and fhir-parser templates all wrapped up into one nice little package with a bow on top. There's one outstanding issue, and that is about 50% of the time, the fhir-parser generates the code and I get the following compilation errors (roughly 13 of them).

Unprintable ASCII chracter found in source file

screen shot 2017-02-22 at 4 16 48 pm

I suspect this has to do with the tab characters in the JSON, but... how on earth are you getting around this? I should note I've not modified the portions of the template-unittest.swift file which writes the expectation for the test, so this is stock FHIR-Parser (version: 70f814c19).

Thoughts?

ryanbaldwin avatar Feb 22 '17 21:02 ryanbaldwin

So I've added a filter in the template-unittest.swift for the String test which simply replaces \t with \\t, and that works just fine... but... I'm still confused as to why this was happening, and whether or not you experienced this.

Cheers!

ryanbaldwin avatar Feb 22 '17 21:02 ryanbaldwin

Ah, I actually do remember having this issue! However I haven't recently had this problem with stock fhir-parser. If you look at fhirunittest.py:167:186, there are some checks in there that should avoid these things. I'm always using Python 3, are you using Python 2 and these checks may not work correctly?

Also, against which FHIR version are you running this? Note that the master branch is for DSTU-2 and the develop branch for STU-3. I don't see the tests that throw up for you in the generated test case in Swift-FHIR for DSTU-2.

p2 avatar Feb 23 '17 09:02 p2

This is from the master branch, DSTU-2. We haven't made the cut to 3 yet at work so 2 has the priority. Also, I want to come up with a Versioning plan for 2/3 on my repo. Lastly, 2 is a work in progress and I'm still ironing out sometimes large kinks and don't want to double the load. All in due time.

In any case. You are correct in that I'm using Python 2.7, and not 3. Perhaps that is the problem. Either way, the additional replace filter in my template-unittest file worked just peachy.

As for the mysterious test... not sure what to tell you. This is all basically what I had submitted to you for a PR but now all localized in the RealmSwiftFHIR project instead of the fork from your FHIR-parser repo. Nothing special going on there.

ryanbaldwin avatar Feb 23 '17 23:02 ryanbaldwin

Hah, that is interesting. I'd guess that this is indeed a Python issue since when I use the master branch, those tests are skipped. I just re-generated from latest CI yesterday, but that part of fhir-parser has not been changed since DSTU-2.

As for versioning, it's complicated. That's why I have the version matrix in the README. Now with Swift stable it should be easier going forward, though.

p2 avatar Feb 24 '17 07:02 p2

I'm going to optimistically close this old ticket, on the theory that this was a python2 issue. But please re-open if this still happens.

mikix avatar Jul 12 '24 21:07 mikix