Skip to content

Commit

Permalink
Merge branch 'br-base-profiles' of https://github.com/WorldHealthOrga…
Browse files Browse the repository at this point in the history
…nization/smart-base into br-base-profiles
  • Loading branch information
brynrhodes committed Mar 4, 2024
2 parents 8f37a2a + ea29878 commit ada3bcb
Show file tree
Hide file tree
Showing 23 changed files with 327 additions and 21 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/ghbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,23 @@ jobs:
# Get the latest publisher - don't run the batch script but run the line directly
args: curl -L https://github.com/HL7/fhir-ig-publisher/releases/latest/download/publisher.jar -o ./input-cache/publisher.jar --create-dirs


- name: Create package cache folder
uses: docker://hl7fhir/ig-publisher-base:latest
with:
entrypoint: /bin/sh
args: -c "mkdir -p ./fhir-package-cache && chown 1001:127 ./fhir-package-cache"


- name: Run the IG publisher
uses: docker://hl7fhir/ig-publisher-base:latest
with:
# Run the publisher - don't run the batch script but run the line directly
args: java -Xmx4g -jar ./input-cache/publisher.jar publisher -ig . -auto-ig-build -repo https://github.com/${{github.repository}}
args: java -Xmx4g -jar ./input-cache/publisher.jar publisher -ig . -auto-ig-build -repo https://github.com/${{github.repository}} -package-cache-folder ./fhir-package-cache

- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v4.3
uses: tj-actions/branch-names@v7.0.7

- name: Deploy candidate
uses: JamesIves/[email protected]
Expand Down
72 changes: 72 additions & 0 deletions .github/workflows/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# ImplementationGuide Publisher GitHub Action

This GitHub Action automatically builds and publishes FHIR Implementation Guides using the HL7 FHIR IG Publisher. It is designed to run the publisher on push or pull request events and publish the output to GitHub Pages.

## Features

- Default branch is published in `https://<owner>.github.io/<repo>`. Branches are published in `https://<owner>.github.io/<repo>/branches/<branch>`
- Automatically uses the latest versions of sushi and IG publisher

## Prerequisites

Before you can use this GitHub Action, you need to ensure the following:

- Your repository should have a branch called `gh-pages`.
- You have configured GitHub Pages to serve from the `gh-pages` branch.
- Write permissions are granted for workflows
- Your FHIR IG source files are properly set up in your repository.

## Setup

1. **Configure GitHub Pages**

Make sure that GitHub Pages is enabled for your repository and is set to deploy from the `gh-pages` branch.

2. **Add the Workflow File**

