FHIR Chat · add yaml versof ig.json to _data · shorthand

Stream: shorthand

Topic: add yaml versof ig.json to _data


view this post on Zulip Eric Haas (Oct 02 2020 at 00:32):

I do a some artifact processing directly from the ig resource itself instead of the the derived _data artifact . Can you have Sushi do two things...

1 create a /input/data directory and add a YML version of the implementation guide resource to it and call it "ig.yml"
2 copy the contents fsh/ig-data/input/data directory to the /input/data directory ?

the ig-pub will add the contents to the temp/pages/_data directory so can be accessed for page rendering ...

view this post on Zulip Eric Haas (Oct 02 2020 at 00:33):

can the do stuff like this in liquid...

{% for p in site.data.ig.definition.resource %}
  {%- if p.exampleBoolean or p.exampleCanonical -%}
      {% if types %}
        {% assign types =  types | append: "," | append: p.reference.reference | split: '/' | first %}
      {% else %}
       {% assign types = p.reference.reference | split: '/' | first %}
      {% endif %}
  {% endif %}
{% endfor %}

{% assign my_array = types | split: "," %}
{% assign my_array = my_array | sort | uniq %}

{% for i in my_array %}
### {{ i }}
  {%- for p in site.data.ig.definition.resource -%}
      {%- if p.exampleBoolean or p.exampleCanonical -%}
        {%- assign type =  p.reference.reference | split: '/' | first -%}
            {%- if type == i %}
- [{{p.name}}]({{p.reference.reference | replace: '/','-'}}.html)
            {%- endif -%}
       {%- endif -%}
   {%- endfor %}
{% comment %} keep this line here for proper rendering {% endcomment %}
{% endfor %}

view this post on Zulip Chris Moesel (Oct 02 2020 at 02:15):

Hi @Eric Haas -- we're just a day away from releasing SUSHI 1.0.0 Beta 1. This release changes how projects are structured. There are two things related to our changes that affect your request:

1) We no longer use an ig-data folder. Instead, just put all your IG stuff where you normally would. So, there is no need to copy /ig-data/input/data because you will just put that stuff in /input/data directly.

2) SUSHI no longer generates into /input at all, as we're trying to avoid mixing generated files and source files. Instead, SUSHI will generate resources (and IG JSON) to /fsh-generated/resources and generate menu.xml (if applicable) to /fsh-generated/includes. The base template is currently being updated to support these locations as source locations.

SUSHI 1.0.0 Beta 1 should be released tomorrow. As for generating ig.yml (wherever we would generate it), we can discuss. For example, I'd like to better understand if this is a feature that only you will use or if it has use for others as well.

view this post on Zulip Eric Haas (Oct 02 2020 at 03:10):

OK that works partially for me so my data folder won't disappear every time I run sushi right? I have no idea who else wants to access the ig resource directly, but I imagine is limited only to those willing use the liquid syntax in the page rendering. This is really a nice to have since I can add to bash script to insert between sushi and ig-pub. but still it would be nice to park a new copy of the ig.json ( as YAML ) in the data folder so can be used out of the box. Yaml is just easier to read and works fine in Jekyll so can kill 2 birds with one stone. use the the resource directly in generating page data and able to glance at it to see the ig resource when debugging etc. Jekyll accepts json too so that would be my second choice.


Last updated: Apr 12 2022 at 19:14 UTC