Getting Started (My "Notes") #475
granadacoder
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Wow.
This took a bit to try and figure out the "basics".
So I thought I'd share.
Documentation:
Getting a list of the templateCollections:
(COMMENT (it is public, so empty-string is ok for username and pwd if prompted))
(and results below)
(pick one of the above for the --repository argument below)
...
Using the templateCollections
Note, anywhere below where there is a path or filename location specified with
"./"
You may need to put in the full-path or full-file-name.
Prerequisite: You must create an azure-container-registry..which is referred to as "mycustomacr123.azurecr.io" below.
Ok, first, what "works" using Microsoft default templates:
(all the command line argumenst below are used with Microsoft.Health.Fhir.Liquid.Converter.Tool.exe)
#(1 command line execution)
(1 result)
all of the liquid templates are downloaded to my local folder ./zzzMicrosoftTemplatesFromPull/
one noteworthy mention the below file "exists":
(2 command line execution)
note, the ADT-A01-01.hl7 file below is an example (sample) from this repo's source code
(2 result)
the file './zzzOutputFolder/MyOutputFileOne.txt' is successfully created and --contains-- a FHIR (resource) BUNDLE.
The contents of the output file is a "wrapper", where the BUNDLE" is nested under "FhirResource": json element.
(This below wrapper is defined here: https://github.com/microsoft/FHIR-Converter/blob/main/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Models/ConverterResult.cs#L11L22 )
The contents of the transformation are quite large, and not pasted here.
But I will paste the START of the result so you can see the "FhirResource": json element and the nested Bundle.
==========
Now using a custom defined template.
I have a folder below:
./zzzMyFirstTemplatesSource/
and a custom liquid template:
./zzzMyFirstTemplatesSource/MyFirstTemplateEmployeeToR4Patient.liquid
below is the contents of the above file: (note, this is a template I created, but I "learned" from a file in the repo : ./data/Templates/Json/ExamplePatient.liquid )
note the "msg." prefix. it is not "content" like many examples. this comes from here : https://github.com/microsoft/FHIR-Converter/blob/main/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/BaseProcessor.cs#L28
This "msg." prefix threw me for a loop for most of a day (before I found ExamplePatient.liquid)
And I added the file: (this is a mandatory file)
./zzzMyFirstTemplatesSource/metadata.json
with the context below:
Ok, now I run the Microsoft.Health.Fhir.Liquid.Converter.Tool.exe with the arguments (for future readers, note, you have to do an "az login" and a "az acr login --name mycustomacr123.azurecr.io" before doing the below)
Ok, the above "works" and I get this output:
Digest: sha256:000000000000000000000000000000000000000000000000000000000000000
Successfully pushed artifacts to mycustomacr123.azurecr.io/templatetest:default
I also notice that the below file was created:
Ok, great.
Now I try a pull : so execute "Microsoft.Health.Fhir.Liquid.Converter.Tool.exe" with below arguments
(the same az command (as above) have to be run before the below : "az login" and a "az acr login --name mycustomacr123.azurecr.io" before doing the below)
and that works with below output
Digest: sha256:000000000000000000000000000000000000000000000000000000000000000
Successfully pulled artifacts to ./zzzMyFirstTemplatesFromPull/ folder
Note, the directories/files of the above operation:
Note, the file "./MyFirstTemplateEmployeeToR4Patient.liquid"
Ok, now try to run a transformation.
Here is a sample .json input file... I am using "employee" as a "something NOT FHIR related" example.
the "input-data" file name :
and below is the contents of the above json file:
and now execute "Microsoft.Health.Fhir.Liquid.Converter.Tool.exe" with below arguments arguments:
note, do NOT use ".liquid" after the template name of "MyFirstTemplateEmployeeToR4Patient" below
Note the format of the output (aka, the contents of MyCustomOutputFileEmployeeToR4Patient.txt):
It is a "wrapper", where the R4-Patient is nested under "FhirResource": json element.
(This below wrapper is defined here: https://github.com/microsoft/FHIR-Converter/blob/main/src/Microsoft.Health.Fhir.Liquid.Converter.Tool/Models/ConverterResult.cs#L11L22 )
I hope that helps someone. I hit 2-3 curve balls trying to get the basics to work.
Beta Was this translation helpful? Give feedback.
All reactions