Skip to content

Commit e1484bf

Browse files
authored
Merge pull request #122 from datasharingframework/dsf-2-doc-improvements
Dsf 2 doc improvements
2 parents ff659a9 + d341514 commit e1484bf

File tree

1,835 files changed

+498177
-168506
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,835 files changed

+498177
-168506
lines changed

.gitignore

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,26 @@ docs/node_modules/
44
docs/src/.vuepress/.cache/
55
docs/src/.vuepress/.temp/
66
docs/src/.vuepress/dist/
7-
docs/yarn.lock
7+
docs/yarn.lock
8+
/temp-out/
9+
10+
# Ignore IDE specific files
11+
.vscode/
12+
.idea/
13+
*.iml
14+
.DS_Store
15+
*.log
16+
npm-debug.log*
17+
yarn-error.log*
18+
pnpm-debug.log*
19+
.env
20+
.env.local
21+
.env.*.local
22+
.cache/
23+
.next/
24+
out/
25+
build/
26+
dist/
27+
coverage/
28+
*.tsbuildinfo
29+
.sass-cache/

api-gen/gen-all.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ -z "${1:-}" ]; then
5+
echo "Usage: $0 <version>" >&2
6+
echo "Example: $0 2.0.0-RC2" >&2
7+
exit 1
8+
fi
9+
10+
VERSION="$1"
11+
echo Generate API documentation
12+
./gen-javadoc.sh "$VERSION"
13+
./gen-maven-plugin-doc.sh
14+
./gen-fhir-ig.sh

api-gen/gen-fhir-ig.sh

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
#!/bin/bash
2+
echo Generate FHIR IG
3+
4+
#!/bin/bash
5+
set -euo pipefail
6+
7+
if [ -z "${1:-}" ]; then
8+
echo "Usage: $0 <version> [api-list...]" >&2
9+
echo "Example: $0 2.0.0-RC2" >&2
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
shift
15+
16+
17+
echo Download FHIR IG resources for version ${VERSION}
18+
19+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
20+
WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
21+
22+
had_errors=0
23+
24+
25+
ARTIFACT="dsf-fhir-validation"
26+
JARNAME="${ARTIFACT}-${VERSION}.jar"
27+
BASE_URL="https://repo1.maven.org/maven2/dev/dsf/${ARTIFACT}/${VERSION}"
28+
URL="${BASE_URL}/${JARNAME}"
29+
OUT_DIR="$WORKSPACE_ROOT/temp-out/dsf-fhir-validation"
30+
31+
echo "=== Processing (${ARTIFACT}) ==="
32+
echo "Download: ${URL}"
33+
mkdir -p "$OUT_DIR"
34+
35+
TMPFILE="$(mktemp -t "${ARTIFACT}.XXXXXX").jar"
36+
37+
if ! curl -sfSL --retry 3 -o "$TMPFILE" "$URL"; then
38+
echo "Error: Download failed for ${api}: ${URL}" >&2
39+
rm -f "$TMPFILE"
40+
had_errors=1
41+
continue
42+
fi
43+
44+
echo "Extracting ${JARNAME} to ${OUT_DIR}"
45+
# jar is a ZIP archive
46+
if ! unzip -oq "$TMPFILE" -d "$OUT_DIR"; then
47+
echo "Error: Extraction failed for ${api}" >&2
48+
rm -f "$TMPFILE"
49+
had_errors=1
50+
continue
51+
fi
52+
53+
rm -f "$TMPFILE"
54+
echo "FHIR ressources extracted to ${OUT_DIR}"
55+
56+
57+
if [ "$had_errors" -ne 0 ]; then
58+
echo "One or more downloads/extractions failed." >&2
59+
exit 2
60+
fi
61+
62+
echo Generate implementation guide
63+
64+
# copy template/fhir-ig content to temp-out/fhir-ig-gen
65+
66+
TEMPLATE_DIR="$SCRIPT_DIR/template/fhir-ig"
67+
IG_OUT_DIR="$WORKSPACE_ROOT/temp-out/fhir-ig-gen"
68+
69+
mkdir -p "$IG_OUT_DIR"
70+
cp -R "$TEMPLATE_DIR/"* "$IG_OUT_DIR/"
71+
echo "Copied IG template files to ${IG_OUT_DIR}"
72+
# copy downloaded FHIR resources to temp-out/fhir-ig-gen/input/dsf-resources
73+
RESOURCES_SRC_DIR="$WORKSPACE_ROOT/temp-out/dsf-fhir-validation/fhir"
74+
RESOURCES_DEST_DIR="$IG_OUT_DIR/input/dsf-resources"
75+
76+
mkdir -p "$RESOURCES_DEST_DIR"
77+
cp -R "$RESOURCES_SRC_DIR/"* "$RESOURCES_DEST_DIR/"
78+
echo "Copied FHIR resources to ${RESOURCES_DEST_DIR}"
79+
80+
# remove all non-xml files from resources dest dir
81+
find "$RESOURCES_DEST_DIR" -type f ! -name "*.xml" -delete
82+
echo "Removed non-XML files from ${RESOURCES_DEST_DIR}"
83+
#remove all xml files that do not start with dsf-
84+
find "$RESOURCES_DEST_DIR" -type f -name "*.xml" ! -name "dsf-*" -delete
85+
echo "Removed non-dsf XML files from ${RESOURCES_DEST_DIR}"
86+
87+
echo "FHIR IG generation setup completed. The IG source is in ${IG_OUT_DIR}."
88+
89+
UPDATE_PUBLISHER_SCRIPT="$IG_OUT_DIR/_updatePublisher.sh"
90+
GENONCE_SCRIPT="$IG_OUT_DIR/_genonce.sh"
91+
92+
# Set Java options as in CI
93+
export _JAVA_OPTIONS="-Xmx8g -Xms4g"
94+
echo "Set _JAVA_OPTIONS=${_JAVA_OPTIONS}"
95+
96+
# Run updatePublisher if available (make executable and pass --yes)
97+
if [ -f "$UPDATE_PUBLISHER_SCRIPT" ]; then
98+
echo "Found $UPDATE_PUBLISHER_SCRIPT, making executable and running with --yes"
99+
chmod +x "$UPDATE_PUBLISHER_SCRIPT"
100+
(cd "$IG_OUT_DIR" && ./_updatePublisher.sh --yes)
101+
echo "FHIR IG publisher update completed."
102+
else
103+
echo "No _updatePublisher.sh script found in ${IG_OUT_DIR}. Please update the IG publisher manually."
104+
fi
105+
106+
# Run sushi if available
107+
if command -v sushi >/dev/null 2>&1; then
108+
echo "Running sushi in ${IG_OUT_DIR}"
109+
(cd "$IG_OUT_DIR" && sushi .)
110+
echo "sushi execution completed."
111+
else
112+
echo "sushi not found in PATH. Please install sushi to build the IG." >&2
113+
fi
114+
115+
# Run genonce if available (make executable)
116+
if [ -f "$GENONCE_SCRIPT" ]; then
117+
echo "Found $GENONCE_SCRIPT, making executable and running"
118+
chmod +x "$GENONCE_SCRIPT"
119+
(cd "$IG_OUT_DIR" && ./_genonce.sh)
120+
echo "FHIR IG generation completed."
121+
else
122+
echo "No _genonce.sh script found in ${IG_OUT_DIR}. Please run the IG generation manually."
123+
fi

