Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
jakesmolka committed May 14, 2020
2 parents 4a174c1 + 54178e7 commit e262553
Show file tree
Hide file tree
Showing 193 changed files with 5,334 additions and 2,272 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,6 @@ std*

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
Expand Down
23 changes: 21 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added


### Changed

### Fixed

## [0.13.0] (beta)

### Added
- added support for various functions in AQL (aggregation, statistical, string etc.) (see: https://github.com/ehrbase/ehrbase/pull/223/)

### Changed
- Update of AQL-Query test suite (see: https://github.com/ehrbase/ehrbase/pull/179)

### Fixed
- Added validation checking for other_details and ehr_status. (see: https://github.com/ehrbase/ehrbase/pull/207)
- Supports archetype_node_id and name for EHR_STATUS (see: https://github.com/ehrbase/ehrbase/pull/207)
- fixes bad canonical encoding for observation/data/origin (see: https://github.com/ehrbase/ehrbase/pull/213)
- POST without accept header for ehr, composition and contribution endpoints (see: https://github.com/ehrbase/ehrbase/pull/199)
- force a default timezone if not present for context/start_time and context/end_time if specified (https://github.com/ehrbase/ehrbase/pull/215)
- Representation of version uid of EHR_STATUS (see: https://github.com/ehrbase/ehrbase/pull/180)


## [0.12.0] (alpha)
Expand All @@ -25,8 +39,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Contribution endpoint checks for some invalid input combinations (see: https://github.com/ehrbase/ehrbase/pull/202)
- Fixes response code on /ehr PUT with invalid ID (see: https://github.com/ehrbase/project_management/issues/163)
- Fixes STATUS w/ empty subject bug (see: https://github.com/ehrbase/ehrbase/pull/196)
- Now querying on composition category returns the correct result (composition/category...)
- Fixes storage of party self inside compositions (see: https://github.com/ehrbase/ehrbase/pull/195)
- Added support of AQL query in the form of c/composer (see: https://github.com/ehrbase/ehrbase/pull/184)
- Java error with UTF-8 encoding resolved (see: https://github.com/ehrbase/ehrbase/pull/173)
Expand Down Expand Up @@ -74,6 +90,7 @@ Starting with the next release this file will provide a proper overview.
- Correct resolution of ehr/system_id in AQL (see: https://github.com/ehrbase/ehrbase/pull/102)
- Detection of duplicate aliases in aql select (see: https://github.com/ehrbase/ehrbase/pull/98)


## [0.10.0] (alpha)

### Added
Expand Down Expand Up @@ -114,7 +131,9 @@ Starting with the next release this file will provide a proper overview.
- Fixed error regarding DISTINCT operator in AQL (https://github.com/ehrbase/ehrbase/issues/50)
- Fixed null pointer exceptions that could occur in persistent compositions

[unreleased]: https://github.com/ehrbase/ehrbase/compare/v0.10.0...HEAD
[unreleased]: https://github.com/ehrbase/ehrbase/compare/v0.13.0...HEAD
[0.13.0]: https://github.com/ehrbase/ehrbase/compare/v0.12.0...v0.13.0
[0.12.0]: https://github.com/ehrbase/ehrbase/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/ehrbase/ehrbase/compare/v0.10.0...v0.11.0
[0.10.0]: https://github.com/ehrbase/ehrbase/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/ehrbase/ehrbase/releases/tag/v0.9.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
EHRbase is an [openEHR](openehr.org) Clinical Data Repository, providing a standard-based backend for interoperable clinical applications. It implements the latest version of the openEHR Reference Model (RM 1.0.4) and version 1.4 of the Archetype Definition Language (ADL). Applications can use the capabilities of EHRbase through the latest version of the [openEHR REST API](https://specifications.openehr.org/releases/ITS-REST/latest/) and model-based queries using the [Archetype Query Language](https://specifications.openehr.org/releases/QUERY/latest/AQL.html).

## Release Notes
##### 2020, March 31
This release of EHRbase (v0.12.0) adds basic authentication (see details below) and allows to overwrite templates. Besides, there are lots of bug fixes. Please see [EHRbase Documentation](https://ehrbase.readthedocs.io/en/latest/01_release_notes/0120.html) for further details.
##### 2020, May 14
This release of EHRbase (v0.13.0) is the first **beta** release. Please see [EHRbase Documentation](https://ehrbase.readthedocs.io/en/latest/) for further details.


## Getting Started
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
26 changes: 20 additions & 6 deletions api/src/main/java/org/ehrbase/api/dto/QueryResultDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,14 @@

package org.ehrbase.api.dto;

import com.google.common.collect.BiMap;
import org.apache.commons.collections.BidiMap;

import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class QueryResultDto {
private String executedAQL;
private List<List<String>> explain;
private BiMap<String, String> variables;
private Map<String, String> variables;
private List<Map<String, Object>> resultSet;

public List<Map<String, Object>> getResultSet() {
Expand All @@ -54,11 +52,27 @@ public void setExplain(List<List<String>> explain) {
this.explain = explain;
}

public BiMap<String, String> getVariables() {
public Map<String, String> getVariables() {
return variables;
}

public void setVariables(BiMap<String, String> variables) {
public void setVariables(Map<String, String> variables) {
this.variables = variables;
}

public boolean variablesIsEmpty() {
return variables.size() == 0;
}

public boolean variablesContainsColumnId(String columnId){
return getVariables().containsKey(columnId);
}

public String variablesPath(String columnId){
return getVariables().get(columnId);
}

public Iterator<Map.Entry<String, String>> variablesIterator(){
return variables.entrySet().iterator();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.ehrbase.api.service;

import com.nedap.archie.rm.composition.Composition;
import com.nedap.archie.rm.ehr.EhrStatus;

import java.util.UUID;

Expand Down Expand Up @@ -56,6 +57,14 @@ public interface ValidationService {
*/
void check(Composition composition) throws Exception;

/**
* initially check if ehrstatus is valid for further processing
* @param ehrStatus
* @throws IllegalArgumentException
*/
void check(EhrStatus ehrStatus);


/**
* Remove all mappings in the cache
*/
Expand Down
2 changes: 1 addition & 1 deletion application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- Add support for attribute name and archetype_node_id in ehr_status

-- modify table ehr.status to add the missing attributes

ALTER TABLE ehr.status
ADD COLUMN archetype_node_id TEXT NOT NULL DEFAULT 'openEHR-EHR-EHR_STATUS.generic.v1',
ADD COLUMN name ehr.dv_coded_text NOT NULL DEFAULT ('EHR Status',NULL,NULL,NULL,NULL)::ehr.dv_coded_text ;

-- modify function to return ehr_status canonical json to support the new attributes
CREATE OR REPLACE FUNCTION ehr.js_ehr_status(UUID)
RETURNS JSON AS
$$
DECLARE
ehr_uuid ALIAS FOR $1;
BEGIN
RETURN (
WITH ehr_status_data AS (
SELECT
status.other_details as other_details,
status.party as subject,
status.is_queryable as is_queryable,
status.is_modifiable as is_modifiable,
status.sys_transaction as time_created,
status.name as status_name,
status.archetype_node_id as archetype_node_id
FROM ehr.status
WHERE status.ehr_id = ehr_uuid
LIMIT 1
)
SELECT
jsonb_strip_nulls(
jsonb_build_object(
'_type', 'EHR_STATUS',
'archetype_node_id', archetype_node_id,
'name', status_name,
'subject', ehr.js_party(subject),
'is_queryable', is_queryable,
'is_modifiable', is_modifiable,
'other_details', other_details
)
)
FROM ehr_status_data
);
END
$$
LANGUAGE plpgsql;
20 changes: 20 additions & 0 deletions base/src/main/resources/db/migration/V22__js_concept.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
-- concept as json
CREATE OR REPLACE FUNCTION ehr.js_concept(UUID)
RETURNS JSON AS
$$
DECLARE
concept_id ALIAS FOR $1;
BEGIN

IF (concept_id IS NULL) THEN
RETURN NULL;
END IF;

RETURN (
SELECT ehr.js_dv_coded_text(description, ehr.js_code_phrase(conceptid :: TEXT, 'openehr'))
FROM ehr.concept
WHERE id = concept_id AND language = 'en'
);
END
$$
LANGUAGE plpgsql;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE ehr.status_history
ADD COLUMN archetype_node_id TEXT NOT NULL DEFAULT 'openEHR-EHR-EHR_STATUS.generic.v1',
ADD COLUMN name ehr.dv_coded_text NOT NULL DEFAULT ('EHR Status',NULL,NULL,NULL,NULL)::ehr.dv_coded_text;
53 changes: 53 additions & 0 deletions base/src/main/resources/db/migration/V24__typed_element_value.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
-- convert to lower snake case
CREATE OR REPLACE FUNCTION ehr.camel_to_snake(literal TEXT)
RETURNS TEXT AS
$$
DECLARE
out_literal TEXT := '';
literal_size INT;
char_at TEXT;
ndx INT;
BEGIN
literal_size := length(literal);
if (literal_size = 0) then
return literal;
end if;
ndx = 1;
while ndx <= literal_size loop
char_at := substr(literal, ndx , 1);
if (char_at ~ '[A-Z]') then
if (ndx > 1 AND substr(literal, ndx - 1, 1) <> '<') then
out_literal = out_literal || '_';
end if;
out_literal = out_literal || lower(char_at);
else
out_literal = out_literal || char_at;
end if;
ndx := ndx + 1;
end loop;
out_literal := replace(replace(replace(out_literal, 'u_r_i', 'uri'), 'i_d', 'id'), 'i_s_m', 'ism');
return out_literal;
END
$$
LANGUAGE plpgsql;

-- add the _type into an element value block
CREATE OR REPLACE FUNCTION ehr.js_typed_element_value(JSONB)
RETURNS JSONB AS
$$
DECLARE
element_value ALIAS FOR $1;
BEGIN
RETURN (
SELECT
jsonb_strip_nulls(
(element_value #>>'{/value}')::jsonb ||
jsonb_build_object(
'_type',
upper(ehr.camel_to_snake(element_value #>>'{/$CLASS$}'))
)
)
);
END
$$
LANGUAGE plpgsql;
2 changes: 1 addition & 1 deletion jooq-pq/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion opt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<packaging>pom</packaging>
<groupId>org.ehrbase.openehr</groupId>
<artifactId>server</artifactId>
<version>0.12.0</version>
<version>0.13.0</version>

<name>${project.groupId}:${project.artifactId}</name>
<description>EHRbase is a Free, Libre, Open Source openEHR Clinical Data Repository</description>
Expand Down
2 changes: 1 addition & 1 deletion rest-ehr-scape/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
2 changes: 1 addition & 1 deletion rest-openehr/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>server</artifactId>
<groupId>org.ehrbase.openehr</groupId>
<version>0.12.0</version>
<version>0.13.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Loading

0 comments on commit e262553

Please sign in to comment.