Test Suite: EHR_SERVICE / I_DIRECTORY Interface

Normative Reference

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

  • I_EHR_DIRECTORY

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:

Dependencies

This test suite depends on other test suites:

Test Data Sets

For the creation and modification of the EHR.directory structure it is important to explore the hierarchical nature of the FOLDER structures and consider the edge cases for EHR.directory.

Tests of EHR.directory

  1. FOLDER

  2. FOLDER with items

  3. FOLDER with subfolders

  4. FOLDER with subfolders and items on all the folders

  5. FOLDER with n levels of subfolders and items (to detect any implementation limitations)

Tests of Reference FOLDER structure

the following image is provided for reference. The items in the FOLDER are references to VERSIONED_OBJECTs that may contain COMPOSITION, EHR_STATUS and FOLDER. This documentation focuses on testing COMPOSITION as content in the FOLDERs. Discourse discussion.
high level ehr structure
Figure 1. Folder structures in the EHR

Test Cases

Service Model operation: I_EHR_DIRECTORY.has_directory()

Service Model reference: I_EHR_DIRECTORY.has_directory()

Test Case I_EHR_DIRECTORY.has_directory-empty_ehr

Description

Test has_directory on empty EHR

Pre-conditions

  1. An EHR with known ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the has_directory service for the ehr_id

  2. The result must be false

Test runners

Test Case I_EHR_DIRECTORY.has_directory-ehr_with_directory

Description

Test has_directory on EHR containing a directory

Pre-conditions

  1. An EHR with known ehr_id exists

  2. The EHR has a directory

Post-conditions

None

Flow

  1. Invoke the has_directory service for the ehr_id

  2. The result must be true

Test runners

Test Case I_EHR_DIRECTORY.has_directory-bad_ehr

Description

Test has_directory on non-existent EHR

Pre-conditions

  1. There are no EHRs on the server

Post-conditions

None

Flow

  1. Invoke the has_directory service for a random non-existent ehr_id

  2. An error should be returned, indicating that the EHR that doesn’t exist

Test runners

Service Model operation: I_EHR_DIRECTORY.has_path()

Service Model reference: I_EHR_DIRECTORY.has_path()

Test Case I_EHR_DIRECTORY.has_path-empty_ehr

Description

Test has_path on empty EHR

Pre-conditions

  1. An EHR with known ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the has path service for the ehr_id with a random FOLDER path

  2. The result must be false

Test runners

Test Case I_EHR_DIRECTORY.has_path-ehr_root_directory

Description

Test has_path on EHR with just root directory

Pre-conditions

  1. An EHR with known ehr_id exists

  2. The EHR and has an empty directory (no subfolders or items)

Post-conditions

None

Flow

  1. Invoke the has path service for the ehr_id and an existing path $path from the data set

  2. The result must be $result from the data set

Data set

$path $result

'/'

true

random()

false

'/' represents the string slash, which is the default name for the root FOLDER at EHR.directory, random() represents any randomly generated path that doesn’t exist.

Test runners

Test Case I_EHR_DIRECTORY.has_path-folder_structure

Description

Test has_path on EHR with folder structure

Pre-conditions

  1. An EHR with known ehr_id exists

  2. The EHR has a directory with an internal structure (described below)

Post-conditions

None

Flow

  1. Invoke the has path service for the ehr_id and the path $path from the data set

  2. The result must be $result from the data set

Data set

Assuming the following structure in EHR.directory:

/
    +--- emergency
    |        |
    |        +--- episode-x
    |        |      |
    |        |      +--- summary-composition-x
    |        |
    |        +--- episode-y
    |               |
    |               +--- summary-composition-y
    |
    +--- hospitalization
             |
             +--- summary-composition-z
these are the names of the FOLDERs and COMPOSITIONs in EHR.directory.
$path $result

'/'

true

'/emergency'

true

'/emergency/episode-x'

true

'/emergency/episode-x/summary-composition-x'

true

'/emergency/episode-y'

true

'/emergency/episode-y/summary-composition-y'

true

'/hospitalization'

true

'/hospitalization/summary-composition-z'

true

'/' + random()