Create a `.github/workflows` directory in your repository if it doesn't already exist, and call this workflow:
```yaml
jobs:
call_build:
uses: WorldHealthOrganization/smart-base/.github/workflows/ghbuild.yml@main
```
See [example](https://github.com/WorldHealthOrganization/smart-ig-starter-kit/blob/main/.github/workflows/ghbuild.yml).
3. **GitHub Token**
This action uses the `GITHUB_TOKEN` provided by GitHub Actions, so you don't need to manually create one.

## Usage

The action is configured to run on push or pull requests to any branch except the `gh-pages` branch. It can also be triggered manually via the GitHub Actions tab.

### Workflow Triggers

- **Push to `main` branch**: When commits are pushed to the `main` branch, the IG Publisher is run, and the output is published to the root of the GitHub Pages site.
- **Push to other branches**: When commits are pushed to branches other than `main`, the output is published to a subdirectory named after the branch - branches/<vranch_name>
- **Pull Request**: The action will run to ensure that the IG Publisher can build the IG from the pull request, but will not deploy to GitHub Pages.
- **Manual Trigger**: You can manually trigger the workflow from the GitHub Actions tab if needed.

### What the Workflow Does

Here is a step-by-step description of the workflow:

1. **Checkout**: Checks out the repository code.
2. **Get the latest image of the IG publisher**: Downloads the latest `publisher.jar` from the official FHIR IG Publisher repository.
4. **Create package cache folder**: Creates a cache folder for the packages needed by the publisher.
5. **Run the IG publisher**: Executes the IG Publisher to generate the IG site files.
6. **Deploy to GitHub Pages**: Depending on the branch, deploys the output to the `gh-pages` branch of your repository.

### Notes

- The action is currently set up to keep a history of deployments for branches other than `main`. This can be changed by adjusting the `single-commit` and `clean` options in the workflow file.


## Contributing

Contributions to this GitHub Action are welcome. Please feel free to submit issues or pull requests with improvements.

## License

This project is licensed under the [MIT License](LICENSE). Feel free to use it and contribute.
63 changes: 63 additions & 0 deletions .github/workflows/update_readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Update README

on:
workflow_call: # Reusable by other workflows
inputs:
repositoryOwner:
required: true
type: string
repositoryName:
required: true
type: string
push:
branches-ignore:
- 'gh-pages'
pull_request:
workflow_dispatch:

jobs:
update-readme-badges:
runs-on: ubuntu-latest
env:
REPOSITORY_OWNER: ${{ inputs.repositoryOwner }}
REPOSITORY_NAME: ${{ inputs.repositoryName }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Download badges.md
run: |
curl -o badges.md https://raw.githubusercontent.com/WorldHealthOrganization/smart-ig-empty/main/badges.md
- name: Debug Variables
run: |
echo "Repository Owner: $REPOSITORY_OWNER"
echo "Repository Name: $REPOSITORY_NAME"

- name: Replace placeholders in badges.md
run: |
sed -i "s/<REPO_OWNER>/$REPOSITORY_OWNER/" badges.md
sed -i "s/<REPO_NAME>/$REPOSITORY_NAME/" badges.md
- name: Replace include with content of badges
run: |
awk 'NR==FNR{new = new $0 ORS; next} /<!--\/badges-->/{f=0} !f{print} /<!--badges-->/{printf "%s",new; f=1}' badges.md README.md > README_NEW.md && mv README_NEW.md README.md
cat README.md
- run: |
rm badges.md
- name: Stage changed files
run: git add ./README.md

- name: Deploy candidate
uses: JamesIves/[email protected]
with:
branch: ${{ github.ref_name }} # The branch the action should deploy to.
folder: . # The folder the action should deploy.
commit-message: Deploy branch
target-folder: .
clean: false
4 changes: 2 additions & 2 deletions ig.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[IG]
ig = fsh-generated/resources/ImplementationGuide-who.fhir.smart-base.json
ig = fsh-generated/resources/ImplementationGuide-who.base.json

#template = #local-template
template = who.fhir.template#current
template = who.template#current
2 changes: 2 additions & 0 deletions input/fsh/SGBusinessProcess.fsh5
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Profile: SGBusinessProcess
Parent: PlanDefinition
3 changes: 3 additions & 0 deletions input/fsh/SGCodeSystem.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Profile: SGCodeSystem
Parent: CodeSystem

21 changes: 21 additions & 0 deletions input/fsh/SGImplementationGuide.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Profile: SGImplementationGuide
Parent: ImplementationGuide

* license = #CC-BY-SA-3.0-IGO




* definition.resource
* ^slicing.discriminator.type = #profile
* ^slicing.discriminator.path = "reference.resolve()"
* ^slicing.rules = #open

* definition.resource contains
LogicalModel 0..* and
Extension 0..* and
Profile 0..*

* definition.resource[LogicalModel].reference.type = #StructureDefinition
* definition.resource[LogicalModel].reference only Reference(SGLogicalModel)

File renamed without changes.
8 changes: 8 additions & 0 deletions input/fsh/SGMeasure.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Profile: SGMeasure
Parent: Measure

* title 1..1
* version 1..1
* name 1..1
* publisher 1..1
* description 1..1
10 changes: 10 additions & 0 deletions input/fsh/SGPersona.fsh5
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Profile: SGPersona
Parent: ActorDefinition

* identifier 1..*
* status MS
* name 1..1
* title 1..1
* type = #person
* experimental 1..1
* description 1..1
3 changes: 3 additions & 0 deletions input/fsh/SGValueSet.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Profile: SGValueSet
Parent: ValueSet

2 changes: 0 additions & 2 deletions input/fsh/SMARTBusinessProcess.fsh

This file was deleted.

3 changes: 0 additions & 3 deletions input/fsh/SMARTCodeSystem.fsh

This file was deleted.

4 changes: 0 additions & 4 deletions input/fsh/SMARTImplementationGuide.fsh

This file was deleted.

3 changes: 0 additions & 3 deletions input/fsh/SMARTValueSet.fsh

This file was deleted.

Binary file added local-template/package/.index.db
Binary file not shown.
4 changes: 4 additions & 0 deletions local-template/package/.index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"index-version" : 2,
"files" : []
}
Binary file added local-template/package/includes/.index.db
Binary file not shown.
4 changes: 4 additions & 0 deletions local-template/package/includes/.index.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"index-version" : 2,
"files" : []
}
51 changes: 51 additions & 0 deletions local-template/package/includes/fragment-actors.liquid
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th>Name</th>
<th>Title</th>
<th>Description</th>
</tr>
</thead>
<tbody>
{% for data_file in site.data %}
{% assign filename = data_file[0] %}
{% assign entry = data_file[1] %}

