Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring Kafka workflows for data consistency and integrity improvements. #84

Merged
merged 14 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintcache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"/root/code/shared-health-record/src/hapi/lab.ts":"1","/root/code/shared-health-record/src/lib/helpers.ts":"2","/root/code/shared-health-record/src/routes/lab-bw.ts":"3","/root/code/shared-health-record/src/server/__tests__/mllpAdapter.ts":"4","/root/code/shared-health-record/src/server/mllpAdapter.ts":"5","/root/code/shared-health-record/src/workflows/__tests__/labWorkflowsBw.ts":"6","/root/code/shared-health-record/src/workflows/botswana/IpmsWorkflows.ts":"7","/root/code/shared-health-record/src/workflows/botswana/LaboratoryServiceRequest.ts":"8","/root/code/shared-health-record/src/workflows/botswana/helpers.ts":"9","/root/code/shared-health-record/src/workflows/botswana/hl7Workflows.ts":"10","/root/code/shared-health-record/src/workflows/botswana/locationWorkflows.ts":"11","/root/code/shared-health-record/src/workflows/botswana/terminologyWorkflows.ts":"12","/root/code/shared-health-record/src/workflows/botswana/workflowHandler.ts":"13"},{"size":3311,"mtime":1699903230423,"results":"14","hashOfConfig":"15"},{"size":640,"mtime":1699903230445},{"size":2063,"mtime":1699903216752,"results":"16","hashOfConfig":"15"},{"size":1869,"mtime":1699903216752,"results":"17","hashOfConfig":"15"},{"size":1922,"mtime":1699903216752,"results":"18","hashOfConfig":"15"},{"size":3128,"mtime":1699903230521},{"size":12060,"mtime":1699903230586},{"size":3260,"mtime":1699903230597},{"size":3145,"mtime":1699903230618},{"size":3699,"mtime":1699903230640,"results":"19","hashOfConfig":"15"},{"size":6117,"mtime":1699903230662,"results":"20","hashOfConfig":"15"},{"size":6528,"mtime":1699903230694,"results":"21","hashOfConfig":"15"},{"size":10465,"mtime":1699903230716},{"filePath":"22","messages":"23","suppressedMessages":"24","errorCount":0,"fatalErrorCount":0,"warningCount":12,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"ahalsm",{"filePath":"25","messages":"26","suppressedMessages":"27","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"28","messages":"29","suppressedMessages":"30","errorCount":0,"fatalErrorCount":0,"warningCount":4,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"31","messages":"32","suppressedMessages":"33","errorCount":0,"fatalErrorCount":0,"warningCount":8,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"34","messages":"35","suppressedMessages":"36","errorCount":0,"fatalErrorCount":0,"warningCount":5,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"37","messages":"38","suppressedMessages":"39","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"40","messages":"41","suppressedMessages":"42","errorCount":0,"fatalErrorCount":0,"warningCount":10,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},"/root/code/shared-health-record/src/hapi/lab.ts",["43","44","45","46","47","48","49","50","51","52","53","54"],[],"/root/code/shared-health-record/src/routes/lab-bw.ts",[],[],"/root/code/shared-health-record/src/server/__tests__/mllpAdapter.ts",["55","56","57","58"],[],"/root/code/shared-health-record/src/server/mllpAdapter.ts",["59","60","61","62","63","64","65","66"],[],"/root/code/shared-health-record/src/workflows/botswana/hl7Workflows.ts",["67","68","69","70","71"],[],"/root/code/shared-health-record/src/workflows/botswana/locationWorkflows.ts",[],[],"/root/code/shared-health-record/src/workflows/botswana/terminologyWorkflows.ts",["72","73","74","75","76","77","78","79","80","81"],[],{"ruleId":"82","severity":1,"message":"83","line":8,"column":7,"nodeType":"84","messageId":"85","endLine":8,"endColumn":11},{"ruleId":"86","severity":1,"message":"87","line":8,"column":7,"nodeType":"84","messageId":"85","endLine":8,"endColumn":11},{"ruleId":"88","severity":1,"message":"89","line":27,"column":70,"nodeType":"90","messageId":"91","endLine":27,"endColumn":73,"suggestions":"92"},{"ruleId":"88","severity":1,"message":"89","line":29,"column":21,"nodeType":"90","messageId":"91","endLine":29,"endColumn":24,"suggestions":"93"},{"ruleId":"82","severity":1,"message":"94","line":29,"column":26,"nodeType":"84","messageId":"85","endLine":29,"endColumn":44},{"ruleId":"86","severity":1,"message":"95","line":29,"column":26,"nodeType":"84","messageId":"85","endLine":29,"endColumn":44},{"ruleId":"82","severity":1,"message":"96","line":31,"column":3,"nodeType":"84","messageId":"85","endLine":31,"endColumn":12},{"ruleId":"86","severity":1,"message":"97","line":31,"column":3,"nodeType":"84","messageId":"85","endLine":31,"endColumn":12},{"ruleId":"88","severity":1,"message":"89","line":52,"column":19,"nodeType":"90","messageId":"91","endLine":52,"endColumn":22,"suggestions":"98"},{"ruleId":"82","severity":1,"message":"99","line":68,"column":9,"nodeType":"84","messageId":"85","endLine":68,"endColumn":19},{"ruleId":"86","severity":1,"message":"100","line":68,"column":9,"nodeType":"84","messageId":"85","endLine":68,"endColumn":19},{"ruleId":"88","severity":1,"message":"89","line":89,"column":19,"nodeType":"90","messageId":"91","endLine":89,"endColumn":22,"suggestions":"101"},{"ruleId":"88","severity":1,"message":"89","line":26,"column":19,"nodeType":"90","messageId":"91","endLine":26,"endColumn":22,"suggestions":"102"},{"ruleId":"103","severity":1,"message":"104","line":59,"column":12,"nodeType":"105","messageId":"106","endLine":59,"endColumn":46},{"ruleId":"103","severity":1,"message":"104","line":59,"column":12,"nodeType":"105","messageId":"106","endLine":59,"endColumn":38,"suggestions":"107"},{"ruleId":"103","severity":1,"message":"104","line":59,"column":12,"nodeType":"105","messageId":"106","endLine":59,"endColumn":25,"suggestions":"108"},{"ruleId":"88","severity":1,"message":"89","line":12,"column":37,"nodeType":"90","messageId":"91","endLine":12,"endColumn":40,"suggestions":"109"},{"ruleId":"82","severity":1,"message":"110","line":15,"column":24,"nodeType":"84","messageId":"85","endLine":15,"endColumn":34},{"ruleId":"86","severity":1,"message":"111","line":15,"column":24,"nodeType":"84","messageId":"85","endLine":15,"endColumn":34},{"ruleId":"88","severity":1,"message":"89","line":17,"column":39,"nodeType":"90","messageId":"91","endLine":17,"endColumn":42,"suggestions":"112"},{"ruleId":"82","severity":1,"message":"113","line":18,"column":13,"nodeType":"84","messageId":"85","endLine":18,"endColumn":26},{"ruleId":"86","severity":1,"message":"114","line":18,"column":13,"nodeType":"84","messageId":"85","endLine":18,"endColumn":26},{"ruleId":"88","severity":1,"message":"89","line":30,"column":36,"nodeType":"90","messageId":"91","endLine":30,"endColumn":39,"suggestions":"115"},{"ruleId":"88","severity":1,"message":"89","line":30,"column":50,"nodeType":"90","messageId":"91","endLine":30,"endColumn":53,"suggestions":"116"},{"ruleId":"88","severity":1,"message":"89","line":38,"column":21,"nodeType":"90","messageId":"91","endLine":38,"endColumn":24,"suggestions":"117"},{"ruleId":"88","severity":1,"message":"89","line":47,"column":21,"nodeType":"90","messageId":"91","endLine":47,"endColumn":24,"suggestions":"118"},{"ruleId":"88","severity":1,"message":"89","line":69,"column":32,"nodeType":"90","messageId":"91","endLine":69,"endColumn":35,"suggestions":"119"},{"ruleId":"88","severity":1,"message":"89","line":84,"column":21,"nodeType":"90","messageId":"91","endLine":84,"endColumn":24,"suggestions":"120"},{"ruleId":"88","severity":1,"message":"89","line":110,"column":21,"nodeType":"90","messageId":"91","endLine":110,"endColumn":24,"suggestions":"121"},{"ruleId":"103","severity":1,"message":"104","line":20,"column":21,"nodeType":"105","messageId":"106","endLine":20,"endColumn":37},{"ruleId":"88","severity":1,"message":"89","line":130,"column":11,"nodeType":"90","messageId":"91","endLine":130,"endColumn":14,"suggestions":"122"},{"ruleId":"88","severity":1,"message":"89","line":136,"column":13,"nodeType":"90","messageId":"91","endLine":136,"endColumn":16,"suggestions":"123"},{"ruleId":"88","severity":1,"message":"89","line":143,"column":29,"nodeType":"90","messageId":"91","endLine":143,"endColumn":32,"suggestions":"124"},{"ruleId":"88","severity":1,"message":"89","line":149,"column":54,"nodeType":"90","messageId":"91","endLine":149,"endColumn":57,"suggestions":"125"},{"ruleId":"88","severity":1,"message":"89","line":165,"column":50,"nodeType":"90","messageId":"91","endLine":165,"endColumn":53,"suggestions":"126"},{"ruleId":"88","severity":1,"message":"89","line":185,"column":60,"nodeType":"90","messageId":"91","endLine":185,"endColumn":63,"suggestions":"127"},{"ruleId":"82","severity":1,"message":"128","line":194,"column":16,"nodeType":"84","messageId":"85","endLine":194,"endColumn":29},{"ruleId":"86","severity":1,"message":"129","line":194,"column":16,"nodeType":"84","messageId":"85","endLine":194,"endColumn":29},{"ruleId":"88","severity":1,"message":"89","line":194,"column":60,"nodeType":"90","messageId":"91","endLine":194,"endColumn":63,"suggestions":"130"},"unused-imports/no-unused-vars","'util' is assigned a value but never used. Allowed unused vars must match /^_/u.","Identifier","unusedVar","@typescript-eslint/no-unused-vars","'util' is assigned a value but never used.","@typescript-eslint/no-explicit-any","Unexpected any. Specify a different type.","TSAnyKeyword","unexpectedAny",["131","132"],["133","134"],"'statusCode' is defined but never used. Allowed unused vars must match /^_/u.","'statusCode' is defined but never used.","'noCaching' is assigned a value but never used. Allowed unused vars must match /^_/u.","'noCaching' is assigned a value but never used.",["135","136"],"'requestUri' is assigned a value but never used. Allowed unused vars must match /^_/u.","'requestUri' is assigned a value but never used.",["137","138"],["139","140"],"@typescript-eslint/no-non-null-assertion","Forbidden non-null assertion.","TSNonNullExpression","noNonNull",["141"],["142"],["143","144"],"'err' is defined but never used. Allowed unused args must match /^_/u.","'err' is defined but never used.",["145","146"],"'start' is assigned a value but never used. Allowed unused vars must match /^_/u.","'start' is assigned a value but never used.",["147","148"],["149","150"],["151","152"],["153","154"],["155","156"],["157","158"],["159","160"],["161","162"],["163","164"],["165","166"],["167","168"],["169","170"],["171","172"],"'getOclConcept' is defined but never used. Allowed unused vars must match /^_/u.","'getOclConcept' is defined but never used.",["173","174"],{"messageId":"175","fix":"176","desc":"177"},{"messageId":"178","fix":"179","desc":"180"},{"messageId":"175","fix":"181","desc":"177"},{"messageId":"178","fix":"182","desc":"180"},{"messageId":"175","fix":"183","desc":"177"},{"messageId":"178","fix":"184","desc":"180"},{"messageId":"175","fix":"185","desc":"177"},{"messageId":"178","fix":"186","desc":"180"},{"messageId":"175","fix":"187","desc":"177"},{"messageId":"178","fix":"188","desc":"180"},{"messageId":"189","fix":"190","desc":"191"},{"messageId":"189","fix":"192","desc":"191"},{"messageId":"175","fix":"193","desc":"177"},{"messageId":"178","fix":"194","desc":"180"},{"messageId":"175","fix":"195","desc":"177"},{"messageId":"178","fix":"196","desc":"180"},{"messageId":"175","fix":"197","desc":"177"},{"messageId":"178","fix":"198","desc":"180"},{"messageId":"175","fix":"199","desc":"177"},{"messageId":"178","fix":"200","desc":"180"},{"messageId":"175","fix":"201","desc":"177"},{"messageId":"178","fix":"202","desc":"180"},{"messageId":"175","fix":"203","desc":"177"},{"messageId":"178","fix":"204","desc":"180"},{"messageId":"175","fix":"205","desc":"177"},{"messageId":"178","fix":"206","desc":"180"},{"messageId":"175","fix":"207","desc":"177"},{"messageId":"178","fix":"208","desc":"180"},{"messageId":"175","fix":"209","desc":"177"},{"messageId":"178","fix":"210","desc":"180"},{"messageId":"175","fix":"211","desc":"177"},{"messageId":"178","fix":"212","desc":"180"},{"messageId":"175","fix":"213","desc":"177"},{"messageId":"178","fix":"214","desc":"180"},{"messageId":"175","fix":"215","desc":"177"},{"messageId":"178","fix":"216","desc":"180"},{"messageId":"175","fix":"217","desc":"177"},{"messageId":"178","fix":"218","desc":"180"},{"messageId":"175","fix":"219","desc":"177"},{"messageId":"178","fix":"220","desc":"180"},{"messageId":"175","fix":"221","desc":"177"},{"messageId":"178","fix":"222","desc":"180"},{"messageId":"175","fix":"223","desc":"177"},{"messageId":"178","fix":"224","desc":"180"},"suggestUnknown",{"range":"225","text":"226"},"Use `unknown` instead, this will force you to explicitly, and safely assert the type is correct.","suggestNever",{"range":"225","text":"227"},"Use `never` instead, this is useful when instantiating generic type parameters that you don't need to know the type of.",{"range":"228","text":"226"},{"range":"228","text":"227"},{"range":"229","text":"226"},{"range":"229","text":"227"},{"range":"230","text":"226"},{"range":"230","text":"227"},{"range":"231","text":"226"},{"range":"231","text":"227"},"suggestOptionalChain",{"range":"232","text":"233"},"Consider using the optional chain operator `?.` instead. This operator includes runtime checks, so it is safer than the compile-only non-null assertion operator.",{"range":"234","text":"235"},{"range":"236","text":"226"},{"range":"236","text":"227"},{"range":"237","text":"226"},{"range":"237","text":"227"},{"range":"238","text":"226"},{"range":"238","text":"227"},{"range":"239","text":"226"},{"range":"239","text":"227"},{"range":"240","text":"226"},{"range":"240","text":"227"},{"range":"241","text":"226"},{"range":"241","text":"227"},{"range":"242","text":"226"},{"range":"242","text":"227"},{"range":"243","text":"226"},{"range":"243","text":"227"},{"range":"244","text":"226"},{"range":"244","text":"227"},{"range":"245","text":"226"},{"range":"245","text":"227"},{"range":"246","text":"226"},{"range":"246","text":"227"},{"range":"247","text":"226"},{"range":"247","text":"227"},{"range":"248","text":"226"},{"range":"248","text":"227"},{"range":"249","text":"226"},{"range":"249","text":"227"},{"range":"250","text":"226"},{"range":"250","text":"227"},{"range":"251","text":"226"},{"range":"251","text":"227"},[764,767],"unknown","never",[867,870],[1394,1397],[2451,2454],[873,876],[1833,1834],"?",[1820,1821],"?.",[396,399],[580,583],[981,984],[995,998],[1172,1175],[1478,1481],[2219,2222],[2716,2719],[3482,3485],[4056,4059],[4242,4245],[4521,4524],[4809,4812],[5262,5265],[5719,5722],[6042,6045]]
144 changes: 29 additions & 115 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ on:
workflow_dispatch:

