Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features/diagrams #40

Merged
merged 12 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/RenderAllDiagrams.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Render All Diagrams

on:
push:
paths:
- '**/Material/imgsrc/**/*.puml'
- '**/Material/imgsrc/**/*.drawio'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repository
uses: actions/checkout@v3

# Installs Java distribution for running the plantUML jar
- name: Install Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
check-latest: true

# Install graphviz for plantuml
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1

# Download plantUML jar
- name: Download plantuml file
run: |
wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/download/lastest/plantuml.jar"

# Clean Folder
name: Ensure and clean folder
run: |
imagedir=ImplementationGuide/diagrams
mkdir -p $imagedir
rm -rf ImplementationGuide/diagrams/*.svg

# Generate the SVGs from PUML
- name: Render PUML to SVG and Move files
run: |
imagedir=ImplementationGuide/diagrams
FileNamePaths=$(find . -path "*/imgsrc/*/*.puml" -exec dirname {} \; | sort -u)
for dir in $FileNamePaths
do
# Render SVGs from PUMLs
find $dir -name "*.puml" -exec java -jar plantuml.jar -tsvg {} \;

# Move SVGs to out directory
find $dir -name "*.svg" -exec mv {} $out_dir \;
done

# Generate the SVGs from DrawIO
- name: Render DrawIO to SVG with predefined action
uses: rlespinasse/drawio-export-action@v2
with:
path: ./Material/imgsrc/drawio/
output: .
format: svg
action-mode: all

# copies the created png & svg files to the images/diagrams folder and deletes the drawio files
- name: Copy draw io
run: |
imagedir=ImplementationGuide/images/diagrams
cp -RT ./Material/imgsrc/drawio/ $imagedir
find $imagedir -name '*.drawio' -exec rm -rv {} \;
tree ./images

# add and commit the new generated files
- name: Commit and push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Add rendered PlantUML and DrawIO to SVG diagrams" || exit 0
git push
46 changes: 46 additions & 0 deletions .github/workflows/RenderPlantUML.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Render PlantUML diagrams

on:
push:
paths:
- '**/Material/imgsrc/**/*.puml'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

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

- name: Install dependencies
run: |
sudo apt-get install -y graphviz
wget -O plantuml.jar "https://github.com/plantuml/plantuml/releases/download/lastest/plantuml.jar"

- name: Render and Move SVG files
run: |
# Find all unique directories containing *.puml files under any /imgsrc/ folder
directories=$(find . -path "*/imgsrc/*/*.puml" -exec dirname {} \; | sort -u)
for dir in $directories; do
# Generate the corresponding out directory path
out_dir=ImplementationGuide/diagrams
mkdir -p $out_dir

# Render SVGs from PUMLs
find $dir -name "*.puml" -exec java -jar plantuml.jar -tsvg {} \;

# Move SVGs to out directory
find $dir -name "*.svg" -exec mv {} $out_dir \;
done

