laggery / vscode-fhir-tools

Other
15 stars 6 forks source link

FHIR xmlto json (new file) - not working #23

Open cander2 opened 8 months ago

cander2 commented 8 months ago

Hello, I have the extension installed in VS Code v1.85.1 on Windows 10 Enterprise. I highlight my whole FHIR XML document bundle, right click, select "FHIR xml to json (new file)" and nothing happens. Tried the same with "FHIR xml to json" and nothing happens.

Am I missing something that would help make it work??

Here is an example of my XML if that helps https://github.com/cander2/epi-test/blob/master/input/resources/JFDA%20Aromasin%20PIL%20EN%20v1.xml

oliveregger commented 8 months ago

I assume this is due to that the example is in FHIR R5. you might use the FHIR Java validator to do the conversion: https://confluence.hl7.org/display/FHIR/Using+the+FHIR+Validator

cander2 commented 8 months ago

Ah yes, I am using R5. Thank you, i'll try the Java validator.

Any thoughts on if or when the extension would support R5?

oliveregger commented 8 months ago

i'm not familiar with the codebase for converting form xml to json and vice versa, sorry.

i have seen that you ressource i an input to an ig, why do you need to convert it manually? that should be automatically done when producing the ig that you have json and xml?

cander2 commented 8 months ago

When I saw that the IG was adding the \n\t\t\t\ I thought something was wrong or it was inserting styling elements that I don't need.

Looks like this is normal and I don't need to worry about it. I'm just learning how to work with JSON so this is new to me.

[div](http://hl7.org/fhir/R5/narrative.html#Narrative#Narrative.div)" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n\t\t\t\t\t\t\t\t<p style=\"text-align: center\">\n\t\t\t\t\t\t\t\t\t<b>Package leaflet: Information for
laggery commented 8 months ago

Hello

Thanks for reporting this issue.

For the data conversion I am currently using the FHIR.js library -> https://github.com/lantanagroup/FHIR.js but it seems not supporting R5

It's been a while since I worked with FHIR but if I understand you correctly @oliveregger this conversion can also be done with the validator_cli.jar.

Could you send me the command that needs to be executed? Should now everything be done with R5 by default?

oliveregger commented 8 months ago

i would prefer to have R4 as default, there is some use of R5 but it is mostly R4 which is used

command for R4 form json to file name.xml

java -jar "/Users/oegger/.vscode/extensions/yannick-lagger.vscode-fhir-tools-1.5.1/validator_cli.jar" "/Users/oegger/Documents/github/ch-elm/output/Bundle-3Doc-CPE.json" -version 4.0.1 -convert -output name.xml

command for R5 would be changing the verison to 5.0.0

java -jar "/Users/oegger/.vscode/extensions/yannick-lagger.vscode-fhir-tools-1.5.1/validator_cli.jar" "/Users/oegger/Documents/github/ch-elm/output/Bundle-3Doc-CPE.json" -version 5.0.0 -convert -output name.xml