env:
REGISTRY: ghcr.io
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
SHR_VERSION: ci
DOCKER_NAME: ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.repository }}

jobs:
unit-test:
Expand Down Expand Up @@ -47,123 +48,36 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
uses: actions/checkout@v4
-
# Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Change repo info to lowercase
id: string
uses: ASzc/change-string-case-action@v5
uses: docker/metadata-action@v5
with:
string: ${{ github.repository }}

- name: Get Package Version
id: package-version
uses: martinbeentjes/npm-get-version-action@main

- name: Check custom tag
run: echo ${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}}

- name: Build SHR
uses: docker/build-push-action@v3
images: ${{ env.DOCKER_NAME }}
-
name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
tags: ghcr.io/i-tech-uw/shared-health-record:ci
push: false
load: true
context: .
cache-from: type=gha
cache-to: type=gha,mode=max

# - name: Pull containers
# run: docker-compose pull shr-fhir openhim-core mongo-db newman kafka zookeeper

# - name: Cache containers
# uses: satackey/[email protected]
# continue-on-error: true

# - name: Start containers
# run: docker-compose up -d shr-fhir mongo-db openhim-core kafka zookeeper

# - name: Load openhim config
# run: docker-compose up -d openhim-config

# - name: Sleep for 60 seconds
# run: sleep 90s
# shell: bash