- name: Commit and push
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Add rendered PlantUML to SVG diagrams" || exit 0
git push
12 changes: 8 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ name: CI (FHIR Validation)

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
# Triggers the workflow on all push or pull request events but only for the main branches
push:
branches: [ master ]
branches: [ main* ]
pull_request:
branches: [ master ]
branches: [ main* ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -38,14 +38,18 @@ jobs:
JAVA_VALIDATION_ENABLED: true
OUTPUT_FORMAT: RAW
JAVA_VALIDATION_OPTIONS: -allow-example-urls true
JAVA_VALIDATOR_VERSION: 6.0.11
SIMPLIFIER_USERNAME: ${{ secrets.SIMPLIFIER_USERNAME }}
SIMPLIFIER_PASSWORD: ${{ secrets.SIMPLIFIER_PASSWORD }}
SUSHI_ENABLED: true
SUSHI_VERSION: 3.5.0
SUSHI_OPTIONS: Resources/
EXPECTED_FAILS: VALIDATION_CONFORMANCE_DOTNET VALIDATION_CONFORMANCE_JAVA VALIDATION_EXAMPLES_JAVA

# - name: Add & Commit
# uses: EndBug/add-and-commit@v7
# with:
# add: 'Resources/fsh-generated/resources/'

- name: Check for Uncommitted Changes
run: |
git diff --exit-code 'Resources/fsh-generated/resources'|| (echo "Es gibt Änderungen durch die Pipeline. Lokale Sushi Konfiguration prüfen!" && exit 1)
11 changes: 11 additions & 0 deletions .vscode/keybindings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"key": "f5",
"command": "workbench.action.tasks.runTask",
"args": "buildWithReplaceIncludes"
},
{
"key": "f5",
"command": "-workbench.action.debug.start"
}
]
15 changes: 15 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "buildWithReplaceIncludes",
"type": "shell",
"command": "./resources/scripts/build_with_replace_includes.sh",
"problemMatcher": [],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
1 change: 1 addition & 0 deletions ImplementationGuide/diagrams/component.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added Material/docs/Beispiel_MedikationsAbgleich.xlsx
Binary file not shown.
1 change: 1 addition & 0 deletions Material/imgsrc/drawio/Klassendiagramm.drawio
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<mxfile host="Electron" modified="2022-02-03T11:14:10.836Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/15.8.7 Chrome/91.0.4472.164 Electron/13.6.2 Safari/537.36" etag="9FdaCb7Yhk4O1h6U8TQL" version="15.8.7" type="device"><diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">7V1rc+I2FP01zLSdgbH8Aj4Gstk+sm3atJu23wwWoI2xqC2WkF9fyZaxLYEfiR/AOpMJ0bUtyzpXukdHkulp0/XLR8/arD5hGzo9VbFfetptT1UBGI7oB7PsQ8tQUULD0kM2Pyk2PKJXyI3RaVtkQz91IsHYIWiTNs6x68I5Sdksz8O79GkL7KTvurGWUDI8zi1Htj4hm6xC60gdxvYfIVquojsDcxweWVvRyfxJ/JVl413CpH3oaVMPYxL+t36ZQodVXlQvTz/tn5z7Z/Pjz7/7/1l/TX7589fP/TCzuzKXHB7Bgy55c9avz4u7Hz/rX/7ePNz9vlM+3sx+7vNLlK+Ws+X19Qna6NkiCLt+/x75BPKHJ/uoRv0dWjuWS1OTBXbJIz+i0LTloKVL/5/TgkKPGr5CjyAKxg0/QPCGWucr5Nj31h5v2eP4xJo/R6nJCnvolWZrOfQQoAZ62CPcr1QzdcYju5Lf2oM+PechqiNwMN1bPuHnzLHjWBsfzYICs1PWlrdE7gQTgtdRRnjr2tDmqQPoQYJ4+PngRuz6gshwBFltwJeEX3KkPkK8hsTb01P4UZ0DwxvdiCd3sQcDk9tWCe8dc5vFG83ykPHhXn/QRma5S1oDh5upWvpuQC94OwpH6naWQ1F3LQInrA79pDvSfxLPGZsCJy3hsEBy2MFgILkorWWScEcHLshJZ/Q31hy5y/vgnFs9tvzBH5SZML124QSOsEK2Dd3AUYhFrNnB+TcYuSSoCWNCf2l9TZWB0TNogaY0DeI0/WWne2RKWxnxLBQ4D6SOuoPMWY+4VWbrzXerfRqwssAm/SiFaFn4dAk+CTsHBV3Li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fmy52S7Yi5DZxtrvmUsi16YfK0S9SVVet+zvDPo+vRO9QGHuO57OaA5oviIO/fNMi0EPuCxNP20WdX1CH5oMoiLTOkHiY1Bb4tFKNwZrS7DPXbBUM5BbUfJ76XhrCF0+s4lkN6dCHeMbtm2rab83ouiU2NQ3jAJ/alNf+S9goMn4y5JDR4+/clr78D8=</diagram></mxfile>
10 changes: 10 additions & 0 deletions Material/imgsrc/plantuml/amts_data_objects.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
```plantuml
@startuml component_example
actor client
node app
database db

db -> app
app -> client
@enduml
```
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Include Gematik Logo](ImplementationGuide/images/Gematik_Logo_Flag.png)

# About
This template standardizes the development of fhir resources with .fsh resources. It should reduce time for setup and ease the development process.

Expand Down
Binary file added plantuml.jar
Binary file not shown.
67 changes: 67 additions & 0 deletions scripts/build_with_replace_includes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/bin/bash
echo "Start building source files"

# check prerequisites
required_asciidoctor_version="2.0.20"
actual_asciidoctor_version=$(asciidoctor --version)
if ! grep -q "$required_asciidoctor_version" <<<"$actual_asciidoctor_version"; then
echo "Incorrect asciidoctor version. Expected $required_asciidoctor_version but found $actual_asciidoctor_version"
exit 1
fi

required_asciidoctor_diagram_version="2.2.14"
actual_asciidoctor_diagram_version=$(gem list | grep "asciidoctor-diagram (")
if ! grep -q "$required_asciidoctor_diagram_version" <<<"$actual_asciidoctor_diagram_version"; then
echo "Incorrect asciidoctor diagram version. Expected $required_asciidoctor_diagram_version but found $actual_asciidoctor_diagram_version"
exit 1
fi

# STAGE_1: creates images from the puml files and will store them in /puml/images

# prepare
cd "$(dirname "$0")" || exit
# rm ../../images/puml_*

# loop through all puml files and create the image
for filename in $(find ../../puml -name '*.puml'); do

filebase=$(basename -- "$filename") # test.adoc
name="${filebase%.*}" # test

if ! git diff --quiet -- "$filename"; then
echo "$filebase has been modified. Creating Puml"

pumlPath=../puml/${name}.puml
newFileRoot=../puml/${name}
newFileName=${newFileRoot//-source/}
echo "Creating Puml ${name}"

tempAdocFile=../../docs_sources/${name}.adoc

# creates a temporary adoc file in order to render with asciidoctor-diagram
touch ${tempAdocFile}
echo "[plantuml, target=../../images/puml_${name}, format=png]
....
include::${pumlPath}[]
...." >${tempAdocFile}
asciidoctor -r asciidoctor-diagram -o ../puml/$newFileName ../../docs_sources/${name}.adoc
rm ../../docs_sources/${name}.adoc
fi

done

# cleanup temp files
if [ -d "../puml" ]; then
rm -r ../puml
fi

# STAGE_2 this creates new adoc files in /docs/resources

for filename in $(find ../../docs_sources -name '*.adoc'); do
newFileName=${filename//-source/}
newFileName=${newFileName//_sources/}
asciidoctor-reducer $filename -o $newFileName
done

# Echo that the process is finished
echo "Finished building source files"
Loading
Loading