Skip to main content

setup-notes

.env File Backup

MEDPLUM_BASE_URL=http://localhost:8103/ MEDPLUM_CLIENT_ID= GOOGLE_CLIENT_ID=705265833508-emhk0k9fuuakpaarj0rp81uql03pqlvn.apps.googleusercontent.com GOOGLE_CLIENT_SECRET=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 // Recaptcha v2 RECAPTCHA_SITE_KEY=6LfVGTYnAAAAAD4lCtgx8VqJGYc1kH7qih2OGf93 RECAPTCHA_SECRET_KEY=6LfVGTYnAAAAAJgxIth26cy3txOylZirlQsOIPIh MEDPLUM_REGISTER_ENABLED=true

v3 reCAPTCHA SITE_KEY=6LdBKjYnAAAAAKOE_QaBQRb7_6yd8Tv-PKRoe8WX SECRET_KEY=6LdBKjYnAAAAAOZ-oVXibuyVcwSM0kLXTlI-QIf6

Config & Install React Components

  • need to build React components (using npm run build in packages/React)
  • Install local React components in package.json npm install --save ../../packages/react
  • Install additional MedPlum Client Dependencies npm install --save @medplum/core @medplum/definitions @medplum/fhirtypes @medplum/mock

Setup External Services

AWS Simple Email Service (SES) https://us-west-2.console.aws.amazon.com/ses/home?region=us-west-2#/verified-identities/bnapora%40insynthion.com?tabId=authentication

  • Use configured email address in medplum.config.json setup file

Google Auth Instructions: https://refine.dev/blog/nextauth-google-github-authentication-nextjs/#for-googleprovider-make-sure-you-have-a-google-account

Recaptcha https://www.google.com/recaptcha/admin/site/657861185

Invite User

{"resourceType": "Practitioner","firstName": "Brian","lastName": "Napopra","email": "bnapora@insynthion.com", "membership": {"admin": true}}

curl 'http://localhost:3000/admin/projects/b13cbbb5-ac04-4247-8759-96153c64f53b/invite' \
-H 'Authorization: Bearer ${accessToken}' \
-H 'Content-Type: application/json' \
--data-raw `{"resourceType": "Practitioner","firstName": "Brian","lastName": "Napopra","email": "bnapora@insynthion.com","membership": {"admin": true}}`
  • Errored with "resourceType"
  • CAn't invite user because can't send email SES FIXED - modified email routine (and config) to use different SES credentials

Synthetic FHIR Data

https://synthea.mitre.org/downloads

FHIR Data Resources

FHIR Github - tools for FSH: https://github.com/FHIR VSCode Extenstion to create FSH and convert to FHIR with SUSHI: https://github.com/standardhealth/vscode-language-fsh FSHSchool - online FSH -> FHIR converter: https://fshschool.org/

DiagnosticReport Pathology Specs & Samples

https://developer.nhs.uk/apis/itk3nationalpathology-1-1-0/ https://hl7.org/fhir/us/cancer-reporting/STU1/DiagnosticReport-pathology-diagnostic-report.json.html

Items to Research (07/19/23) [] Running Bots locally [] Create Task linked to Diagnostic Report and Image

Code Discovery

Table/Lists - component is "SearchControl" in React repo

Resource Edit Page - used to change values of a resource EditPage.tsx; Uses ResourceForm.tsx to render all field controls

Whole Slide Image FHIR Resource Structure (073123)

ServiceRequest --> DiagnosticReport --> Observation --> (if DICOM) --> ImagingStudy (else) --> Media

Merge steps to keep code in sync with upstream (120623)

  1. Merge upstream medplum repo into main branch of medplum-path repo
  2. In develop branch run git fetch
  3. Run git merge origin/main
  4. Run git push

Setup Steps from new repo (120723)

  • created new docker-compose file to include DB volume
  • copy in current packages/server/medplum.config.json
  • modify 'pacakage.json' in custom apps to point to medplum modules in packages dir (file:../../packages/react)

Customizations

  1. packages/server/src/auth/me.ts - provides menu items for left side nav
  2. packages/react/src/Logo - changes to Gestalt SVG image

CLI Useage

