Skip to content

Commit

Permalink
Merge pull request #6 from beyondessential/update-20240530
Browse files Browse the repository at this point in the history
Latest update for May 30 2024
  • Loading branch information
kujo4pm authored May 29, 2024
2 parents b0a682f + 69fdad3 commit 54c8c3f
Show file tree
Hide file tree
Showing 579 changed files with 15,519 additions and 5,270 deletions.
24 changes: 9 additions & 15 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,16 @@

_Add a brief description of the changes in this PR to help give the reviewer context._

### Checklist
### Deploys

- [ ] Code is finished
- [ ] Tests are written
- [ ] UI Screenshots added to the Linear issue
- [ ] Testing notes added to the Linear issue
- [ ] **Deploy to Tamanu Internal** <!-- #deploy -->

_Upon merging:_
### Remember to...

- [ ] Update the changelog (find it [here](/~https://github.com/beyondessential/tamanu/releases) in the appropriate _draft_ release)
- [ ] with a ticket reference (e.g. `TAN-123: a one line description`, keep the lists sorted)
- [ ] any config/settings changes and manual deployment steps
- [ ] any db schema or other changes that could impact downstream data analysis
- [ ] Update the [config reference](https://beyond-essential.slab.com/posts/reference-config-file-0c70ukly) or [settings reference](https://beyond-essential.slab.com/posts/reference-settings-0blw1x2q) as needed
- [ ] Update the [relevant runbook(s)](https://beyond-essential.slab.com/topics/runbooks-bs04ml6c) as needed
- ...write or update tests
- ...add UI screenshots and **testing notes** to the Linear issue
- ...add any **manual upgrade steps** to the Linear issue
- ...update the [config reference](https://beyond-essential.slab.com/posts/reference-config-file-0c70ukly), [settings reference](https://beyond-essential.slab.com/posts/reference-settings-0blw1x2q), or any [relevant runbook(s)](https://beyond-essential.slab.com/topics/runbooks-bs04ml6c)
- ...call out additions or changes to **config files** for the deployment team to take note of

### Deploys

- [ ] **Deploy to Tamanu Internal** <!-- #deploy -->
<!-- Thank you! -->
2 changes: 1 addition & 1 deletion .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
if: always()
shell: bash
run: |
if ! grep -qP '^(ci|config|db|deps|doc|feat|fix|fmt|merge|refactor|release|repo|revert|style|test|tweak)(\(\w+\))?:\s' <<< "$PR_TITLE"; then
if ! grep -qP '^(ci|config|db|deps|doc|feat|fix|fmt|merge|refactor|release|repo|revert|style|test|tweak|perf)(\(\w+\))?:\s' <<< "$PR_TITLE"; then
echo "::warning::PR title Conventional Type is not on the list; refer to CONTRIBUTING.md"
exit 1
fi
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cleanup-auto-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ concurrency:
cancel-in-progress: false

permissions:
contents: read # to checkout the repo
contents: write # to checkout the repo
pull-requests: write # to parse PRs for config and update them
issues: write # to parse special deploy issues and update them

Expand Down Expand Up @@ -79,6 +79,7 @@ jobs:
deploy-name: ${{ matrix.name }}
options: ${{ matrix.options }}
check-branch: false
ref: not needed as check branch is false
secrets:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
TAILSCALE_OAUTH: ${{ secrets.TAILSCALE_DBPROXY_ACCESS_OAUTH }}
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/cut-release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ on:
workflow_dispatch:
inputs:
version:
description: Next version number
description: Bump version on main to the next
required: true
type: choice
options:
- minor
- major
default: minor

jobs:
Expand Down Expand Up @@ -61,15 +65,6 @@ jobs:
git push origin "$NEW_BRANCH_NAME"
git switch main
- name: Create next release draft
uses: actions/github-script@v7
with:
github-token: ${{ secrets.TAMANU_RELEASE_PAT }}
script: |
const cwd = '${{ github.workspace }}';
const { createNextDraft } = await import(`${cwd}/scripts/gha-release-ops.mjs`);
await createNextDraft(await import('fs'), github, context, cwd, '${{ github.event.inputs.version }}');
- name: Bump version on main
run: node scripts/version.mjs '${{ inputs.version }}'

Expand Down
53 changes: 36 additions & 17 deletions .github/workflows/publish-release-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ jobs:
git config user.email github-actions@github.com
version=$(jq -r .version package.json)
git commit --allow-empty -am "release: v$version"
echo "current_version=$version" >> $GITHUB_OUTPUT
echo "current_version=$version" | tee -a $GITHUB_OUTPUT
echo "current_version_ref=$(git show-ref -s HEAD)" | tee -a $GITHUB_OUTPUT
git tag -a "v$version" -m "release: v$version"
git push --follow-tags
Expand All @@ -49,25 +50,43 @@ jobs:
set -euxo pipefail
version=$(jq -r .version package.json)
git commit -am "release: Bump version to $version"
echo "next_version=$version" >> $GITHUB_OUTPUT
echo "next_version=$version" | tee -a $GITHUB_OUTPUT
git push
# do release management after the critical bits above as we care less if those fail

- name: Create draft for next release
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const cwd = '${{ github.workspace }}';
const { createDraftRelease } = await import(`${cwd}/scripts/gha-release-ops.mjs`);
await createDraftRelease(await import('fs'), github, context, cwd, '${{ steps.nextv.outputs.next_version }}');
- name: Install git-cliff
run: npm install -g git-cliff@latest

- name: Generate release notes
run: |
version=${{ steps.tagged.outputs.current_version }}
pattern="^v$(cut -d. -f-2 <<< "$version" | sed 's/[.]/[.]/g')[.]"
# 2.6.1 -> ^v2[.]6[.]
git cliff --topo-order --strip all --latest \
--tag-pattern "$pattern" --tag "v$version" \
--output RELEASE_NOTES.md
cat RELEASE_NOTES.md
- name: Determine the true latest version
id: latest
run: |
set -euxo pipefail
git fetch --tags
git tag --list \
| grep -E '^v[0-9]+[.][0-9]+[.][0-9]+$' \
| cut -c2- \
| sort --version-sort \
| tail -n1 \
| sed 's/^/latest_version=/' \
| tee -a $GITHUB_OUTPUT
- name: Publish the draft release if one exists
uses: actions/github-script@v7
- name: Publish the release
uses: softprops/action-gh-release@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const cwd = '${{ github.workspace }}';
const { publishRelease } = await import(`${cwd}/scripts/gha-release-ops.mjs`);
await publishRelease(github, context, '${{ steps.tagged.outputs.current_version }}');
name: v${{ steps.tagged.outputs.current_version }}
tag_name: v${{ steps.tagged.outputs.current_version }}
target_commitish: ${{ steps.tagged.outputs.current_version_ref }}
body_path: RELEASE_NOTES.md
make_latest: ${{ steps.latest.outputs.latest_version == steps.tagged.outputs.current_version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ lints.md
.elasticbeanstalk/*
!.elasticbeanstalk/*.cfg.yml
!.elasticbeanstalk/*.global.yml

1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ The following types are conventional:
- `fix` for bug fixes
- `fmt` for automatic formatting changes (ignored in changelogs)
- `merge` for merging between branches (generally between `main` and `release/*`)
- `perf` for code changes that improve performance
- `refactor` for code refactoring
- `release` for changes that are part of the release process (generally automated commits, not manual use)
- `repo` for changes to the repository structure, or for config/dotfiles (e.g. `.gitignore`, `.editorconfig`, etc)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@
| Package | Runbook | Description |
| ------- | ------- | ----------- |
| [@tamanu/central-server](packages/central-server) | [central-server runbook](https://beyond-essential.slab.com/posts/tamanu-central-server-runbook-et0trny5) | The central server, which facility server and mobile client instances communicate with to synchronise data *|
| [@tamanu/central-server](packages/central-server) | [central-server runbook](https://beyond-essential.slab.com/posts/tamanu-central-server-runbook-et0trny5) | The central server, which facility server and mobile client instances communicate with to synchronise data |
| [@tamanu/facility-server](packages/facility-server) | [facility-server runbook](https://beyond-essential.slab.com/posts/todo-tamanu-lan-runbook-ezljl0qk) | The facility server, which the app communicates with |
| [@tamanu/meta-server](packages/meta-server) | [meta-server runbook](https://beyond-essential.slab.com/posts/todo-tamanu-meta-server-runbook-0zbgw7m7) | The metadata server, which serves information about app versions and known central-server installations |
| [@tamanu/web-frontend](packages/web) | [web runbook](https://beyond-essential.slab.com/posts/todo-tamanu-desktop-runbook-i2bmy57c) | The web app |
| [mobile](packages/mobile) | [mobile runbook](https://beyond-essential.slab.com/posts/todo-tamanu-mobile-runbook-8vj8qceu) | The mobile app |
| [@tamanu/shared](packages/shared) | N/A | Shared code monolith among Tamanu components |
| [@tamanu/build-tooling](packages/build-tooling) | N/A | Shared build tooling code |
| [csca](packages/csca) | [csca runbook](https://beyond-essential.slab.com/posts/csca-runbook-be1td5ml), [signer runbook](https://beyond-essential.slab.com/posts/signer-runbook-hcws6er3) | A tool to create and manage a CSCA / ICAO eMRTD PKI* |

<sub>*omitted from public repo for security reasons</sub>
| [csca](packages/csca) | [csca runbook](https://beyond-essential.slab.com/posts/csca-runbook-be1td5ml), [signer runbook](https://beyond-essential.slab.com/posts/signer-runbook-hcws6er3) | A tool to create and manage a CSCA / ICAO eMRTD PKI |

The latest version for each Tamanu service (Servers, Web Client & Mobile Client) can be retrieved with a HTTP GET request via their respective public API routes:

Expand Down
63 changes: 63 additions & 0 deletions cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[changelog]
trim = true
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.\n
"""
footer = """
<!-- generated by git-cliff -->
"""
body = """
## Release notes 📋
{%- for commit in commits | sort(attribute="group") %}
{%- if commit.group -%}
{% else -%}
- **{{ commit.scope | striptags | trim }}:** \
{{ commit.message | upper_first }}\
{%- if commit.message is not matching(".*\\s+\\(#\\d+\\)\\s*$") %} ([`{{ commit.id | truncate(length=10, end="") }}`]($REPO/commit/{{ commit.id }})){%- endif -%}
{% endif -%}
{% endfor -%}
{% for group, commits in commits | filter(attribute="scope") | group_by(attribute="group") %}
### {{ group | striptags | trim | upper_first }}
{% for commit in commits | sort(attribute="scope") %}
- **{{ commit.scope | striptags | trim }}:** \
{{ commit.message | upper_first }}\
{%- if commit.message is not matching(".*\\s+\\(#\\d+\\)\\s*$") %} ([`{{ commit.id | truncate(length=10, end="") }}`]($REPO/commit/{{ commit.id }})){%- endif -%}
{%- endfor -%}
{% raw %}\n{% endraw %}\
{% endfor %}\n
"""
postprocessors = [
{ pattern = '\b((?i)(?:EPI|KAM|MAUI|MDEV|NASS|NOTAM|SAV|TAM3|TAMOC|TAN|TAV|VIT|WAITM)-[1-9][0-9]*)\b', replace = "[$1](https://linear.app/bes/issue/$1)" }, # linear
{ pattern = '\(#(\d+)\)', replace = "([#$1]($$REPO/pull/$1))"}, # github
{ pattern = '\$REPO', replace = "/~https://github.com/beyondessential/tamanu" }, # replace repository URL
]

[git]
conventional_commits = true
filter_unconventional = true
split_commits = true
protect_breaking_commits = true
filter_commits = true
tag_pattern = "v[0-9].*"
sort_commits = "oldest"

commit_parsers = [
{ message = "^feat", group = "Features ⭐" },
{ message = "^fix", group = "Bugfixes 🐛" },
{ message = "^tweak", group = "Tweaks ⚖️" },
{ message = "^config", group = "Configuration ⚙️" },
{ message = "^db", group = "Database 📊" },
{ message = "^doc", group = "Documentation 📚" },
{ message = "^perf", group = "Performance 🌊" },
{ message = "^refactor", group = "Refactors 🛠️" },
{ message = "^test", group = "Testing 🧪" },
{ message = "^deps", group = "Dependencies 📦" },
{ message = "^repo", group = "Repo 📖" },
{ message = "^(chore|ci|draft|fmt|merge|release|style|wip)", skip = true },
{ body = ".*security", group = "Security ⚠️" },
{ message = "^revert", group = "Revert ⏪" },
]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tamanu",
"version": "2.6.0",
"version": "2.9.0",
"description": "This repo contains all the packages for Tamanu",
"homepage": "/~https://github.com/beyondessential/tamanu.git#readme",
"repository": "git@github.com:beyondessential/tamanu.git",
Expand Down Expand Up @@ -59,6 +59,7 @@
"packages/meta-server",
"packages/shared",
"packages/constants",
"packages/settings",
"packages/api-client"
],
"nohoist": [
Expand Down
2 changes: 1 addition & 1 deletion packages/api-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tamanu/api-client",
"version": "2.6.0",
"version": "2.9.0",
"private": true,
"description": "API client for Tamanu Facility Server",
"main": "dist/cjs/index.js",
Expand Down
3 changes: 2 additions & 1 deletion packages/api-client/src/TamanuApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@ export class TamanuApi {
permissions,
centralHost,
role,
settings,
} = await response.json();
server.type = serverType;
server.centralHost = centralHost;
this.setToken(token);

const { user, ability } = await this.fetchUserData(permissions);
return { user, token, localisation, server, ability, role };
return { user, token, localisation, server, ability, role, settings };
}

async fetchUserData(permissions) {
Expand Down
2 changes: 1 addition & 1 deletion packages/build-tooling/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tamanu/build-tooling",
"version": "2.6.0",
"version": "2.9.0",
"description": "Build tooling for Tamanu packages",
"main": "index.mjs",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/constants/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tamanu/constants",
"version": "2.6.0",
"version": "2.9.0",
"private": true,
"description": "Shared constants",
"main": "dist/cjs/index.js",
Expand Down
2 changes: 2 additions & 0 deletions packages/constants/src/comms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const PATIENT_COMMUNICATION_CHANNELS = {
EMAIL: 'Email',
SMS: 'Sms',
WHATSAPP: 'WhatsApp',
TELEGRAM: 'Telegram'
};

export const PATIENT_COMMUNICATION_CHANNELS_VALUES = Object.values(
Expand All @@ -11,6 +12,7 @@ export const PATIENT_COMMUNICATION_CHANNELS_VALUES = Object.values(
export const PATIENT_COMMUNICATION_TYPES = {
REFERRAL_CREATED: 'Referral created',
CERTIFICATE: 'Certificate',
VACCINATION_REMINDER: 'Vaccination reminder',
};

export const PATIENT_COMMUNICATION_TYPES_VALUES = Object.values(
Expand Down
19 changes: 19 additions & 0 deletions packages/constants/src/fhir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,15 @@ export const FHIR_DIAGNOSTIC_REPORT_STATUS = {
UNKNOWN: 'unknown',
};

export const FHIR_IMAGING_STUDY_STATUS = {
REGISTERED: 'registered',
AVAILABLE: 'available',
FINAL_INVALID_LEGACY: 'final', // this needs to be supported but is not valid FHIR
CANCELLED: 'cancelled',
ENTERED_IN_ERROR: 'entered-in-error',
UNKNOWN: 'unknown',
};

export const FHIR_ENCOUNTER_CLASS_DISPLAY = {
IMP: 'inpatient encounter',
AMB: 'ambulatory encounter',
Expand Down Expand Up @@ -297,3 +306,13 @@ export const IPS_REQUEST_STATUSES = {
ERROR: 'Error',
IGNORE: 'Ignore',
};

export const HTTP_BODY_DATA_PATHS = {
DIAGNOSTIC_REPORT_ATTACHMENT: '$.presentedForm[*].data',
};

export const SCRUBBED_DATA_MESSAGE = 'Raw data removed from logs';
export const SUPPORTED_CONTENT_TYPES = {
PDF: 'application/pdf',
};
export const DEFAULT_REASON_CANCELLED_BY_API = 'cancelled externally via api';
6 changes: 6 additions & 0 deletions packages/constants/src/importable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ export const GENERAL_IMPORTABLE_DATA_TYPES = [
'angiogramImagingArea',
'arrivalMode',
'carePlan',
'catchment',
'certifiableVaccine',
'colonoscopyImagingArea',
'contactRelationship',
'country',
'ctScanImagingArea',
'department',
'diagnosis',
'diet',
'dischargeDisposition',
'division',
'drug',
Expand Down Expand Up @@ -76,7 +79,9 @@ export const REFERENCE_TYPES = {
ICD10: 'icd10',
ALLERGY: 'allergy',
CONDITION: 'condition',
CONTACT_RELATIONSHIP: 'contactRelationship',
DRUG: 'drug',
DIET: 'diet',
TRIAGE_REASON: 'triageReason',
PROCEDURE_TYPE: 'procedureType',
IMAGING_TYPE: 'imagingType',
Expand Down Expand Up @@ -115,6 +120,7 @@ export const REFERENCE_TYPES = {
VACCINE_CIRCUMSTANCE: 'vaccineCircumstance',
ADDITIONAL_INVOICE_LINE: 'additionalInvoiceLine',
SPECIMEN_TYPE: 'specimenType',
CATCHMENT: 'catchment',
REACTION: 'reaction',
...IMAGING_AREA_TYPES,
};
Expand Down
1 change: 1 addition & 0 deletions packages/constants/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ export * from './programRegistry.js';
export * from './vaccines.js';
export * from './settings.js';
export * from './encounterHistory.js';
export * from './webSocket.js';
Loading

0 comments on commit 54c8c3f

Please sign in to comment.