Test Suite: EHR_SERVICE

Normative Reference

Items in this validation suite conceptually use the following abstract interfaces from the Abstract Platform Service Model, EHR component.

  • I_EHR_SERVICE

  • I_EHR

  • I_EHR_STATUS

These are concretely realised in implementation technology specfic APIs, such as the EHR REST API.

This test suite uses artefacts defined by the following information model specifications:

Test Environment

The server under test should support:

  1. at least the OPT 1.4 format, and optionally OPT 2.

  2. at least the XML representation of COMPOSITIONs for committing data, which may be validated by the openEHR XSDs.

Test Data Sets

These are the data set classes:

  1. VALID:

    1. not providing an EHR_STATUS (empty input, the server creates the default structures and data)

    2. providing a valid EHR_STATUS

  2. INVALID:

    1. providing invalid EHR_STATUS

Valid data sets when the EHR_STATUS is provided and internal strucrures are valid (data set class 1.a):

No. is_queryable is_modifiable subject other_details ehr_id

1

true

true

provided

not provided

not provided

2

true

false

provided

not provided

not provided

3

false

true

provided

not provided

not provided

4

false

false

provided

not provided

not provided

5

true

true

provided

provided

not provided

6

true

false

provided

provided

not provided

7

false

true

provided

provided

not provided

8

false

false

provided

provided

not provided

9

true

true

provided

not provided

provided

10

true

false

provided

not provided

provided

11

false

true

provided

not provided

provided

12

false

false

provided

not provided

provided

13

true

true

provided

provided

provided

14

true

false

provided

provided

provided

15

false

true

provided

provided

provided

16

false

false

provided

provided

provided