api-gen/gen-javadoc.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ -z "${1:-}" ]; then
5+
echo "Usage: $0 <version> [api-list...]" >&2
6+
echo "Example: $0 2.0.0-RC2 # downloads api-v1 and api-v2" >&2
7+
echo " $0 2.0.0-RC2 api-v1 # downloads only api-v1" >&2
8+
exit 1
9+
fi
10+
11+
VERSION="$1"
12+
shift
13+
14+
# default APIs if none provided
15+
if [ "$#" -eq 0 ]; then
16+
APIS=("api-v1" "api-v2")
17+
else
18+
APIS=("$@")
19+
fi
20+
21+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
22+
WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
23+
24+
had_errors=0
25+
26+
for api in "${APIS[@]}"; do
27+
# expect api names like "api-v1", "api-v2"
28+
ARTIFACT="dsf-bpe-process-${api}"
29+
JARNAME="${ARTIFACT}-${VERSION}-javadoc.jar"
30+
BASE_URL="https://repo1.maven.org/maven2/dev/dsf/${ARTIFACT}/${VERSION}"
31+
URL="${BASE_URL}/${JARNAME}"
32+
OUT_DIR="$WORKSPACE_ROOT/temp-out/${api}"
33+
34+
echo "=== Processing ${api} (${ARTIFACT}) ==="
35+
echo "Download: ${URL}"
36+
mkdir -p "$OUT_DIR"
37+
38+
TMPFILE="$(mktemp -t "${ARTIFACT}.XXXXXX").jar"
39+
40+
if ! curl -sfSL --retry 3 -o "$TMPFILE" "$URL"; then
41+
echo "Error: Download failed for ${api}: ${URL}" >&2
42+
rm -f "$TMPFILE"
43+
had_errors=1
44+
continue
45+
fi
46+
47+
echo "Extracting ${JARNAME} to ${OUT_DIR}"
48+
# jar is a ZIP archive
49+
if ! unzip -oq "$TMPFILE" -d "$OUT_DIR"; then
50+
echo "Error: Extraction failed for ${api}" >&2
51+
rm -f "$TMPFILE"
52+
had_errors=1
53+
continue
54+
fi
55+
56+
rm -f "$TMPFILE"
57+
echo "Javadoc for ${api} extracted to ${OUT_DIR}"
58+
done
59+
60+
if [ "$had_errors" -ne 0 ]; then
61+
echo "One or more downloads/extractions failed." >&2
62+
exit 2
63+
fi
64+
65+
echo "All selected Javadocs downloaded and extracted."

api-gen/gen-maven-plugin-doc.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
echo Generate Maven Plugin Documentation

