Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ehrbase/project management/issues/424 new dto flattener aproch #153

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
224db70
new unflattener
stefanspiska Nov 11, 2020
3645cd5
handle old paths without name/value
stefanspiska Nov 11, 2020
757a8e0
new Flattener
stefanspiska Nov 13, 2020
35de47b
Allow flatten from non composition
stefanspiska Nov 13, 2020
147ed6d
Merge branch 'develop' into feature/ehrbase/project_management/issues…
stefanspiska Nov 13, 2020
8c37368
Merge branch 'develop' into feature/ehrbase/project_management/issues…
stefanspiska Nov 16, 2020
fa1df99
add RoundTripTest
stefanspiska Nov 16, 2020
2b739b2
fix test
stefanspiska Nov 16, 2020
f35e206
fix test
stefanspiska Nov 17, 2020
3c03029
new class generator
stefanspiska Nov 19, 2020
6b93330
fix test
stefanspiska Nov 19, 2020
0b1eefe
handle choices in new dot generator
stefanspiska Nov 20, 2020
fed0e59
handle choices duplicates in new dto generator
stefanspiska Nov 24, 2020
2b637a8
fix test
stefanspiska Nov 24, 2020
29a2e13
extract naming strategy
stefanspiska Nov 25, 2020
77bf627
handle non unique names better
stefanspiska Dec 1, 2020
fed0fd2
added more Test
stefanspiska Dec 1, 2020
8821524
force generation of test-data and expected result set + cache
wlad Dec 1, 2020
585f18e
added old dto test
stefanspiska Dec 1, 2020
210a671
switch to new class generator
stefanspiska Dec 1, 2020
3fad0b5
fix filenames
stefanspiska Dec 2, 2020
63e2418
fix filenames
stefanspiska Dec 2, 2020
e23985f
fix filenames
stefanspiska Dec 2, 2020
9e24deb
read examples
stefanspiska Dec 2, 2020
1f855ca
fix handling of interval
stefanspiska Dec 2, 2020
749718c
fix generation of DVCodedText
stefanspiska Dec 2, 2020
4166aee
fix generation of DVCodedText
stefanspiska Dec 2, 2020
8df5a7a
fix handling of ism_transaction
stefanspiska Dec 2, 2020
6eea762
fix handling of ism_transaction
stefanspiska Dec 2, 2020
def6eeb
fix handling of ism_transaction
stefanspiska Dec 2, 2020
5ad62b5
fix list order
stefanspiska Dec 3, 2020
f614966
some code cleanup
stefanspiska Dec 3, 2020
8488279
Merge branch 'develop' into feature/ehrbase/project_management/issues…
stefanspiska Dec 4, 2020
269e9c5
do not regenerate test data
stefanspiska Dec 4, 2020
7c409b0
add name path as javadoc to generated classes.
stefanspiska Dec 4, 2020
59c30fe
new OptimizerSetting for generator
stefanspiska Dec 4, 2020
773c7ec
Merge branch 'develop' into feature/ehrbase/project_management/issues…
stefanspiska Dec 4, 2020
2b3a278
add feederAudit to each entity
stefanspiska Dec 4, 2020
83d37ba
generate interfaces for dtos
stefanspiska Dec 8, 2020
9cf111f
add shared fields to choices
stefanspiska Dec 8, 2020
747c139
add generated Annotation to dtos
stefanspiska Dec 9, 2020
9d971c4
updated dependences
stefanspiska Dec 9, 2020
d9d5f71
updated dependences
stefanspiska Dec 9, 2020
f385164
updated dependences
stefanspiska Dec 9, 2020
6c41c9a
support null flavor
stefanspiska Dec 9, 2020
ba98a4e
support null flavor
stefanspiska Dec 9, 2020
ef4a84b
support null flavor (fix test)
stefanspiska Dec 9, 2020
44feaed
added option to replace language specific chars.
stefanspiska Dec 10, 2020
87dcc1a
add comment and description to generated javadoc.
stefanspiska Dec 10, 2020
3b618d4
removed old introspect
stefanspiska Dec 10, 2020
7f11da6
parse generator config via yaml
stefanspiska Dec 11, 2020
6b77729
some code cleanup
stefanspiska Dec 11, 2020
76fc7fe
update documentation
stefanspiska Dec 11, 2020
54132c6
fix sonar issues
stefanspiska Dec 14, 2020
1bbadd3
some more code cleanup
stefanspiska Dec 14, 2020
9272e32
fix test
stefanspiska Dec 14, 2020
16078b3
fix more sonar issues
stefanspiska Dec 14, 2020
7af3c8e
remove unnecessary log.
stefanspiska Dec 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
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