{% assign name = "" %}
{% assign title = "" %}
{% assign description = "" %}
{% assign link_path = filename | remove: ".json" | append: ".html" %}

{% assign profile_includes_string = false %}

{% for extension in entry.extension %}
{% if extension.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.name" %}
{% assign name = extension.valueString %}
{% elsif extension.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.title" %}
{% assign title = extension.valueString %}
{% elsif extension.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-ActorDefinition.description" %}
{% assign description = extension.valueMarkdown %}
{% endif %}
{% endfor %}

{% if entry.meta and entry.meta.profile %}
{% for profile in entry.meta.profile %}
{% if profile == "http://worldhealthorganization.github.io/smart-base/StructureDefinition/SGPersona" %}
{% assign profile_includes_string = true %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}


{% if entry.resourceType == "ActorDefinition" or profile_includes_string %}
<tr>
<td><a href="{{ link_path }}">{{ name }}</a></td>
<td>{{ title }}</td>
<td>{{ description }}</td>
</tr>
{% endif %}

{% endfor %}
</tbody>
</table>
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% for data_file in site.data %}
{% assign content = data_file[1] %}
{% assign requirements_statement_found = false %}
{% assign requirements_extensions = nil %}



{% if content.code.coding[0].code == "Requirements" %}
{% for ext in content.extension %}
{% if ext.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.title" %}
<h3>{{ext.valueString}}</h3>
{% endif %}
{% endfor %}

<div>
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th>Key</th>
<th>Requirement</th>
</tr>
</thead>
<tbody>

{% for ext in content.extension %}
{% if ext.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement" %}
<tr>
{% for statement in ext.extension %}


{% if statement.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.key" %}
<td>{{ statement.valueId }}</td>
{% endif %}

{% if statement.url == "http://hl7.org/fhir/5.0/StructureDefinition/extension-Requirements.statement.requirement" %}
<td>{{ statement.valueMarkdown | markdownify}}</td>
{% endif %}

{% endfor %}
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
<br> <!-- Adding a break between tables for visual separation -->



{% endif %}
{% endfor %}
12 changes: 12 additions & 0 deletions local-template/package/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "who.fhir.smart-ig-empty-local",
"version": "0.0.1",
"type": "fhir.template",
"license": "CC0-1.0",
"description": "Local template extension for WHO SMART FHIR IG",
"author": "http://who.int",
"base": "who.fhir.template",
"dependencies": {
"who.fhir.template": "current"
}
}
16 changes: 11 additions & 5 deletions sushi-config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
id: who.fhir.smart-base
canonical: http://worldhealthorganization.github.io/smart-base
id: who.base
canonical: http://smart.who.int/base
name: SMARTBase
title: SMART Base IG
description: This implementation guide defines conformance requirements and expectations for WHO SMART Guideline computable guidelines
title: SMART Base
description: An empty Implementation Guide to be used as a starting point for building SMART Guidelines Implementation Guides
status: draft # draft | active | retired | unknown
version: 0.1.0
fhirVersion: 4.0.1 # https://www.hl7.org/fhir/valueset-FHIR-version.html
Expand Down Expand Up @@ -49,7 +49,12 @@ menu:

meta:
profile:
- SMARTImplementationGuide
- SGImplementationGuide
# - http://smart.who.int/base/ImplementationGuide-SMARTImplementationGuide

dependencies:
hl7.fhir.uv.crmi: dev


# ╭───────────────────────────Less Common Implementation Guide Properties──────────────────────────╮
# │ Uncomment the properties below to configure additional properties on the ImplementationGuide │
Expand Down Expand Up @@ -180,3 +185,4 @@ meta:
# if InstanceOf references a profile:
#
# setId: always # always | standalone-only

0 comments on commit ada3bcb

Please sign in to comment.