# - name: Display docker logs for openhim config
# run: docker-compose logs openhim-config

# - name: Run SHR image
# run: docker-compose up -d shr

# - name: Sleep for 30 seconds
# run: sleep 30s
# shell: bash

# - name: Show SHR Log
# run: docker-compose logs shr

# - name: Show kafka Log
# run: docker-compose logs kafka

# - name: Check openhim-core
# run: curl -sSk https://localhost:8080/heartbeat

# - name: Show containers
# run: docker-compose ps

# - name: Show OpenHIM Log
# run: docker-compose logs openhim-core

# # Postman Testing - see https://www.postman.com/itechuw/workspace/shared-health-record/
# - name: Run General Tests Collection
# env:
# POSTMAN_COLLECTION: /.postman/collections/1_general_tests.json
# run: docker-compose up -d newman

# - name: Run Laboratory Workflows Collection (collection/1525496-f28b488f-a40c-4723-8a72-a2b4f64bb5da)
# env:
# POSTMAN_COLLECTION: /.postman/collections/2_laboratory_workflows.json
# run: docker-compose up --exit-code-from newman newman
# continue-on-error: true

# - name: Run MLLP Tests
# run: docker-compose up --exit-code-from mllp_tests mllp_tests

# - name: Show SHR Log
# if: always()
# run: docker-compose logs shr

