Skip to content

tewhatuora/api-standards-conformance

Repository files navigation


Health New Zealand Te Whatu Ora Logo

Health New Zealand | Te Whatu Ora API Conformance Tool

This project is a conformance tool framework designed to assess an API against the Te Whatu Ora API Standards which are officially published at https://apistandards.digital.health.nz.

Getting Started

Running the tool as a Docker container

Pull the latest image:

docker pull ghcr.io/tewhatuora/api-standards-conformance:latest

Run a conformance test (note you must have a valid config.json in the current working directory):

docker run -it -v $(pwd)/config.json:/usr/src/app/config.json -v $(pwd)/reports:/usr/src/app/reports ghcr.io/tewhatuora/api-standards-conformance

To merge custom features with the base implementation, mount to /opt/features

docker run -v$(pwd)/override:/opt/features -v $(pwd)/config.json:/usr/src/app/config.json -v $(pwd)/reports:/usr/src/app/reports ghcr.io/tewhatuora/api-standards-conformance

To execute specific specific tags

docker run -v$(pwd)/override:/opt/features -v $(pwd)/config.json:/usr/src/app/config.json -v $(pwd)/reports:/usr/src/app/reports ghcr.io/tewhatuora/api-standards-conformance --tags @fhir

To skip specific specific tags

docker run -v$(pwd)/override:/opt/features -v $(pwd)/config.json:/usr/src/app/config.json -v $(pwd)/reports:/usr/src/app/reports ghcr.io/tewhatuora/api-standards-conformance --tags '"not @not-implemented"'

Development

This tool is distributed as a Docker container, or you can build it yourself.

Install dependencies:

yarn

Run the tool without Docker:

yarn test yarn report

Build the container locally:

yarn build

Run the container locally (test):

yarn test:docker

Run the container locally (report):

yarn test:report

Working with Docker

In order to test new features or fixes alongside projects that run the conformance suite, you may want to update and publish development versions of the docker image that can be used implementing APIs.

After making changes to the code base, You will first need authenticate your machine to github, using PAT from github with package and repo permissions.

Then login with it

export GHCR_PAT="ghp_abc123yourtoken" echo "$GHCR_PAT" | docker login ghcr.io -u cameronrichards --password-stdin

Then push build and push multi arch image with a dev tag to the container register

docker buildx create --use
docker buildx build --platform linux/amd64,linux/arm64 --push -t ghcr.io/tewhatuora/api-standards-conformance:dev .

Configuration

Configuration for the tool is via a config.json file. When running in Docker, this file on the host should be mounted to /usr/src/app/config.json (see below). When running locally, the config.json must be present at the root of the project.

This configuration must be carefully reviewed prior to running the conformance tool.

Example report:

Example report

License

This work is licensed under CC BY-NC-ND 4.0. Refer to the LICENSE file for information.

CC BY 4.0

About

Conformance tooling for the Health New Zealand Te Whatu Ora API Standards

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors