diff --git a/ImplementationGuide/markdown/AnmerkungenMS.md b/ImplementationGuide/markdown/AnmerkungenMS.md index f8934ae0..e2217940 100644 --- a/ImplementationGuide/markdown/AnmerkungenMS.md +++ b/ImplementationGuide/markdown/AnmerkungenMS.md @@ -5,7 +5,7 @@ **Bedeutung:** Der Status MUSS insbesondere zur Differenzierung von abgeschlossenen, vorläufigen oder korrigierten Beobachtungen angegeben werden. Es ist möglich, dass einzelne Systeme nur Werte vom Status `final` bereitstellen. Empfangende Systeme müssen jedoch in der Lage sein, sämtliche Status-Codes zu interpretieren. -**Hinweis:** Siehe Beschreibung in der [FHIR Kernspezifikation]https://hl7.org/fhir/R4/observation-definitions.html#Observation.status). +**Hinweis:** Siehe Beschreibung in der [FHIR Kernspezifikation](https://hl7.org/fhir/R4/observation-definitions.html#Observation.status). ### `Observation.category` diff --git a/ImplementationGuide/markdown/CapabilityStatement.md b/ImplementationGuide/markdown/CapabilityStatement.md index a1f790ee..b13e367f 100644 --- a/ImplementationGuide/markdown/CapabilityStatement.md +++ b/ImplementationGuide/markdown/CapabilityStatement.md @@ -1,8 +1,8 @@ -# Konformitätserklärung [(CapabilityStatement)]https://hl7.org/fhir/R4/capabilitystatement.html) +# Konformitätserklärung [(CapabilityStatement)](https://hl7.org/fhir/R4/capabilitystatement.html) -Jede Instanz eines bestätigungsrelevanten Systems MUSS an ihrem Endpunkt eine [CapabilityStatement]https://hl7.org/fhir/R4/capabilitystatement.html)-Ressource bereitstellen. +Jede Instanz eines bestätigungsrelevanten Systems MUSS an ihrem Endpunkt eine [CapabilityStatement](https://hl7.org/fhir/R4/capabilitystatement.html)-Ressource bereitstellen. -Hierzu MUSS die [capabilities-Interaktion gemäß FHIR-Spezifikation]https://hl7.org/fhir/R4/http.html#capabilities) unterstützt werden. +Hierzu MUSS die [capabilities-Interaktion gemäß FHIR-Spezifikation](https://hl7.org/fhir/R4/http.html#capabilities) unterstützt werden. Der MODE-Parameter kann ignoriert werden. Das CapabilityStatement in dieser Spezifikation stellt die Anforderungen seitens der gematik dar (`kind` = "requirements"). Zur Unterscheidung von Anforderungen, die erfüllt werden MÜSSEN gegenüber jenen, die erfüllt werden KÖNNEN, wird die [CapabilityStatement-Expectation-Extension](https://hl7.org/fhir/R4/extension-capabilitystatement-expectation.html) mit den möglichen Werten "SHALL" (=MUSS) und "MAY" (=KANN) verwendet. diff --git a/ImplementationGuide/markdown/Datenobjekte.md b/ImplementationGuide/markdown/Datenobjekte.md index b63f38d2..31cf392d 100644 --- a/ImplementationGuide/markdown/Datenobjekte.md +++ b/ImplementationGuide/markdown/Datenobjekte.md @@ -1,3 +1,14 @@ # Datenobjekte +Folgende Datenobjekte und Interaktionen aus dem Modul [ISiK Basis Stufe 3](https://simplifier.net/guide/implementierungsleitfaden-isik-basismodul-stufe-3?version=current) werden in diesem Modul verwendet:: +* [Patient](https://simplifier.net/guide/Implementierungsleitfaden-ISiK-Basismodul-Stufe-3/ImplementationGuide-markdown-Datenobjekte-Datenobjekte-Patient?version=current) +* [Kontakt/Fall (Encounter)](https://simplifier.net/guide/Implementierungsleitfaden-ISiK-Basismodul-Stufe-3/ImplementationGuide-markdown-Datenobjekte-Datenobjekte-Kontakt?version=current) + +Die Verwendung in diesem Modul bedeutet: +Wenn dieses Modul auf Datenobjekte aus dem Basismodul referenziert, dann MÜSSEN die referenzierten FHIR-Ressourcen konform zu den Vorgaben aus dem Basismodul sein. +Die Referenzierung von im Basismodul spezifizierten Datenobjekten, bedeutet nicht, dass die Interaktionen für die entsprechenden Datenobjekte aus dem Basismodul auch im Modul Vitalparameter und Körpermaße bestätigungsrelevant sind. + +Darüber hinaus gelten in diesem Modul folgende Datenobjekt-spezifische Festlegungen: + {{index:current}} + diff --git a/ImplementationGuide/markdown/Einfuehrung.md b/ImplementationGuide/markdown/Einfuehrung.md index e111ca4e..8c9babe4 100644 --- a/ImplementationGuide/markdown/Einfuehrung.md +++ b/ImplementationGuide/markdown/Einfuehrung.md @@ -1,9 +1,9 @@ gematik logo ---- -Version: 3.0.0 +Version: 3.0.1 -Datum: 1.7.2023 +Datum: 05.01.2024 Status: Aktiv diff --git a/ImplementationGuide/markdown/Interaktionen.md b/ImplementationGuide/markdown/Interaktionen.md index e24257d8..ad6eff4f 100644 --- a/ImplementationGuide/markdown/Interaktionen.md +++ b/ImplementationGuide/markdown/Interaktionen.md @@ -13,7 +13,7 @@ Folgende Suchparameter sind für das Vitalparamter-Modul relevant, auch in Kombi ``` GET [base]/Observation?status=http://hl7.org/fhir/observation-status|final``` Anwendungshinweise: Weitere Informationen zur Suche nach "status" - finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"]https://hl7.org/fhir/R4/search.html#token). + finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"](https://hl7.org/fhir/R4/search.html#token). 1. Der Suchparameter "category" MUSS unterstützt werden: @@ -22,7 +22,7 @@ Folgende Suchparameter sind für das Vitalparamter-Modul relevant, auch in Kombi ``` GET [base]/Observation?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs``` Anwendungshinweise: Weitere Informationen zur Suche nach "status" - finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"]https://hl7.org/fhir/R4/search.html#token). + finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"](https://hl7.org/fhir/R4/search.html#token). Dieser Suchparameter ist für die Umsetzung des IHE QEDm Profils verpflichtend. @@ -44,7 +44,7 @@ Folgende Suchparameter sind für das Vitalparamter-Modul relevant, auch in Kombi ```GET [base]/Observation?code=http://loinc.org|85354-9``` Anwendungshinweise: Weitere Informationen zur Suche nach "code" - finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"]https://hl7.org/fhir/R4/search.html#token). + finden sich in der [FHIR-Basisspezifikation - Abschnitt "Token Search"](https://hl7.org/fhir/R4/search.html#token). Dieser Suchparameter ist für die Umsetzung des IHE QEDm Profils verpflichtend. diff --git a/ImplementationGuide/markdown/ReleaseNotes.md b/ImplementationGuide/markdown/ReleaseNotes.md index edf3eeff..1e536444 100644 --- a/ImplementationGuide/markdown/ReleaseNotes.md +++ b/ImplementationGuide/markdown/ReleaseNotes.md @@ -4,6 +4,12 @@ Im Rahmen der ISiK-Veröffentlichungen wird das [Semantic Versioning](https://se Die erste Ziffer X bezeichnet ein Major-Release und regelt die Gültigkeit von Releases. Die dritte Ziffer Y (Release x.0.y) bezeichnet eine technische Korrektur und versioniert kleinere Änderungen (Packages) während eines Jahres, z. B. 1.0.1. +---- +Version: 3.0.1 +Datum: 05.01.2023 + +* Update der ISIk Basis Dependency: [update dependency ISIK Basis](https://github.com/gematik/spec-ISiK-Vitalparameter-und-Koerpermasze/pull/141/commits/2d00c0a267756694cd86dd0866e8b0339f88d593) +* Klärung zur Nutzung der ISiK Basis Ressourcen: [update Datenobjekte Basis adoption](https://github.com/gematik/spec-ISiK-Vitalparameter-und-Koerpermasze/pull/141/commits/a8654b840e8ef4d57722eac4873d19eac1267870) ---- Version: 3.0.0 diff --git a/Resources/fsh-generated/resources/CapabilityStatement-ISiK-capabilityStatement-vitalparameter-server.json b/Resources/fsh-generated/resources/CapabilityStatement-ISiK-capabilityStatement-vitalparameter-server.json index 0e935781..9f960b96 100644 --- a/Resources/fsh-generated/resources/CapabilityStatement-ISiK-capabilityStatement-vitalparameter-server.json +++ b/Resources/fsh-generated/resources/CapabilityStatement-ISiK-capabilityStatement-vitalparameter-server.json @@ -4,11 +4,11 @@ "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/CapabilityStatement/vitalparameter-server", "status": "active", "experimental": false, - "version": "3.0.0", + "version": "3.0.1", "publisher": "gematik GmbH", - "date": "2023-07-01", + "date": "2024-01-05", "implementationGuide": [ - "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/ImplementationGuide|3.0.0" + "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/ImplementationGuide|3.0.1" ], "name": "ISiKCapabilityStatementVitalparameterServer", "title": "ISiK CapabilityStatement Vitalparameter Server", diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKAtemfrequenz.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKAtemfrequenz.json index a0081f3c..3746e355 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKAtemfrequenz.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKAtemfrequenz.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKAtemfrequenz", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKAtemfrequenz", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKAtemfrequenz", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKBlutdruck.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKBlutdruck.json index 53a6dfc6..e85b90df 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKBlutdruck.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKBlutdruck.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKBlutdruck", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKBlutdruck", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKBlutdruck", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKEkg.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKEkg.json index 97cd9dc8..e6192af3 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKEkg.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKEkg.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKEkg", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKEkg", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKEkg", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKGCS.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKGCS.json index 2a2abe52..b09e8481 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKGCS.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKGCS.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKGCS", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKGCS", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKGCS", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKHerzfrequenz.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKHerzfrequenz.json index aa31ae54..eff3e314 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKHerzfrequenz.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKHerzfrequenz.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKHerzfrequenz", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKHerzfrequenz", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKHerzfrequenz", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergewicht.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergewicht.json index a603c2fd..77144581 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergewicht.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergewicht.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKKoerpergewicht", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKKoerpergewicht", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKKoerpergewicht", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergroesse.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergroesse.json index aadb8b56..def1f356 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergroesse.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpergroesse.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKKoerpergroesse", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKKoerpergroesse", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKKoerpergroesse", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpertemperatur.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpertemperatur.json index e045aae5..ce99e030 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpertemperatur.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKKoerpertemperatur.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKKoerpertemperatur", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKKoerpertemperatur", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKKoerpertemperatur", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKKopfumfang.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKKopfumfang.json index 6572234c..cb6ca53d 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKKopfumfang.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKKopfumfang.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKKopfumfang", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKKopfumfang", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKKopfumfang", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/fsh-generated/resources/StructureDefinition-ISiKSauerstoffsaettigung.json b/Resources/fsh-generated/resources/StructureDefinition-ISiKSauerstoffsaettigung.json index d53c01c4..1dbac35a 100644 --- a/Resources/fsh-generated/resources/StructureDefinition-ISiKSauerstoffsaettigung.json +++ b/Resources/fsh-generated/resources/StructureDefinition-ISiKSauerstoffsaettigung.json @@ -2,11 +2,11 @@ "resourceType": "StructureDefinition", "id": "ISiKSauerstoffsaettigung", "url": "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/StructureDefinition/ISiKSauerstoffsaettigung", - "version": "3.0.0", + "version": "3.0.1", "name": "ISiKSauerstoffsaettigung", "status": "active", "experimental": false, - "date": "2023-07-01", + "date": "2024-01-05", "publisher": "gematik GmbH", "fhirVersion": "4.0.1", "mapping": [ diff --git a/Resources/input/fsh/ruleset.fsh b/Resources/input/fsh/ruleset.fsh index fbcbdedc..40bce258 100644 --- a/Resources/input/fsh/ruleset.fsh +++ b/Resources/input/fsh/ruleset.fsh @@ -1,15 +1,15 @@ RuleSet: Meta * ^status = #active * ^experimental = false -* ^version = "3.0.0" +* ^version = "3.0.1" * ^publisher = "gematik GmbH" -* ^date = "2023-07-01" +* ^date = "2024-01-05" RuleSet: Meta-CapabilityStatement * status = #active * experimental = false -* version = "3.0.0" +* version = "3.0.1" * publisher = "gematik GmbH" -* date = "2023-07-01" -* implementationGuide = "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/ImplementationGuide|3.0.0" +* date = "2024-01-05" +* implementationGuide = "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/ImplementationGuide|3.0.1" * url = "https://gematik.de/fhir/isik/v3/VitalparameterUndKoerpermasze/CapabilityStatement/vitalparameter-server" \ No newline at end of file diff --git a/Resources/sushi-config.yaml b/Resources/sushi-config.yaml index 702a7e49..88dff244 100644 --- a/Resources/sushi-config.yaml +++ b/Resources/sushi-config.yaml @@ -4,4 +4,4 @@ FSHOnly: true applyExtensionMetadataToRoot: false dependencies: de.basisprofil.r4: 1.4.0 - de.gematik.isik-basismodul: 3.0.0 \ No newline at end of file + de.gematik.isik-basismodul: 3.0.1 diff --git a/package.json b/package.json index f6680d5e..501d8b0e 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "de.gematik.isik-vitalparameter", - "version": "3.0.0", + "version": "3.0.1", "description": "Package Release des ISiK Modul Vitalparameter und Körpermaße", "fhirVersions": [ "4.0.1" ], "dependencies": { "de.basisprofil.r4": "1.4.0", - "de.gematik.isik-basismodul": "3.0.0" + "de.gematik.isik-basismodul": "3.0.1" } } diff --git a/scripts/config.yaml b/scripts/config.yaml new file mode 100644 index 00000000..ab23a178 --- /dev/null +++ b/scripts/config.yaml @@ -0,0 +1,26 @@ +package.json: + - type: version + regex: '("version":\s*")([\d\.]+.*)(")' +sushi-config.yaml: + - type: version + regex: '(version:\s*)(\d+\.\d+\.\d+.*)()' +ruleset.fsh: + - type: version + regex: + - '(\*\s*version\s*=\s*")([\d\.]+.*)(")' + - '(\*\s*\^version\s*=\s*")([\d\.]+.*)(")' + - '(\*\s*implementationGuide\s*=\s*".*\|)([\d\.]+.*)(")' + - type: date + regex: + - '(\*\s*date\s*=\s*")(\d+\-\d+\-\d+)(")' + - '(\*\s*\^date\s*=\s*")(\d+\-\d+\-\d+)(")' + format: '%Y-%m-%d' +Einfuehrung.md: + - type: version + regex: '(Version: \s*)(\d+\.\d+\.\d+.*)()' + - type: date + regex: '(Datum:\s*)(\d+\.\d+\.\d+.*)()' + format: '%d.%m.%Y' +ImplementierungsleitfadenIsiK_basismodul.json: + - type: version + regex: '("version":\s*")(\d+\.\d+\.\d+.*)(",)' \ No newline at end of file diff --git a/scripts/release_publish.py b/scripts/release_publish.py index a3c1ef96..86adfa52 100644 --- a/scripts/release_publish.py +++ b/scripts/release_publish.py @@ -1,127 +1,104 @@ +import datetime import re import subprocess import os import argparse from datetime import date +import yaml -class FileWithVersionToUpdate: - def __init__(self, filename, version_regex) -> None: - self.filename = filename - self.version_regex = version_regex - self.location = None - - def set_file_location(self, location): - self.location = location -class FileWithDateToUpdate: - def __init__(self, filename, date_regex) -> None: +class FileTypeCombinationToUpdate: + def __init__(self, filename, content_type, regex_list, format=None) -> None: self.filename = filename - self.date_regex = date_regex + self.content_type = content_type + self.regex_list = regex_list + self.format = format self.location = None def set_file_location(self, location): self.location = location -# class FileWithDateToUpdate: -# def __init__(self, filename, date_regex, format) -> None: -# self.filename = filename -# self.date_regex = date_regex -# self.location = None -# self.format = format -# def set_file_location(self, location): -# self.location = location - - +def load_config_file(config_file_path): + with open(config_file_path, 'r') as config_file: + return yaml.safe_load(config_file) def get_new_release_version_from_branch_name() -> str: git_branch = subprocess.check_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip().decode() return git_branch -def replace_version_in_files(files : list, new_release_version: str): - if files is None: - print("Error: No Files found!") - return - for file in files: - replace_version_in_file(file,new_release_version) +def create_files_to_update_list(config): + files_to_update = [] + for filename, replacements in config.items(): + for replacement in replacements: + files_to_update.append( + FileTypeCombinationToUpdate( + filename, + replacement["type"], + replacement["regex"] if isinstance(replacement["regex"], list) else [replacement["regex"]], + replacement.get("format", None), + ) + ) + return files_to_update -def replace_version_in_file(file: FileWithVersionToUpdate,new_release_version: str): - with open(file.location, 'r') as input_file: - input_text = input_file.read() - output_text = re.sub(file.version_regex, rf'\g<1>{new_release_version}\g<3>', input_text) - print(f"Info: Replaced version with '{new_release_version}' in file '{file.location}'.") +def locate_files_in_current_project(files: list): + located_files = [] + for current_file in files: + file_location = find_file(current_file.filename, ".") + if file_location is not None: + current_file.set_file_location(file_location) + located_files.append(current_file) + else: + print(f"Warning: File '{current_file.filename}' not found.") + return located_files - with open(file.location, 'w') as output_file: - output_file.write(output_text) -def replace_date_in_files(files : list, new_release_date: str): +def find_file(name, path="."): + for root, dirs, files in os.walk(path): + if name in files: + print(f"Info: Found '{name}' in {root}.") + return os.path.join(root, name) + return None + + +def replace_content_in_files(files: list, new_release_version: str, new_date: datetime): if files is None: - print("Error: No Files found!") + print("Error: No files found!") return - for file in files: - replace_date_in_file(file,new_release_date) + for FileTypeCombination in files: + if FileTypeCombination.content_type == "version": + replace_version_in_file(FileTypeCombination, new_release_version) + elif FileTypeCombination.content_type == "date": + replace_date_in_file(FileTypeCombination, new_date) + -def replace_date_in_file(file: FileWithVersionToUpdate, new_date: str): +def replace_version_in_file(file: FileTypeCombinationToUpdate, new_release_version: str): with open(file.location, 'r') as input_file: input_text = input_file.read() - #output_text = re.sub(file.date_regex, rf'\g<1>{new_date.strftime(file.format)}\g<3>', input_text) #see https://www.programiz.com/python-programming/datetime#:~:text=Python%20format%20datetime&text=It%27s%20more%20common%20to%20use,()%20methods%20to%20handle%20this. - output_text = re.sub(file.date_regex, rf'\g<1>{new_date}\g<3>', input_text) - print(f"Info: Replaced date with '{new_date}' in file '{file.location}'.") + for regex in file.regex_list: + input_text = re.sub(regex, rf'\g<1>{new_release_version}\g<3>', input_text) + + print(f"Info: Replaced version with '{new_release_version}' in file '{file.location}'.") with open(file.location, 'w') as output_file: - output_file.write(output_text) - -def get_file_to_update_version_list(): - file_list = [] - file_list.append(FileWithVersionToUpdate('package.json', r'("version":\s*")([\d\.]+.*)(")')) - file_list.append(FileWithVersionToUpdate('sushi-config.yaml', r'(version:\s*")(\d+\.\d+\.\d+.*)(")')) - file_list.append(FileWithVersionToUpdate('ruleset.fsh', r'(\*\s*version\s*=\s*")([\d\.]+.*)(")')) - file_list.append(FileWithVersionToUpdate('ruleset.fsh', r'(\*\s*\^version\s*=\s*")([\d\.]+.*)(")')) - file_list.append(FileWithVersionToUpdate('Einfuehrung.md', r'(Version: \s*)(\d+\.\d+\.\d+.*)()')) - file_list.append(FileWithVersionToUpdate('ImplementierungsleitfadenIsiK_basismodul.json', r'("version":\s*")([\d\.]+.*)(")')) - file_list.append(FileWithVersionToUpdate('ImplementierungsleitfadenIsiK_Terminplanung.json', r'("version":\s*")([\d\.]+.*)(")')) - return file_list - -def get_file_to_update_date_list(): - file_list = [] - #file_list.append(FileWithDateToUpdate('ruleset.fsh', r'(date\s*=\s*")(\d+\-\d+\-\d+)(")'), '%m/%d/%Y' ) - #file_list.append(FileWithDateToUpdate('Einfuehrung.md', r'(Datum: \s*)(\d+\.\d+\.\d+)()') , '%m/%d/%Y') - file_list.append(FileWithDateToUpdate('ruleset.fsh', r'(\*\s*date\s*=\s*")(\d+\-\d+\-\d+)(")')) - file_list.append(FileWithDateToUpdate('ruleset.fsh', r'(\*\s*\^date\s*=\s*")(\d+\-\d+\-\d+)(")')) - file_list.append(FileWithDateToUpdate('Einfuehrung.md', r'(Datum:\s*)(\d+\.\d+\.\d+.*)()')) - return file_list + output_file.write(input_text) -def locate_files_in_current_project(files: list): - return_list = [] - for current_file in files: - file_location = find_file(current_file.filename, ".") - if file_location is not None: - current_file.set_file_location(file_location) - return_list.append(current_file) - else: - print(f"Warning: File '{current_file.filename}' not found.") - return return_list +def replace_date_in_file(file: FileTypeCombinationToUpdate, new_date: datetime): + with open(file.location, 'r') as input_file: + input_text = input_file.read() -def find_file(name, path="."): - for root, dirs, files in os.walk(path): + for regex in file.regex_list: + input_text = re.sub(regex, rf'\g<1>{new_date.strftime(file.format)}\g<3>', input_text) - if name in files: - print(f"Info: Found '{name}' in {root}.") - return os.path.join(root, name) - return None + print(f"Info: Replaced date with '{new_date.strftime(file.format)}' in file '{file.location}'.") -def get_latest_release_tag(): - cmd = 'git describe --abbrev=0 --tags --match "v*.*.*" HEAD' - try: - output = subprocess.check_output(cmd, shell=True) - return output.decode().strip() - except subprocess.CalledProcessError: - return None + with open(file.location, 'w') as output_file: + output_file.write(input_text) def output_commit_messages_since_last_release(): latest_release_tag = get_latest_release_tag() @@ -136,15 +113,22 @@ def output_commit_messages_since_last_release(): except subprocess.CalledProcessError: print("Warning: Failed to get commit messages.") -def main(): - today = date.today() +def get_latest_release_tag(): + cmd = 'git describe --abbrev=0 --tags --match "v*.*.*" HEAD' + try: + output = subprocess.check_output(cmd, shell=True) + return output.decode().strip() + except subprocess.CalledProcessError: + return None - parser = argparse.ArgumentParser(description='Update release version number') + +def main(): + parser = argparse.ArgumentParser(description='Update release version number and date') parser.add_argument('-b', '--branch', action='store_true', help='get new version from branch name') parser.add_argument('-v', '--version', type=str, help='specify new version number') + parser.add_argument('-d', '--date', type=str, help='specify custom date for release') + parser.add_argument('-c', '--config', type=str, default='config.yaml', help='specify config file') parser.add_argument('-o', '--output', action='store_true', help='output commit messages since last release') - # TODO new argument -d if not date_time now - args = parser.parse_args() if args.version: @@ -154,16 +138,19 @@ def main(): else: parser.error('No new release version specified. Please use either -v or -b to specify the new release version.') - if args.output: - output_commit_messages_since_last_release() + if args.date: + custom_date = datetime.datetime.strptime(args.date, '%d.%m.%Y').date() + else: + custom_date = date.today() - file_to_update_version_list = get_file_to_update_version_list() - file_version_list = locate_files_in_current_project(file_to_update_version_list) - replace_version_in_files(file_version_list, new_release_version) + config_file_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), args.config) + config = load_config_file(config_file_path) + files_to_update = create_files_to_update_list(config) + located_files = locate_files_in_current_project(files_to_update) + replace_content_in_files(located_files, new_release_version, custom_date) - file_to_update_date_list = get_file_to_update_date_list() - file_date_list = locate_files_in_current_project(file_to_update_date_list) - replace_date_in_files(file_date_list, today) + if args.output: + output_commit_messages_since_last_release() if __name__ == "__main__": main() \ No newline at end of file diff --git a/scripts/update_version.sh b/scripts/update_version.sh deleted file mode 100644 index 2cbe628d..00000000 --- a/scripts/update_version.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -clear -# This script will download the latest validation script from the template source save it -# to the scripts_folder and execute it to validate your fhir ressources. -script_name=release_publish.py -script_path=. - -#parentdir="$(dirname "$script_path")" -#mkdir -p "$parentdir" - -curl https://raw.githubusercontent.com/gematik/spec-TemplateForSimplifierProjects/feature/release_publish/scripts/$script_name -o $script_path -chmod a+x $script_path -python3 $script_name \ No newline at end of file