medplum login
--auth-type "basic"
--base-url "http://localhost:8103"
--fhir-url-path "/fhir/R4"
--client-id "dea997cc-8954-4787-a193-d2450f86009e"
--client-secret "cfdacdb6e518f9f439463d24baf2fde5234407ddbd70573a254cc4e76c3b49a2"

  • tested retrieving a patient and seemed to work after running medplum login command above medplum get --base-url http://localhost:8103 'Patient/628f2bbb-865b-4ef6-935d-7d6ac3ea3493'

  • Login against GCP-poc1 medplum login
    --auth-type "basic"
    --base-url "https://app.poc1.gestaltcloud.com/v1.0"
    --fhir-url-path "fhir/R4"
    --client-id "102d2a8b-0f1a-4e16-8c52-3e74fd142de6"
    --client-secret "be85c5143a54ecaecc91b2f24df05e617fe6418a18d2132faced43ab255caef72"

  • Login GCP-POC1: PathCloud-POC1 Project medplum login
    --auth-type "basic"
    --base-url "https://app.poc1.gestaltcloud.com/v1.0"
    --fhir-url-path "fhir/R4"
    --client-id "98e0ce62-0937-4133-ae97-849497229a0f"
    --client-secret "4ef75d76b85b6f286780cc4392275deb486256d32535d1466c410db5720fa403"

Configure compose file with all services and applications (011124)

  1. Create compose application docker-compose.path.yml
  • Configure GCP VM
  1. Install docker

IMPORTANT NOTE - Medplum Applications (Admin, etc) can't authenticate to Medplum Server when app is using an IP address, needs Fully Qualified Domain Name with SSL (eg. apps.poc1.gestaltcloud.com)

  • when deploying to cloud host, need to make sure have DNS

IMPORTANT NOTE - was unable to reuse Medplum DB in a Volume, when DB image that created db was deleted. Had to create new DB using Medplum create script. (012824)

Setup Google Auth

  • use https://www.medplum.com/docs/auth/methods/google-auth
  • need to make sure both
  • need to add googleClientId and googleClientSecret to Medplum Project "Site" before auth will work
  • in Google Auth credentials config, need to make sure Javascript origins and authorized redirect URI's are populated with correct domain

No GPU mlworkspace (Used for GCP PathCloud VM) (011124)

docker run -d -p 8080:8080 -p 8001:8001 --env WORKSPACE_AUTH_USER="admin" --env WORKSPACE_AUTH_PASSWORD="G3st@lt12345" --name "mlworkspace" --privileged -v "/mnt/datadrive/workspace:/workspace" -v "/:/host_Root" -v "/var/run/docker.sock:/var/run/docker.sock" --restart always mltooling/ml-workspace-minimal:latest

Setup Dev Environment with PATHCLOUD_FULL repo

  1. clone repo to desired project location (eg. pathcloud-full)https://gestaltdiagnostics.visualstudio.com/Gestalt%20PathCloud/_git/PathCloud-Full
  2. clone additional project repos: viewers-ohif (see readme in /app-containers)
  3. run npm ci at project root

Update/Reinstall project dependencies and monorepo (03/15/24)

  1. Run sudo npm run clean at project root
  2. Delete package-lock.json at project root
  3. Run sudo npm install at project root
  • may need to run sudo npm install --legacy-peer-deps -D
  1. Run sudo npm run build:fast at project root
  • If still have issues, may need to remove ALL node_modules folder

Remove ALL node_modules folders (022124)

Install npkill: npm i -g npkill Remove Folders: npx npkill

