Skip to content

Commit

Permalink
Merge pull request #153 from ehrbase/feature/ehrbase/project_manageme…
Browse files Browse the repository at this point in the history
…nt/issues/424_new_dto_flattener_aproch

Feature/ehrbase/project management/issues/424 new dto flattener aproch
  • Loading branch information
stefanspiska authored Dec 17, 2020
2 parents f68f524 + 7af3c8e commit 6c12c2b
Show file tree
Hide file tree
Showing 899 changed files with 56,145 additions and 22,311 deletions.
52 changes: 46 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,50 @@
# EHRBase SDK
# EHRBase SDK

## client (mostly Beta)

Generic openEHR Client and Objekt-mapper:

* Define entity classes for openEHR-Templates (v1.4) in a jpa like way
* Map entity <-> Archie RM objekts.
* RestClient for openEHR Rest-API
* RestClient for openEHR Rest-API
* AQL-Query generator (Alpha)

## generator (Beta)
* Autogenerate entity classes from template

* Autogenerate entity classes from template

## opt-1.4 (Beta)

* Opt 1.4 xmlbeans

## response-dto (Beta)

* DTO's representing the response for the ehrsacpe and openEHR Rest API

## terminologie (Beta)

* Mini openEHR terminologie implementation

## validation (Beta)

* Validation of Compositions against templates

## test-data (Beta)

* Example templates and Composition for tests

## serialisation (Beta)

* map Compositions from and to JSON;XML

## Release Notes (v0.3.6)

* CircleCI pipeline w/ Jacoco code coverage and sonarcloud.io analysis
* semi automated version updating via [major] / [minor] / [patch] flags in merge commit title of Github PR
* updated test dependencies to use Junit5

## Release Notes (v0.3.0)

* RestClient for DIRECTORY endpoint
* Improved clean-up of empty elements
* Improved generation of EVENT classes
Expand All @@ -36,36 +55,57 @@ Generic openEHR Client and Objekt-mapper:
## Installation

### Build

```bash
mvn clean install
```

## Usage
### Entity generation

### Entity generation

To generate an entity class from a template use

```bash
java -jar generator-version.jar
-h show help
-opt <arg> path to opt file
-out <arg> path to output directory
-package <arg> package name
-config <arg> optional Path to config file
```

In the optional config file you can define

Parameter | Default | Description
----------- | --------- | -------------
optimizerSetting | SECTION | Defines if nodes which belong to are archetype but are single valued generate a new class: <ul><li>NONE: Always generate a class for nodes which belong to a archetype</li><li>SECTION: Do not generate a class for nodes which have rm-type section and are single valued</li><li>ALL: Do not generate a class for nodes which are single valued</li></ul>
addNullFlavor | true | Whether or not to generate null flavor fields for Elements.
replaceChars | German and Norwegian Characters | Map to define Characters in the Node name to be replaced.

see generator/src/main/resources/DefaultConfig.yaml

### Use The SDK in your projekt