false

'/emergency/' + random()

false

'/emergency/episode-x/' + random()

false

random()

false

the table mixes cases that exist with cases of paths which part exists and parts doesn’t exist. The final one is a random path.

Test runners

Test Case I_EHR_DIRECTORY.has_path-bad_ehr

Description

Test has_path on non-existent EHR

Pre-conditions

  1. The server is empty

Post-conditions

None

Flow

  1. Invoke the has path service for a random ehr_id and path

  2. The service should return an error, indicating that the EHR doesn’t exist

Test runners

Service Model operation: I_EHR_DIRECTORY.create_directory()

Service Model reference: I_EHR_DIRECTORY.create_directory()

Test Case I_EHR_DIRECTORY.create_directory-empty_ehr

Description

Test create_directory on empty EHR

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

  1. The EHR ehr_id should have a directory

Flow

  1. Invoke the create directory service with the existing ehr_id and a valid FOLDER structure

    1. Use any of the data sets described on the previous tests and the reference directory structure

  2. The service should return a positive result indicating the directory created for the EHR

Test runners

Test Case I_EHR_DIRECTORY.create_directory-ehr_with_directory

Description

Test create_directory on EHR with directory

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory

Post-conditions

None

Flow

  1. Invoke the create directory service with the existing ehr_id and a valid FOLDER structure

    1. Use any of the data sets described on the previous tests and the reference directory structure

  2. The service should return an error, indicating that the EHR directory already exists

Test runners

Test Case I_EHR_DIRECTORY.create_directory-bad_ehr

Description

Test create_directory on non-existent EHR

Pre-conditions

  1. The server should be empty

Post-conditions

None

Flow

  1. Invoke the create directory service for a random ehr_id

  2. The service should return an error, indicating that the EHR that doesn’t exist

Test runners

Service Model operation: I_EHR_DIRECTORY.get_directory()

Service Model reference: I_EHR_DIRECTORY.get_directory()

Test Case I_EHR_DIRECTORY.get_directory-empty_ehr

Description

Test get_directory on empty EHR

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the get directory service for the ehr_id

  2. The service should return an empty structure

    NOTE: in a REST API implementation, the result could be an error status instead of an empty structure.

Test runners

Test Case I_EHR_DIRECTORY.get_directory-ehr_root_directory

Description

Test get_directory on EHR with a root directory

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a single empty FOLDER in its directory

Post-conditions

None

Flow

  1. Invoke the get directory service for the ehr_id

  2. The service should return the structure of the EHR.directory: an empty FOLDER

Test runners

Test Case I_EHR_DIRECTORY.get_directory-directory_with_structure

Description

Test get_directory on EHR with a directory containing sub-structure

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory with a sub-structure (use the data sets from the previous tests and the reference directory structure)

Post-conditions

None

Flow

  1. Invoke the get directory service for the ehr_id

  2. The service should return the full structure of the EHR directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory-bad_ehr

Description

Test get_directory on non-existent EHR

Pre-conditions

  1. The server is empty

Post-conditions

None

Flow

  1. Invoke the get directory service for a random ehr_id

  2. The service should return an error related with the non-existent EHR

Test runners

Service Model operation: I_EHR_DIRECTORY.get_directory_at_time()

Service Model reference: I_EHR_DIRECTORY.get_directory_at_time()

Test Case I_EHR_DIRECTORY.get_directory_at_time-empty_ehr

Description

Test get_directory_at_time on empty EHR

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and current time

  2. The service should return an empty structure

    NOTE: considering a REST API implementation, the result could be an error status instead of an empty structure.

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-empty_ehr_empty_time

Description

Test get_directory_at_time on empty EHR with empty time

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and empty time

  2. The service should return an empty structure

    NOTE: considering a REST API implementation, the result could be an error status instead of an empty structure.

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-ehr_with_directory

Description

Test get_directory_at_time on empty EHR with directory

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory with one version (use any of the valid datasets from the previous tests)

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and current time

  2. The service should return the current directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-ehr_with_directory_empty_time

Description