api-gen/patch-sushi-config.sh

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
# Defaults
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
7+
CONFIG="${1:-$WORKSPACE_ROOT/temp-out/fhir-ig-gen/sushi-config.yaml}"
8+
RES_DIR="${2:-$WORKSPACE_ROOT/temp-out/fhir-ig-gen/input/dsf-resources}"
9+
10+
if [ ! -f "$CONFIG" ]; then
11+
echo "Error: sushi-config.yaml not found at $CONFIG" >&2
12+
exit 1
13+
fi
14+
if [ ! -d "$RES_DIR" ]; then
15+
echo "Error: resources dir not found at $RES_DIR" >&2
16+
exit 1
17+
fi
18+
19+
# portable mktemp: try simple mktemp, fallback to -t form (macOS)
20+
TMP_ENTRIES="$(mktemp 2>/dev/null || mktemp -t patch-sushi-entries)"
21+
TMP_OUT="$(mktemp 2>/dev/null || mktemp -t patch-sushi-out)"
22+
trap 'rm -f "$TMP_ENTRIES" "$TMP_OUT"' EXIT
23+
24+
# ensure file exists
25+
: > "$TMP_ENTRIES"
26+
27+
# iterate xml files, use parent dir as ResourceType and filename as id
28+
while IFS= read -r -d '' file; do
29+
parent="$(basename "$(dirname "$file")")"
30+
# skip Subscription resources entirely
31+
if [ "$parent" = "Subscription" ]; then
32+
continue
33+
fi
34+
35+
fname="$(basename "$file" .xml)"
36+
37+
# For NamingSystem do NOT remove dsf- prefix; for others remove leading dsf- if present
38+
if [ "$parent" = "NamingSystem" ]; then
39+
name="$fname"
40+
else
41+
name="${fname#dsf-}"
42+
fi
43+
44+
# remove trailing version segment if it starts with a digit, e.g. -2.0.0 or -2.0.0-RC1
45+
if [[ "$name" =~ ^(.+)-[0-9].*$ ]]; then
46+
name="${BASH_REMATCH[1]}"
47+
fi
48+
49+
key="${parent}/${name}"
50+
# append only if not already present (preserve first occurrence)
51+
if ! grep -q "^ ${key}:" "$TMP_ENTRIES"; then
52+
printf " %s:\n exampleBoolean: false\n\n" "$key" >> "$TMP_ENTRIES"
53+
fi
54+
done < <(find "$RES_DIR" -type f -name "*.xml" -print0)
55+
56+
# If no entries found, ensure resources: is removed or left unchanged
57+
if [ ! -s "$TMP_ENTRIES" ]; then
58+
echo "No XML resources found in $RES_DIR. No changes made to $CONFIG."
59+
exit 0
60+
fi
61+
62+
# replace existing resources: block in config with generated entries
63+
awk -v insfile="$TMP_ENTRIES" '
64+
BEGIN { in_resources=0; inserted=0 }
65+
# match a top-level "resources:" line (allow leading spaces)
66+
/^[[:space:]]*resources:[[:space:]]*$/ {
67+
print;
68+
# insert generated entries
69+
while((getline line < insfile) > 0) print line;
70+
close(insfile);
71+
inserted=1;
72+
in_resources=1;
73+
next
74+
}
75+
{
76+
if(in_resources){
77+
# skip indented lines (old resources block) and blank/comment lines that belong to it
78+
if($0 ~ /^[[:space:]]/ || $0 ~ /^#/ || $0 == "") next
79+
else in_resources=0
80+
}
81+
print
82+
}
83+
END {
84+
# if no resources: found, append one at end
85+
if(!inserted){
86+
print ""
87+
print "resources:"
88+
while((getline line < insfile) > 0) print line;
89+
close(insfile);
90+
}
91+
}
92+
' "$CONFIG" > "$TMP_OUT" && mv "$TMP_OUT" "$CONFIG"
93+
94+
echo "Updated $CONFIG with resource entries from $RES_DIR"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.DS_Store
2+
Thumbs.db
3+
/fsh-generated
4+
/input-cache
5+
/output
6+
/temp
7+
/template
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
stages:
2+
- setup
3+
- build
4+
- deploy
5+
6+
build:
7+
stage: build
8+
image:
9+
name: registry.it.hs-heilbronn.de/dsf/ig-builder
10+
entrypoint: [""]
11+
before_script:
12+
- export _JAVA_OPTIONS="-Xmx8g -Xms4g"
13+
script:
14+
- chmod +x _updatePublisher.sh
15+
- ./_updatePublisher.sh --yes
16+
- sushi .
17+
- chmod +x _genonce.sh
18+
- ./_genonce.sh
19+
artifacts:
20+
name: "$CI_PROJECT_NAME"
21+
paths:
22+
- output/
23+
# tags:
24+
# - docker
25+
26+
pages:
27+
stage: deploy
28+
script:
29+
- mkdir public
30+
- cp -r output/* public
31+
- cp public/index.html public/404.html
32+
artifacts:
33+
paths:
34+
- public

0 commit comments

Comments
 (0)