# - name: Show kafka Log
# if: always()
# run: docker-compose logs kafka

# - name: Stop containers
# if: always()
# run: docker-compose down

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Docker image
uses: docker/build-push-action@v3
if: github.event_name == 'release'
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }},${{ env.REGISTRY }}/${{ steps.string.outputs.lowercase }}:${{steps.package-version.outputs.current-version}}
push: ${{ github.event_name != 'pull_request' }}
load: ${{ github.event_name == 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=registry,ref=${{github.repository}}:latest
cache-to: type=inline
2 changes: 2 additions & 0 deletions config/config_docker.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"cielSystemUrl": "https://openconceptlab.org/orgs/CIEL/sources/CIEL",
"loincSystemUrl": "https://api.openconceptlab.org/orgs/Regenstrief/sources/LOINC/",
"omangSystemUrl": "http://moh.bw.org/ext/identifier/omang",
"brdsSystemUrl": "http://moh.bw.org/ext/identifier/bcn",
"immigrationSystemUrl": "http://moh.bw.org/ext/identifier/passportno",
"oclUrl": "https://api.openconceptlab.org",
"facilityCodeSystemUrl": "http://moh.bw.org/ext/identifier/facility-code",
"ipmsProviderSystemUrl": "http://moh.bw.org/ext/ipms-provider",
Expand Down
Loading