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

feat(client): add fhircast{Publish, Subscribe, Connect} #3024

Merged
merged 35 commits into from
Oct 14, 2023

Conversation

ThatOneBro
Copy link
Member

@ThatOneBro ThatOneBro commented Oct 12, 2023

What this PR does

  • Adds fhircastSubscribe() to MedplumClient to subscribe to a topic
  • Adds fhircastUnsubscribe() to MedplumClient to unsubscribe from a topic
  • Adds fhircastConnect() to MedplumClient to connect to a topic's WebSocket endpoint
  • Adds fhircastPublish() to MedplumClient for publishers to publish events to a topic
  • Adds FhircastConnection class for managing a FHIRcast WebSocket connection
  • Adds tests for functions in core/src/fhircast
  • Fixes a bunch of occurences of useState<T | undefined>, which for complex types can lead to a @typescript-eslint error (https://typescript-eslint.io/rules/no-redundant-type-constituents/)
  • Closes Add fhircastPublish and fhircastSubscribe to MedplumClient #2998

TODO:

  • Add tests for createFhircastMessagePayload()
  • Add tests for fhircastSubscribe()
  • Add tests for fhircastConnect()
  • Add tests for fhircastPublish()
  • Add tests for fhircastUnsubscribe()
  • Remove hack to get crypto.randomUUID() to work in jest-jsdom-environment

@sweep-ai
Copy link
Contributor

sweep-ai bot commented Oct 12, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@vercel
Copy link

vercel bot commented Oct 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
medplum-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2023 3:52am
medplum-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 14, 2023 3:52am

@ThatOneBro ThatOneBro self-assigned this Oct 12, 2023
@ThatOneBro ThatOneBro added this to the November 1, 2023 milestone Oct 12, 2023
@ThatOneBro ThatOneBro added subscriptions Features and fixes related to subscriptions self-host Features and fixes related to self hosting labels Oct 12, 2023
@coveralls
Copy link

Coverage Status

coverage: 93.726% (-0.1%) from 93.852% when pulling 9c19c4f on derrick-add-client-fhircast-pub-sub into 207c2e8 on main.

Copy link
Member

@codyebberson codyebberson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, lgtm 👍

A couple small things if you want to:

  1. I think you can replace satisfies PendingSubscriptionRequest as PendingSubscriptionRequest with just as PendingSubscriptionRequest
  2. See the Sonar issue on removing ISOTimestamp: https://sonarcloud.io/project/issues?pullRequest=3024&open=AYshku8gkpT7zR4ZNmCP&id=medplum_medplum

I know it's a little weird to use string for date/times, but we do it all over the place for FHIR compliance. We're not getting much (any?) additional type safety from ISOTimestamp, so I would recommend removing it.

@sonarcloud
Copy link

sonarcloud bot commented Oct 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

93.6% 93.6% Coverage
0.0% 0.0% Duplication

@ThatOneBro ThatOneBro added this pull request to the merge queue Oct 14, 2023
Merged via the queue into main with commit 7d69dbe Oct 14, 2023
14 checks passed
@ThatOneBro ThatOneBro deleted the derrick-add-client-fhircast-pub-sub branch October 14, 2023 04:48
codyebberson added a commit that referenced this pull request Oct 14, 2023
Fixed version mismatch in package-lock.json
feat(client): add `fhircast{Publish, Subscribe, Connect}` (#3024)
More details in slack message on deploy (#3035)
Client Chart Example (#2999)
Fixes #3032 - send slack message on deploy and publish (#3034)
Fix primitive extensions on choice types (#3033)
Add documentation for representing prescriptions and medication orders (#2807)
Test against multiple Postgres versions (#3026)
Handle search on numeric array columns (#3022)
Health Gorilla order form update (#3023)
Updated compliance logos (#3021)
Merge schema/validation systems (#2859)
feat(server/bullmq): remove all finalized jobs by default (#3014)
Remove barrel files (#3016)
Fixes #2955 - aws lambda client retry policy (#2986)
Filter ClientApplication resources in Apps tab (#3013)
feat(fhircast-demo): add auth story to demo (#2997)
Fixes #2987 Fixes #2988 - use HumanName.text (#2989)
Fixes #2984 - handle invalid UUID in _id search param (#2985)
Update Health Gorilla demo to order multiple tests (#2980)
Fixes #1307 Fixes #2963 Fixes #2969 - binary data docs (#2982)
Gracefully error on invalid JWT in client assertion flow (#2983)
Refresh session profile if not present in client (#2978)
replacing bookmark name string #2979 (#2981)
Limit SQL subqueries for existence checking (#2976)
QuestionnaireForm style tweaks (#2975)
DiagnosticReportDisplay - only show specimen data if present (#2974)
Add `FHIRcast` client example (#2965)
Fixes #2971 - update Questionnaire reference inputs (#2973)
github-merge-queue bot pushed a commit that referenced this pull request Oct 15, 2023
* Fixed version mismatch in package-lock.json

* Release Version 2.1.5

Fixed version mismatch in package-lock.json
feat(client): add `fhircast{Publish, Subscribe, Connect}` (#3024)
More details in slack message on deploy (#3035)
Client Chart Example (#2999)
Fixes #3032 - send slack message on deploy and publish (#3034)
Fix primitive extensions on choice types (#3033)
Add documentation for representing prescriptions and medication orders (#2807)
Test against multiple Postgres versions (#3026)
Handle search on numeric array columns (#3022)
Health Gorilla order form update (#3023)
Updated compliance logos (#3021)
Merge schema/validation systems (#2859)
feat(server/bullmq): remove all finalized jobs by default (#3014)
Remove barrel files (#3016)
Fixes #2955 - aws lambda client retry policy (#2986)
Filter ClientApplication resources in Apps tab (#3013)
feat(fhircast-demo): add auth story to demo (#2997)
Fixes #2987 Fixes #2988 - use HumanName.text (#2989)
Fixes #2984 - handle invalid UUID in _id search param (#2985)
Update Health Gorilla demo to order multiple tests (#2980)
Fixes #1307 Fixes #2963 Fixes #2969 - binary data docs (#2982)
Gracefully error on invalid JWT in client assertion flow (#2983)
Refresh session profile if not present in client (#2978)
replacing bookmark name string #2979 (#2981)
Limit SQL subqueries for existence checking (#2976)
QuestionnaireForm style tweaks (#2975)
DiagnosticReportDisplay - only show specimen data if present (#2974)
Add `FHIRcast` client example (#2965)
Fixes #2971 - update Questionnaire reference inputs (#2973)

* Fixed cyclonedx dep

* Fixed merge conflict
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-host Features and fixes related to self hosting subscriptions Features and fixes related to subscriptions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add fhircastPublish and fhircastSubscribe to MedplumClient
3 participants