Table of Contents
The FHIR Snapshots Package Generator creates Snapshots for all StructureDefinitions in one or several FHIR-Packages. The result is one or several new FHIR packages with updated StructureDefinitions. Other Resources get copied without change to the final FHIR-Packages.
Warning Package resources in formats other than JSON (i.e. do not end with
.json
) are ignored and are not copied to the final FHIR-Package. The current version of The FHIR Snapshots Package Generator supports FHIR R4-Version of resources only.
See ReleaseNotes.md for all information regarding the (newest) releases.
The FHIR Snapshot Package Generator requires Java 11 or higher.
Download the latest release of FHIR Snapshot Package Generator from Releases and put the downloaded file fhir-snapshots-package-generator-cli-X.Y.Z.jar
in a folder of your choice.
To integrate the FHIR Snapshot Package Generator into a Java application use Maven or Gradle and declare a dependency on de.gematik.fhir/fhir-snapshots-package-generator-lib
(cf. Maven Central).
Example for declaration of a Maven dependency:
<dependency>
<groupId>de.gematik.fhir</groupId>
<artifactId>fhir-snapshots-package-generator-lib</artifactId>
<version>${version.snapshot-generator}</version>
</dependency>
with ${version.snapshot-generator}
being a placeholder for the version of the FHIR Snapshot Package Generator.
To create snapshots of one or several FHIR packages create the following example folder structure, which will be used as input for the FHIR Snapshot Package Generator:
└── src-packages/
├── patches/
│ └── mypackage-1.0.0/
│ └── myprofile.json
├── mypackage-1.0.0.tgz
├── mypackage-dependency1-1.0.0.tgz
└── mypackage-dependency2-1.0.0.tgz
The src-packages
folder should contain all FHIR packages, for which snapshots should be created, and their dependencies. The source folder can also include so-called patches
. These are single FHIR resources, which override the original ones during snapshot generation, e.g. in case of bugs in third-party FHIR packages. For this purpose a patched resource, e.g. myprofile.json
,should be placed in a subfolder with exactly the same name as the original package file name but without the ending, i.e. mypackage-1.0.0/
for the package mypackage-1.0.0.tgz
in the example above.
After processing the src-packages folder the FHIR Snapshot Package Generator creates the following output folder structure:
└── output-folder/
├── mypackage-1.0.0.tgz
├── mypackage-dependency1-1.0.0.tgz
└── mypackage-dependency2-1.0.0.tgz
All FHIR packages in the output folder contain the patches or original resources from the corresponding packages with updated snapshot elements for all StructureDefinitions.
The FHIR Snapshot Package Generator requires a valid path to a folder with source FHIR packages and a valid path to the output directory as arguments. The following example shows how to use the FHIR Snapshot Package Generator from the command line:
java -jar fhir-snapshots-package-generator-cli-X.Y.Z.jar path/to/src-packages path/to/output-folder
The third argument, which is optional, can set a working directory.
java -jar fhir-snapshots-package-generator-cli-X.Y.Z.jar path/to/src-packages path/to/output-folder path/to/working-directory
The following example shows how to use the FHIR Snapshot Package Generator as a Java library:
String srcPackageFolderPath = "path/to/src-packages";
String outputFolderPath = "path/to/output-folder";
SnapshotGenerator snapshotGenerator = new SnapshotGenerator();
snapshotGenerator.generateSnapshots(packageFolderPath, packageFolderPath.replace(SRC_PACKAGE, "package"), "");
String srcPackageFolderPath = "path/to/src-packages";
String outputFolderPath = "path/to/output-folder";
String workingDirectory = "path/to/working-directory";
SnapshotGenerator snapshotGenerator = new SnapshotGenerator();
snapshotGenerator.generateSnapshots(packageFolderPath, packageFolderPath.replace(SRC_PACKAGE, "package"), workingDirectory);
If you want to contribute, please check our CONTRIBUTING.md.
Check Apache License, Version 2.0
To get in touch with us, please open an issue in this GitHub project.