Any other data set is invalid, for instance providing EHR_STATUS with:

  1. missing is_queryable, is_modifiable

  2. empty is_queryable, `_is_modifiable

  3. missing or empty subject_id

  4. invalid subject_id

  5. invalid other_details

Notes:

  1. When the ehr_id is not present, it is expected that it is assigned by the server.

  2. The server should set the EHR.system_id value to a known value (defined by the server’s configuration).

  3. The default values that should be assigned by the server for is_modifiable and is_queryable are 'true', and for the subject it defaults to an instance of PARTY_SELF.

  4. There are no cases to check if the provided ehr_id is valid, since in the openEHR Platform Service Model the parameters are typed to UUID, any other format will be an invalid call.

  5. The validity of an EHR_STATUS can be checked in its JSON form by validating against the JSON schemas.

Test Cases

Service Model operation: I_EHR_SERVICE.has_ehr()

Service Model reference: I_EHR_SERVICE.has_ehr()

Test Case I_EHR_SERVICE.has_ehr-existing_ehr_id

Description

Check has EHR with existing EHR

Pre-conditions

An EHR should exist in the system with a known ehr_id

Post-conditions

None

Flow

  1. Invoke has EHR service with the known ehr_id

  2. The result should be positive, e.g. "the EHR with <ehr_id> exists"

Test runners

Test Case I_EHR_SERVICE.has_ehr-existing_subject_id

Description

Check has EHR with existing EHR by subject_id

Pre-conditions

An EHR should exist in the system with a known subject_id.

Post-conditions

None

Flow

  1. Invoke has EHR service with the known subject_id

  2. The result should be positive, e.g. "the EHR with <subject_id> exists"

Test runners

subject_id refers to the PARTY_REF class instance containing the identifier of a patient represented by PARTY_SELF in the openEHR Reference Model.

Test Case I_EHR_SERVICE.has_ehr-non_existing_ehr_id

Description

Check has EHR with non existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke has EHR service with a random ehr_id.

  2. The result should be negative, e.g. "the EHR with <ehr_id> does not exist"

Test runners

Test Case I_EHR_SERVICE.has_ehr-non_existing_subject_id

Description

Check has EHR with non existing EHR by subject_id

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke has EHR service with a random subject_id

  2. The result should be negative, e.g. "the EHR for <subject_id> does not exist"

Test runners

Service Model operation: I_EHR_SERVICE.create_ehr()

Service Model reference: I_EHR_SERVICE.create_ehr()

Test Case I_EHR_SERVICE.create_ehr-main

Description

Create new EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

A new EHR will exist in the system and be consistent with the data sets used.

Flow

  1. Invoke the create EHR service

    1. for each item in the VALID data set classes

    2. when the ehr_id is provided, should be unique for each invocation of the service

  2. The server should answer with a positive response associated to the successful EHR creation

Test runners

Test Case I_EHR_SERVICE.create_ehr-same_ehr_twice

Description

Attempt to create same EHR twice

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

A new EHR will exist in the system, the first one created, and be consistent with the data sets used.

Flow

  1. Invoke the create EHR service

    1. for each VALID data set not providing ehr_id

    2. for each VALID data set providing ehr_id

  2. The server should answer with a positive response associated to the successful EHR creation

  3. Invoke the create EHR service

    1. with the same ehr_id of the EHR created in 1.1. (should be read from the response)

    2. with the same ehr_id of the EHR created in 1.2. (should be read from the test data sets)

  4. The server should answer with a negative response, related to the existence of an EHR with the provided ehr_id, because ehr_id values should be unique

Test runners

Test Case I_EHR_SERVICE.create_ehr-two_ehrs_same_patient

Description

Create two EHRs for the same patient

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

A new EHR will exist in the system.

Flow

  1. Invoke the create EHR service

    1. for each VALID data set with a provided subject and not providing ehr_id

  2. The server should answer with a positive response associated to the successful EHR creation

  3. Invoke the create EHR service

    1. with the same data set used in 1.1

  4. The server should answer with a negative response, related with the EHR already existing for the provided subject

Test runners

Service Model operation: I_EHR_SERVICE.get_ehr()

Service Model reference: I_EHR_SERVICE.get_ehr()

Test Case I_EHR_SERVICE.get_ehr-existing_ehr_by_ehr_id

Description

Get existing EHR

Pre-conditions

An EHR should exist in the system with a known ehr_id.

Post-conditions

None.

Flow

  1. Invoke get EHR service with the known ehr_id

  2. The result should be positive and retrieve the EHR

Test runners

Test Case I_EHR_SERVICE.get_ehr-existing_ehr_by_subject_id

Description

Get existing EHR by subject_id

Pre-conditions

An EHR should exist in the system with a known subject_id.

Post-conditions

None.

Flow

  1. Invoke get EHR service with the known subject_id

  2. The result should be positive and retrieve the EHR

Test runners

Test Case I_EHR_SERVICE.get_ehr-get_ehr_by_invalid_ehr_id

Description

Get non existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None.

Flow

  1. Invoke get EHR service by a random ehr_id

  2. The result should be negative, e.g. "EHR with <ehr_id> does not exist"

Test runners

Test Case I_EHR_SERVICE.get_ehr-get_ehr_by_invalid_subject_id

Description

Get non existing EHR by subject_id

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None.

Flow

  1. Invoke get EHR service by a random subject_id

  2. The result should be negative, e.g. "EHR for <subject_id> does not exist"

Test runners

EHR_STATUS Test Cases

Service Model operation: I_EHR_STATUS.get_ehr_status()

Service Model reference: I_EHR_STATUS.get_ehr_status()

Test Case I_EHR_STATUS.get_ehr_status-get_by_ehr_id

Description

Get status of an existing EHR

Pre-conditions

An EHR with known ehr_id should exist.

Post-conditions

None.

Flow

  1. Invoke the get EHR_STATUS service by the existing ehr_id

  2. The result should be positive and retrieve a correspondent EHR_STATUS.

    1. The EHR_STATUS internal information should match the rules in which the EHR was created (see test flow Create EHR)

    2. Those rules should be verified: a. has or not a subject_id, b. has correct value for is_modifiable, c. has correct value for is_queryable.

Test runners

Test Case I_EHR_STATUS.get_ehr_status-bad_ehr

Description

Get status of a non-existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None.

Flow

  1. Invoke the get EHR_STATUS service by a random ehr_id

  2. The result should be negative and the result should include an error e.g. "EHR with <ehr_id> doesn’t exist".

Test runners

Service Model operation: I_EHR_STATUS.set_ehr_queryable()

Service Model reference: I_EHR_STATUS.set_ehr_queryable()

Test Case I_EHR_STATUS.set_ehr_queryable-existing_ehr

Description

Set EHR queryable of an existing EHR

Pre-conditions

An EHR with known ehr_id should exist.

Post-conditions

EHR_STATUS.is_queryable, for the EHR with known ehr_id, should be true.

Flow

  1. For the existing EHR, invoke the set EHR queryable service

  2. The result should be positive and the corresponding EHR_STATUS.is_queryable should be true

Test runners

Test Case I_EHR_STATUS.set_ehr_queryable-bad_ehr

Description

Set EHR queryable of non existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke the set EHR queryable service by a random ehr_id

  2. The result should be negative and the result should include an error e.g. "EHR with <ehr_id> doesn’t exist".

Test runners

Service Model operation: I_EHR_STATUS.set_ehr_modifiable()

Service Model reference: I_EHR_STATUS.set_ehr_modifiable()

Test Case I_EHR_STATUS.set_ehr_modifiable-existing_ehr

Description

Set EHR modifiable of an existing EHR

Pre-conditions

An EHR with known ehr_id should exist.

Post-conditions

EHR_STATUS.is_modifiable, for the EHR with known ehr_id, should be true.

Flow

  1. For the existing EHR, invoke the set EHR modifiable service

  2. The result should be positive and the corresponding EHR_STATUS.is_modifiable should be true

Test runners

Test Case I_EHR_STATUS.set_ehr_modifiable-bad_ehr

Description

Set EHR modifiable of non-existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke the set EHR modifiable service by a random ehr_id

  2. The result should be negative and the result should include an error e.g. "EHR with <ehr_id> doesn’t exist".

Test runners

Service Model operation: I_EHR_STATUS.clear_ehr_queryable()

Service Model reference: I_EHR_STATUS.clear_ehr_queryable()

Test Case I_EHR_STATUS.clear_ehr_queryable-existing_ehr

Description

Clear EHR queryable of an existing EHR

Pre-conditions

An EHR with known ehr_id should exist.

Post-conditions

EHR_STATUS.is_queryable, for the EHR with known ehr_id, should be false.

Flow

  1. For the existing EHR, invoke the clear EHR queryable service

  2. The result should be positive and the corresponding EHR_STATUS.is_queryable should be false

Test runners

Test Case I_EHR_STATUS.clear_ehr_queryable-bad_ehr

Description

Clear EHR queryable of non-existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke the clear EHR queryable service by a random ehr_id

  2. The result should be negative and the result should include an error e.g. "EHR with <ehr_id> doesn’t exist".

Test runners

Service Model operation: I_EHR_STATUS.clear_ehr_modifiable()

Service Model reference: I_EHR_STATUS.clear_ehr_modifiable()

Test Case I_EHR_STATUS.clear_ehr_modifiable-existing_ehr

Description

Clear EHR modifiable of an existing EHR

Pre-conditions

An EHR with known ehr_id should exist.

Post-conditions

EHR_STATUS.is_modifiable, for the EHR with known ehr_id, should be false

Flow

  1. For the existing EHR, invoke the clear EHR modifiable service

  2. The result should be positive and the corresponding EHR_STATUS.is_modifiable should be false

Test runners

Test Case I_EHR_STATUS.clear_ehr_modifiable-bad_ehr

Description

Clear EHR modifiable of non existing EHR

Pre-conditions

The server should be empty (no EHRs, no commits, no OPTs).

Post-conditions

None

Flow

  1. Invoke the clear EHR modifiable service by a random ehr_id

  2. The result should be negative and the result should include an error e.g. "EHR with <ehr_id> doesn’t exist".

Test runners