Skip to content

PHACDataHub/wastewater-graphql

Repository files navigation

GraphQL API for WasteWater

This is a GraphQL server built using Apollo that provides access to waste water surveillance data.

Getting started

Create a local configuration file named local.settings.json with the following content (or whatever content is required for your environment):

{
    "IsEncrypted": false,
    "Values": {
      "FUNCTIONS_WORKER_RUNTIME": "node",
      "AzureWebJobsStorage": "UseDevelopmentStorage=true"
    }
  }

Create a .env file that defines the required environment variables.

Variable Description
*DB_DATABASE The name of the database
*DB_HOST The host
*DB_AUTH_TYPE Authentication type. See allowed values below
DB_USER SQL Authentication username
DB_PASSWORD SQL Authentication password

Valid values for DB_AUTH_TYPE are:

  • default
  • ntlm
  • azure-active-directory-password
  • azure-active-directory-access-token
  • azure-active-directory-msi-vm
  • azure-active-directory-msi-app-service
  • azure-active-directory-service-principal-secret

Example .env file:

# .env
DB_DATABASE=wwdb
DB_HOST=localhost
DB_AUTH_TYPE=default

DB_USER=test
DB_PASSWORD=test

Data access

Access to data is determined by the Azure API Management gateway, details on how this process works can be found in AUTHORIZATION.md.

The authorization documentation is generated by code, and can be updated by running npm run docs on a linux system with xvfb installed.

Example Usage

You can find usage examples for the API in the docs/examples directory. These examples demonstrate how to use the API in different programming languages:

Terraform

The terraform used to deploy the API into Azure can be found here.

Contributing

This repository uses conventional commits to maintain CHANGELOG.md and semantic versioning. To achieve this PRs are either squashed or rebased into main with the appropriate commit messages.

The release-please GitHub action is used to automatically update the changelog, and create releases.