Test get_directory_at_time on EHR with directory with empty time

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory with one version (use any of the valid datasets from the previous tests)

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and empty time

  2. The service should return the current directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-ehr_with_directory_versions

Description

Test get_directory_at_time on EHR with directory containing multiple versions

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory with two versions (use any of the valid datasets from the previous tests, add small changes to differentiate the versions)

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and a time before EHR.time_created

  2. The service should return an empty structure

  3. Invoke the get directory at time service for the ehr_id and a time after the first EHR.directory version was created and before the second EHR.directory version was created

  4. The service should return the first version of EHR.drectory

  5. Invoke the get directory at time service for the ehr_id and current time

  6. The service should return the second version of EHR.directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-ehr_with_directory_versions_empty_time

Description

Test get_directory_at_time on EHR with directory containing multiple versions with empty time

Pre-conditions

  1. An EHR with ehr_id exists

  2. The EHR has a directory with two versions (use any of the valid datasets from the previous tests, add small changes to differentiate the versions)

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and empty time

  2. The service should return the current latest directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-bad_ehr

Description

Test get_directory_at_time on non-existent EHR

Pre-conditions

  1. The server is empty

Post-conditions

None

Flow

  1. Invoke the get directory at time service for a random ehr_id and current time

  2. The service should return an error indicating non-existent EHR

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_time-multiple_versions_first

Description

Test get_directory_at_time on EHR with directory with multiple versions first version

Pre-conditions

  1. An EHR with ehr_id and has directory with two versions

Post-conditions

None

Flow

  1. Invoke the get directory at time service for the ehr_id and a time AFTER the first version of the directory was created, but BEFORE the second version was created (update)

  2. The service should return the first version of the directory

Test runners

Service Model operation: I_EHR_DIRECTORY.update_directory()

Service Model reference: I_EHR_DIRECTORY.update_directory()

Test Case I_EHR_DIRECTORY.update_directory-ehr_with_directory

Description

Test update_directory on EHR with directory

Pre-conditions

  1. An EHR with ehr_id exists on the server

  2. The EHR has a directory

Post-conditions

  1. The EHR with ehr_id has an updated directory structure

Flow

  1. Invoke the update directory service for the ehr_id

    1. Use any of the valid paylaods described on the previous tests

  2. The service should return a positive result related with the updated directory

Test runners

Test Case I_EHR_DIRECTORY.update_directory-empty_ehr

Description

Test update_directory on empty EHR

Pre-conditions

  1. An EHR with ehr_id exists on the server

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the update directory service for the ehr_id

    1. Use any of the valid paylaods described on the previous tests

  2. The service should return an error indicating that the non existent directory to update

Test runners

Test Case I_EHR_DIRECTORY.update_directory-bad_ehr

Description

Test update_directory on non-existent EHR

Pre-conditions

  1. The server is empty

Post-conditions

None

Flow

  1. Invoke the update directory service for random ehr_id

    1. Any valid payload will suffice

  2. The service should return an error indicating that the non existent ehr_id

Test runners

Service Model operation: I_EHR_DIRECTORY.delete_directory()

Service Model reference: I_EHR_DIRECTORY.delete_directory()

Test Case I_EHR_DIRECTORY.delete_directory-empty_ehr

Description

Test delete_directory on empty EHR

Pre-conditions

  1. An EHR with ehr_id exists on the server

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the delete directory service for the ehr_id

  2. The service should return an error indicating the non existent directory

Test runners

Test Case I_EHR_DIRECTORY.delete_directory-ehr_with_directory

Description

Test delete_directory on EHR with directory

Pre-conditions

  1. An EHR with ehr_id exists on the server

  2. The EHR has a directory

Post-conditions

  1. The EHR ehr_id doesn’t have directory

the directory exists as a new deleted version (that is VERSION.lifecycle_state=deleted).

Flow

  1. Invoke the delete directory service for the ehr_id

  2. The service should return a positive result related with the deleted directory

Test runners

Test Case I_EHR_DIRECTORY.delete_directory-bad_ehr

Description

Test delete_directory on non-existent EHR

Pre-conditions

  1. The server is empty

Post-conditions

None

