/dgc-business-rules-testdata

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Digital COVID Certificates: Business Rules testdata

AboutOrganisationTesting & StatusLicensing

About

This repository holds business rules to determine whether a person is deemed fit-for-travel into a country-of-arrival (CoA) based on their vaccination, test, and recovery status, as encoded using the Digital COVID Certificate. The status of the business rules here is unofficial: the actual rules will be available from the DCGC Gateway. Its main purpose is to help with developing interchangeable business rules.

This repository performs automatic validation and testing on all the rules, and their tests, contributed to it. This validation and testing runs on every Pull Request, but can also be run locally from the commandline, as follows:

$ ./build.sh

The “CertLogic Validation” GitHub Action performs this exact same command. It requires a UNIX-like shell, Git, curl, and a recent Node.js (with the NPM package manager) to be installed.

After having run this command once, you can just run the validation/testing as follows:

$ (cd tooling ; npm start)

Validation encompasses the following:

  • The JSON file of every rule is validated against this JSON Schema.
  • The Logic field of every rule is validated as a CertLogic expression, which is a format/language that's specified here.
  • The specified AffectedFields field is checked against the fields of the DCC payload accessed from the Logic field.
  • ...more validations and checks to follow

Testing means that all rules' tests are executed using the JS-implementation of CertLogic. JSON files containing tests must adhere to this JSON Schema.

All rules are also executed against every DCC found in the DCC test data repo. The results are exposed as an artifact (called rules-on-testData.json) of the "Validation and Testing of Rule Sets" GitHub Action.

To execute the tests on the rules of a specific rule set, or even a specific rule, you can run the following:

$ ./node_modules/.bin/mocha dist/run-all-test.js [ruleSetId] [[ruleId]]

Organisation

This repository contains the following:

  • GitHub Actions configuration
  • tests: testing material called by the “Business Rule Validation” GitHub Action
  • tooling: testing material called by the “CertLogic Validation” GitHub Action
  • valuesets: “compress” the value sets for use with validation rule evaluation - see that README
  • EU: EU template/recommendation rules
  • DE, FI, NL, etc.: actual rules for EU Member States
  • build.sh: a build script to build the compressed value sets, build the tooling, and run all tests

Testing & Status

  • If you found any problems, please create an Issue.
  • Current status: Work-In-Progress + see above.

Licensing

Copyright (c) 2021 Dutch Ministry of Health, Science, and Sports, and all other contributors

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 https://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.