Skip to content

Commit

Permalink
Update BMMs to latest version + json schema improvements (#459)
Browse files Browse the repository at this point in the history
* Add latest (fixed) bmms from specifications-ITS-BMM (openEHR/specifications-ITS-BMM#17)

* Improve validation message to show enclosing class when creating a simple type results in an error

* Remove Nullable from ACTIVITY.action_archetype_id, it should not be there according to specification

* Add root types/entry points to json schema

* update archie version in json schema generator

* Add option to ignore attributes in json schema, plus ignore DV_QUANTITY.property

* Fix hashes in json schema - map to additionalProperties

* Fix DV_URI/DV_EHR_URI value not being required

* Correctly replace Uri in BMM with a string with uri-reference format in Json Schema

* Fix test - this BMM update actually removes some known differences between Archie and the BMM

* Update to most recent BMMs

* Split Json Schema creator in a generic one and a openEHR-specific one, ignore extra classes

* Mark RESOURCE_DESCRIPTION.original_publisher as not mandatory
  • Loading branch information
pieterbos authored Jan 31, 2023
1 parent a55864a commit 25a2c9d
Show file tree
Hide file tree
Showing 35 changed files with 8,666 additions and 250 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class ResourceDescription extends ArchetypeModelObject {
private Map<String, String> originalAuthor = new ConcurrentHashMap<>();
@Nullable
private String originalNamespace;
@Nullable
private String originalPublisher;
@Nullable
private List<String> otherContributors = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public BmmSimpleType createBmmType(BmmClassProcessor classProcessor, BmmClass cl
} else if (simpleClassDef instanceof BmmSimpleClass) {
return new BmmSimpleType((BmmSimpleClass) simpleClassDef);
} else {
throw new RuntimeException("BmmClass " + type + " should be a simple type, but was " + simpleClassDef.getClass().getSimpleName());
throw new RuntimeException("BmmClass " + type + ", referenced from classDefinition " + (classDefinition == null ? "null" : classDefinition.getName()) + " should be a simple type, but was " + simpleClassDef.getClass().getSimpleName());
}
}

Expand Down
16 changes: 8 additions & 8 deletions json-schema/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.nedap.healthcare.archie:archie-all:2.0.0'
classpath 'com.nedap.healthcare.archie:archie-all:2.0.5'
}
}

Expand All @@ -13,7 +13,7 @@ plugins {

description = "A tool that generates the official ITS-JSON json schema from the BMM files"

import com.nedap.archie.json.JSONSchemaCreator;
import com.nedap.archie.json.OpenEHRRmJSONSchemaCreator;
import com.nedap.archie.json.JsonSchemaUriProvider;
import com.nedap.archie.json.JsonSchemaUri;
import com.nedap.archie.json.ItsJsonUriProvider;
Expand All @@ -36,34 +36,34 @@ abstract class JsonSchemaCreationTask extends DefaultTask {
def rm104 = BuiltinReferenceModels.getBmmRepository().getModel("openehr_rm_1.0.4").getModel();
def rm103 = BuiltinReferenceModels.getBmmRepository().getModel("openehr_rm_1.0.3").getModel();

def schemas110Multi = new JSONSchemaCreator()
def schemas110Multi = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(true)
.withJsonSchemaUriProvider(new ItsJsonUriProvider("https://specifications.openehr.org/releases/ITS-JSON/latest/components/", "RM/Release-1.1.0/main.json"))
.withFullReferences(true)
.create(rm110);
def schemas104Multi = new JSONSchemaCreator()
def schemas104Multi = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(true)
.withJsonSchemaUriProvider(new ItsJsonUriProvider("https://specifications.openehr.org/releases/ITS-JSON/latest/components/", "RM/Release-1.0.4/main.json"))
.withFullReferences(true)
.create(rm104);
def schemas103Multi = new JSONSchemaCreator()
def schemas103Multi = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(true)
.withJsonSchemaUriProvider(new ItsJsonUriProvider("https://specifications.openehr.org/releases/ITS-JSON/latest/components/", "RM/Release-1.0.3/main.json"))
.withFullReferences(true)
.create(rm103);

def schemas110 = new JSONSchemaCreator()
def schemas110 = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(false)
.create(rm110);
def schemas104 = new JSONSchemaCreator()
def schemas104 = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(false)
.create(rm104);
def schemas103 = new JSONSchemaCreator()
def schemas103 = new OpenEHRRmJSONSchemaCreator()
.withBaseUri("https://specifications.openehr.org/releases/ITS-JSON/latest/components/")
.splitInMultipleFiles(false)
.create(rm103);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ public class Activity extends Locatable {
public Activity() {
}

public Activity(String archetypeNodeId, DvText name, ItemStructure description, @Nullable DvParsable timing, @Nullable String actionArchetypeId) {
public Activity(String archetypeNodeId, DvText name, ItemStructure description, @Nullable DvParsable timing, String actionArchetypeId) {
super(archetypeNodeId, name);
this.description = description;
this.timing = timing;
this.actionArchetypeId = actionArchetypeId;
}

public Activity(@Nullable UIDBasedId uid, String archetypeNodeId, DvText name, @Nullable Archetyped archetypeDetails, @Nullable FeederAudit feederAudit, @Nullable List<Link> links, @Nullable Pathable parent, @Nullable String parentAttributeName, ItemStructure description, @Nullable DvParsable timing, @Nullable String actionArchetypeId) {
public Activity(@Nullable UIDBasedId uid, String archetypeNodeId, DvText name, @Nullable Archetyped archetypeDetails, @Nullable FeederAudit feederAudit, @Nullable List<Link> links, @Nullable Pathable parent, @Nullable String parentAttributeName, ItemStructure description, @Nullable DvParsable timing, String actionArchetypeId) {
super(uid, archetypeNodeId, name, archetypeDetails, feederAudit, links, parent, parentAttributeName);
this.description = description;
this.timing = timing;
Expand All @@ -75,13 +75,12 @@ public DvParsable getTiming() {
public void setTiming(DvParsable timing) {
this.timing = timing;
}

@Nullable

public String getActionArchetypeId() {
return actionArchetypeId;
}

public void setActionArchetypeId(@Nullable String actionArchetypeId) {
public void setActionArchetypeId( String actionArchetypeId) {
this.actionArchetypeId = actionArchetypeId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ protected void addTypes(Class<?> baseClass) {
addClass(TerminologyId.class);
addClass(Link.class);
addClass(Archetyped.class);
addClass(ArchetypeHRID.class);
addClass(AuthoredResource.class);
addClass(TranslationDetails.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public static BmmRepository getBmmRepository() {
"bmm/openEHR/original/Release-1.0.2/openehr_ehr_102.bmm",
"bmm/openEHR/components/LANG/Release-1.0.0/openehr_lang_100.bmm",
"bmm/openEHR/components/RM/Release-1.0.4/openehr_rm_ehr_104.bmm",
"bmm/openEHR/components/PROC/Release-1.5.0/openehr_proc_task_planning_150.bmm",
"bmm/openEHR/components/PROC/Release-1.6.0/openehr_proc_task_planning_160.bmm",
"bmm/openEHR/components/PROC/latest/openehr_proc_task_planning_110.bmm",
"bmm/openEHR/original/Release-1.0.2/openehr_rm_102.bmm",
"bmm/openEHR/components/RM/Release-1.0.4/openehr_rm_structures_104.bmm",
Expand Down
Loading

0 comments on commit 25a2c9d

Please sign in to comment.