Flow

  1. Invoke the get directory service for a random ehr_id

  2. The service should return an error indicating that the non existent EHR

Test runners

Service Model operation: I_EHR_DIRECTORY.has_directory_version()

Service Model reference: I_EHR_DIRECTORY.has_directory_version()

Test Case I_EHR_DIRECTORY.has_directory_version-empty_ehr

Description

Test has_directory_version on empty EHR

Pre-conditions

  1. An EHR with known ehr_id exists on the server

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the has directory service for the ehr_id and a random version uid

  2. The service should return false

Test runners

Test Case I_EHR_DIRECTORY.has_directory_version-directory_with_two_versions

Description

Test has_directory_version on EHR that has two versions of directory

Pre-conditions

  1. An EHR with known ehr_id exists on the server

  2. The EHR has two directory versions

Post-conditions

None

Flow

  1. Invoke the has directory service for the ehr_id and the version_uid of the first version of directory

  2. The service should return true

  3. Invoke the has directory service for the ehr_id and the version_uid of the second version of directory

  4. The service should return true

Test runners

Test Case I_EHR_DIRECTORY.has_directory_version-bad_ehr

Description

Test has_directory_version on non-existent EHR

Pre-conditions

  1. The server doesn’t have EHRs

Post-conditions

None

Flow

  1. Invoke the has directory service for a random ehr_id and version uid

  2. The service should return an error related with the non-existence of the EHR

Test runners

Service Model operation: I_EHR_DIRECTORY.get_directory_at_version()

Test Case I_EHR_DIRECTORY.get_directory_at_version-empty_ehr

Description

Test get_directory_at_version on empty EHR

Pre-conditions

  1. An EHR with known ehr_id exists on the server

  2. The EHR doesn’t have a directory

Post-conditions

None

Flow

  1. Invoke the get directory at version service for the ehr_id and a random version uid

  2. The service should return an error indicating that the non-existence of the EHR directory version

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_version-directory_with_two_versions

Description

Test get_directory_at_version on EHR that has two versions of directory

Pre-conditions

  1. An EHR with known ehr_id exists on the server

  2. The EHR has two versions of directory

Post-conditions

None

Flow

  1. Invoke the get directory at version service for the ehr_id and the version_uid of the first version of directory

  2. The service should return the first version of the directory

  3. Invoke the get directory at version service for the ehr_id and the version_uid of the second version of directory

  4. The service should return the second version of the directory

Test runners

Test Case I_EHR_DIRECTORY.get_directory_at_version-bad_ehr

Description

Test get_directory_at_version on non-existent EHR

Pre-conditions

  1. The server doesn’t have EHRs

Post-conditions

None

Flow

  1. Invoke the get directory at version service for a random ehr_id and version uid

  2. The service should return an error related with the non existence of the EHR

Test runners

Service Model operation: I_EHR_DIRECTORY.get_versioned_directory()

Test Case I_EHR_DIRECTORY.get_versioned_directory-empty_ehr

Description

Test get_versioned_directory on non-existent EHR

Pre-conditions

  1. An EHR with known ehr_id exists on the server

Post-conditions

None

Flow

  1. Invoke the get versioned directory service for the ehr_id

  2. The service should return an error because the versioned directory doesn’t exist

    NOTE: depending on the implementation, a valid result could also be returning an empty result instead of an error.

Test runners

Test Case I_EHR_DIRECTORY.get_versioned_directory-directory_with_two_versions

Description

Test get_versioned_directory on EHR that has two versions of directory

Pre-conditions

  1. An EHR with known ehr_id exists on the server

  2. The EHR has two versions of directory

Post-conditions

None

Flow

  1. Invoke the get versioned directory service for the ehr_id

  2. The service should return the versioned folder and should reference the two exsinting versions

Test runners

Test Case I_EHR_DIRECTORY.get_versioned_directory-bad_ehr

Description

Test get_versioned_directory on non-existent EHR

Pre-conditions

  1. The server doesn’t have any EHRs

Post-conditions

None

Flow

  1. Invoke the get directory service for a random ehr_id

  2. The service should return an error related with the non existence of the EHR

Test runners