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 buildin 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/
- also has a FHIR/FSH tutorial: https://fshschool.org/courses/fsh-seminar/ PlantUML - used for diagraming
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
- see FHIR link: https://www.hl7.org/fhir/R4/diagnostics-module.html
Merge steps to keep code in sync with upstream (120623)
- Merge upstream medplum repo into
mainbranch of medplum-path repo - In
developbranch rungit fetch - Run
git merge origin/main - 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
packagesdir (file:../../packages/react)
Customizations
- packages/server/src/auth/me.ts - provides menu items for left side nav
- 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 logincommand 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)
- Create compose application
docker-compose.path.yml
- Configure GCP VM
- 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
- clone repo to desired project location (eg.
pathcloud-full)https://gestaltdiagnostics.visualstudio.com/Gestalt%20PathCloud/_git/PathCloud-Full - clone additional project repos:
viewers-ohif(see readme in /app-containers) - run
npm ciat project root
Update/Reinstall project dependencies and monorepo (03/15/24)
- Run
sudo npm run cleanat project root - Delete
package-lock.jsonat project root - Run
sudo npm installat project root
- may need to run
sudo npm install --legacy-peer-deps -D
- Run
sudo npm run build:fastat 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
- Configure Medplum as "upstream" repo in vscode (https://github.com/medplum/medplum)
- Create a branch from PathCloud "develop" branch
- Create a branch from Medplum current version
- 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)
- need to add any new root level folders to root package.json to be included in monorepo. (eg. Add "apps" directory)
- https://turbo.build/repo/docs/handbook/workspaces
PathCloud Configuration (after Medplum running) (02/22/24)
- Login with admin@example.com (PWD: medplum_admin)
- Change default admin@example.com password
- Create PathCloud parent project
PathCloud-[instance]- Features Enabled: bots, email, terminology
- Add "Site" to enable Google Auth
- Configure Name, Domain, Google Client ID, Google Secret
- Add additional Admin Users
- Create User, add project membership
- Configure
.envfile: MEDPLUM_PROJECT_ID with GUID for PathCloud-[instance]
- ProjectId is used to auto-create Users
- Configure Bot: DICOMStore-Webhook-BigQuery in "PathCloud-[instance]"
- Used for synchronize DICOMStore to FHIRStore
- Configure: Name, Description, Runtime Version
- Name: Bot - Create Patient-DiagnosticReport-ImagingStudy
- Runtime Version:
vmcontext
- Copy code from
botcode.tsin apps/bots/src/gcp-dicomstore-webhook-bigquery
- Configure: Name, Description, Runtime Version
- Configure
ClientApplicationfor Bot
- Used to give access to Bot in webhook
- https://www.medplum.com/docs/bots/consuming-webhooks
- Need ClientID and ClientSecret for Webhook
https://<client-application-id>:<client-secret>@api.medplum.com/fhir/R4/Bot/<bot-id>/$execute
- Configre
ProjectMembershiplinking Bot and ClientApplication
- Important step! Webhook will not work if not completed
- Required settings must be provided
- User - ClientApplication - needs to be ClientApp created for Bot
- Profile - Bot -needs to "profile" of Bot
- Do not need to give "Admin" permission
- Configure app.js in
webhook-containerfolder with ClientID and Secret- Deploy webhook-container to GCP CloudRun using instructions in README in that folder
- Configure
ClientApplicationfor 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
- Configure
ClientApplicationfor 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
- Configure
Botfor "New Practitioner" creation routine- Create in Project: PathCloud-[envrionment]
- Name: Bot - Create New Practitioner_[environment]
- Runtime Version: vmcontext
- ProjectMembership - can use default membership in PathCloud-[env] - change to Admin
- Copy Bot code from /apps/bots/src/create-practitioner-subs-user/botcode.ts
- Modify
client_idandclient_secretconstants with values from "ClientApplication - Bot - Auth_PathCloud-[env]" - Click "Save" and "Deploy" in Bot Editor
- Configure
Subscriptionfor 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)
- Configure Medplum as "upstream" repo in vscode (https://github.com/medplum/medplum)
- Create a branch from PathCloud "develop" branch
- Create a branch from Medplum current version
- 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 --abortbefore a COMMIT
Customizations
- packages/server/src/auth/google.ts - modification to projectId for custom Google auth (line 114)
- packages/react/src/Logo - changes to Gestalt SVG image
- packages/server/src/auth/me.ts - provides menu items for left side nav
- 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 apperror 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
- sample endpoint testing: https://pipedream.com/sources/dc_qQuDzQG
- Use Pipedream endpoint to validate subscription is transmitting -https://www.medplum.com/docs/subscriptions/publish-and-subscribe