Merge in upstream Medplum repo

  • this can be done. Successfully merged
  1. Configure Medplum as "upstream" repo in vscode (https://github.com/medplum/medplum)
  2. Create a branch from PathCloud "develop" branch
  3. Create a branch from Medplum current version
  4. Merge Medplum branch into PathCloud branch
git fetch origin master
git checkout master
git merge --allow-unrelated-histories myfunnybranch

New App config for Turbo Monorepo (022924)

PathCloud Configuration (after Medplum running) (02/22/24)

  1. Login with admin@example.com (PWD: medplum_admin)
  2. Change default admin@example.com password
  3. Create PathCloud parent project PathCloud-[instance]
    1. Features Enabled: bots, email, terminology
  4. Add "Site" to enable Google Auth
    1. Configure Name, Domain, Google Client ID, Google Secret
  5. Add additional Admin Users
    1. Create User, add project membership
  6. Configure .env file: MEDPLUM_PROJECT_ID with GUID for PathCloud-[instance]
  • ProjectId is used to auto-create Users
  1. Configure Bot: DICOMStore-Webhook-BigQuery in "PathCloud-[instance]"
  • Used for synchronize DICOMStore to FHIRStore
    1. Configure: Name, Description, Runtime Version
      1. Name: Bot - Create Patient-DiagnosticReport-ImagingStudy
      2. Runtime Version: vmcontext
    2. Copy code from botcode.ts in apps/bots/src/gcp-dicomstore-webhook-bigquery
  1. Configure ClientApplication for Bot
  1. Configre ProjectMembership linking Bot and ClientApplication
  • Important step! Webhook will not work if not completed
    1. Required settings must be provided
    2. User - ClientApplication - needs to be ClientApp created for Bot
    3. Profile - Bot -needs to "profile" of Bot
    4. Do not need to give "Admin" permission
  1. Configure app.js in webhook-container folder with ClientID and Secret
    1. Deploy webhook-container to GCP CloudRun using instructions in README in that folder
  2. Configure ClientApplication for authentication of user in worklist (eg ClientApplication - Default Auth Credentials)
    • Project: PathCloud-[environment]
    • env values in .env: PATHCLOUD_PROJECT_CLIENT_ID, PATHCLOUD_PROJECT_CLIENT_SECRET
    • TODO: auth not working (022324) - adding Subscriptions
  3. Configure ClientApplication for auth of Bot - Create New Practitioner
    • used in "Bot - Create New Practitioner..."" code to authenticate for initial user creation
    • Create in Project: Super Admin (Very Important!)
    • Name: ClientApplication - Create New Practitioner-[env]
    • ProjectMembership: can use default membership created with ClientApplication - change to Admin
  4. Configure Bot for "New Practitioner" creation routine
    • Create in Project: PathCloud-[envrionment]
    • Name: Bot - Create New Practitioner_[environment]
    • Runtime Version: vmcontext
    1. ProjectMembership - can use default membership in PathCloud-[env] - change to Admin
    2. Copy Bot code from /apps/bots/src/create-practitioner-subs-user/botcode.ts
    3. Modify client_id and client_secret constants with values from "ClientApplication - Bot - Auth_PathCloud-[env]"
    4. Click "Save" and "Deploy" in Bot Editor
  5. Configure Subscription for User/Practitioner/Project creation routine
    • Create in Project: PathCloud-[environment]
    • Users will be created with ProjectId supplied in .env; The Subscription must be in the same project.
    • Reason: Create New Practitioner Bot - [environment]
    • Criteria: User
    • Add "extension" to restrict subscriptions to only "CREATE" messages (if not copying json from bot folder)

Get $Everything for a Patient (042924)

  • Login GCP-POC1: PathCloud-POC1 Project medplum login
    --auth-type "basic"
    --base-url "https://app.poc1.gestaltcloud.com/v1.0"
    --fhir-url-path "fhir/R4"
    --client-id "98e0ce62-0937-4133-ae97-849497229a0f"
    --client-secret "4ef75d76b85b6f286780cc4392275deb486256d32535d1466c410db5720fa403"
  • Run command for Giuseppe Gestalt medplum get --base-url https://app.poc1.gestaltcloud.com/v1.0/ 'Patient/315dcab3-fb93-4a2e-9fcb-d70471511060/$everything' > patient_everything.json

Upgrade PathCloud to Medplum3.1.8 (061124)

  1. Configure Medplum as "upstream" repo in vscode (https://github.com/medplum/medplum)
  2. Create a branch from PathCloud "develop" branch
  3. Create a branch from Medplum current version
  4. Merge Medplum branch into PathCloud branch

git fetch origin Feature2409-UpgradePathCloud-to-Medplum3.1.8 git checkout Feature2409-UpgradePathCloud-to-Medplum3.1.8 git merge --allow-unrelated-histories upstream/main

  • if issues can run git merge --abort before a COMMIT

Customizations

  1. packages/server/src/auth/google.ts - modification to projectId for custom Google auth (line 114)
  2. packages/react/src/Logo - changes to Gestalt SVG image
  3. packages/server/src/auth/me.ts - provides menu items for left side nav
  4. add dependency to meplum-server - "@google-cloud/bigquery": "7.7.1",

NPM Install (061124)

  • need to update dependencies in app-admin and app-pathcloud apps before running NPM install otherwise get and MantineProvider was not found in component tree, make sure you have it in your app error when attempting to run the app.
  • removing all node_module folder, deleting packag-lock.json, and reinstall node modules seems to fix issue

Launch Stack with Docker Local

docker compose -f docker-compose.pathcloud.yml --profile=medplum --profile=applications --profile=nginx --profile=orthanc --profile=viewers up app-pathcloud -d --build

Testing/Developing Subscription Webhooks Bots