You can include the SDK via [jitpack.io](https://jitpack.io/#ehrbase/openEHR_SDK)
#### Map entity <-> Archie RM objekts

#### Map entity <-> Archie RM objekts

see FlattenerTest and UnflattenerTest

#### RestClient for openEHR Rest-API
#### RestClient for openEHR Rest-API

- ehr : see DefaultRestEhrEndpointIT
- composition: see DefaultRestCompositionEndpointIT
- template : see DefaultRestTemplateEndpointIT
- directory : see DefaultRestDirectoryEndpointIT

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[APACHE 2.0](https://www.apache.org/licenses/LICENSE-2.0)
23 changes: 23 additions & 0 deletions UPDATING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Updating the SDK

This file documents any backwards-incompatible changes in SDK and
assists users migrating to a new version.

## SDK 1.0.0
### Using the sdk with old generated classes
Classes generated with the old SDK can be used with the new version
### Migrating from old generated classes to new ones
It is recommended to update the generated classes. To do this:
* Update the sdk version
* Rename any Name with *defningcode to *defningCode
* replace the EnumValueSet in your local shareddefinition folder with the new from the sdk:
* Language -> org.ehrbase.client.classgenerator.shareddefinition.Language
* CategoryDefiningcode -> org.ehrbase.client.classgenerator.shareddefinition.Category
* MathFunctionDefiningcode -> org.ehrbase.client.classgenerator.shareddefinition.MathFunction
* SettingDefiningcode -> org.ehrbase.client.classgenerator.shareddefinition.Setting
* Territory -> org.ehrbase.client.classgenerator.shareddefinition.Territory
* TransitionDefiningcode -> org.ehrbase.client.classgenerator.shareddefinition.Transition

* Generate your classes new with the generator using generator/src/main/resources/LegacyConfig.yaml as config
* Delete you old classes and replaces them with the new one
* There may be some more changes regrading the naming or the class structure which you have to change in your code.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ private void addNodeId(CCOMPLEXOBJECT ccobj, Map<String, String> termDef, Map<St
} else {
log.debug("set archetype_node_id={}", nodeId);
valueMap.put("archetype_node_id", nodeId);
String termName = termDef.get(nodeId);
Optional<String> name = OptNameHelper.extractName(ccobj);
String termName = name.orElse(termDef.get(nodeId));
if (termName != null) {
txtName = new DvText(termName);
valueMap.put("name", txtName);
Expand Down
8 changes: 4 additions & 4 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@


<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joor</artifactId>
</dependency>
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>com.github.ehrbase.openEHR_SDK</groupId>
<artifactId>opt-1.4</artifactId>
Expand Down
23 changes: 22 additions & 1 deletion client/src/main/java/org/ehrbase/client/aql/query/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,28 @@
import org.ehrbase.client.aql.containment.ContainmentExpression;
import org.ehrbase.client.aql.field.AqlField;
import org.ehrbase.client.aql.field.SelectAqlField;
import org.ehrbase.client.aql.record.*;
import org.ehrbase.client.aql.record.Record;
import org.ehrbase.client.aql.record.Record1;
import org.ehrbase.client.aql.record.Record10;
import org.ehrbase.client.aql.record.Record11;
import org.ehrbase.client.aql.record.Record12;
import org.ehrbase.client.aql.record.Record13;
import org.ehrbase.client.aql.record.Record14;
import org.ehrbase.client.aql.record.Record15;
import org.ehrbase.client.aql.record.Record16;
import org.ehrbase.client.aql.record.Record17;
import org.ehrbase.client.aql.record.Record18;
import org.ehrbase.client.aql.record.Record19;
import org.ehrbase.client.aql.record.Record2;
import org.ehrbase.client.aql.record.Record20;
import org.ehrbase.client.aql.record.Record21;
import org.ehrbase.client.aql.record.Record3;
import org.ehrbase.client.aql.record.Record4;
import org.ehrbase.client.aql.record.Record5;
import org.ehrbase.client.aql.record.Record6;
import org.ehrbase.client.aql.record.Record7;
import org.ehrbase.client.aql.record.Record8;
import org.ehrbase.client.aql.record.Record9;

import java.util.Arrays;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
*
* * Copyright (c) 2020 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School
* * This file is part of Project EHRbase
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package org.ehrbase.client.classgenerator.interfaces;

import com.nedap.archie.rm.generic.Participation;
import com.nedap.archie.rm.generic.PartyIdentified;
import com.nedap.archie.rm.generic.PartyProxy;
import org.ehrbase.client.classgenerator.shareddefinition.Category;
import org.ehrbase.client.classgenerator.shareddefinition.Language;
import org.ehrbase.client.classgenerator.shareddefinition.Setting;
import org.ehrbase.client.classgenerator.shareddefinition.Territory;
import org.ehrbase.client.openehrclient.VersionUid;

import java.time.temporal.TemporalAccessor;
import java.util.List;

public interface CompositionEntity extends LocatableEntity {

void setParticipations(List<Participation> participations);

List<Participation> getParticipations();

void setHealthCareFacility(PartyIdentified healthCareFacility);

PartyIdentified getHealthCareFacility();

void setComposer(PartyProxy composer);

PartyProxy getComposer();

void setLanguage(Language language);

Language getLanguage();

void setCategoryDefiningCode(Category categoryDefiningCode);

Category getCategoryDefiningCode();

void setTerritory(Territory territory);

Territory getTerritory();

VersionUid getVersionUid();

void setVersionUid(VersionUid versionUid);

void setStartTimeValue(TemporalAccessor startTimeValue);

TemporalAccessor getStartTimeValue();

void setEndTimeValue(TemporalAccessor endTimeValue);

TemporalAccessor getEndTimeValue();

void setLocation(String location);

String getLocation();

void setSettingDefiningCode(Setting settingDefiningCode);

Setting getSettingDefiningCode();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* * Copyright (c) 2020 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School
* * This file is part of Project EHRbase
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package org.ehrbase.client.classgenerator.interfaces;

import com.nedap.archie.rm.generic.PartyProxy;
import org.ehrbase.client.classgenerator.interfaces.LocatableEntity;
import org.ehrbase.client.classgenerator.shareddefinition.Language;

public interface EntryEntity extends LocatableEntity {
void setSubject(PartyProxy subject);

PartyProxy getSubject();

void setLanguage(Language language);

Language getLanguage();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
*
* * Copyright (c) 2020 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School
* * This file is part of Project EHRbase
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package org.ehrbase.client.classgenerator.interfaces;

import java.time.temporal.TemporalAccessor;

public interface EventEntity {
void setTimeValue(TemporalAccessor timeValue);

TemporalAccessor getTimeValue();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
*
* * Copyright (c) 2020 Stefan Spiska (Vitasystems GmbH) and Hannover Medical School
* * This file is part of Project EHRbase
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/

package org.ehrbase.client.classgenerator.interfaces;

import org.ehrbase.client.classgenerator.shareddefinition.MathFunction;

import java.time.temporal.TemporalAccessor;
import java.time.temporal.TemporalAmount;

public interface IntervalEventEntity extends LocatableEntity, EventEntity {

void setWidthValue(TemporalAmount widthValue);

TemporalAmount getWidthValue();

void setMathFunctionDefiningCode(MathFunction mathFunctionDefiningCode);

MathFunction getMathFunctionDefiningCode();

void setSampleCount(Long sampleCount);

Long getSampleCount();
}
Loading

0 comments on commit 6c12c2b

Please sign in to comment.