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(ResourceTimeline): add support for notes on ResourceTimeline #2756

Closed
wants to merge 8 commits into from

Conversation

ThatOneBro
Copy link
Member

@ThatOneBro ThatOneBro commented Aug 30, 2023

Background

There are a few Resource types which have a note property. Currently the notes from this note property only show up in the parent resource in the timeline view.

As described in #2715, we want to be able to add the notes on these resources such as Specimen or Observation to the ResourceTimeline as a separate entry, sorted into the timeline based on when the note was recorded.

What this PR does

Screen Shot 2023-08-30 at 5 47 31 PM

Notes about changes

There were are few things about this issue that made it a little more difficult than originally thought at first glance:

  1. ResourceTimeline expected items to be Resources
  2. Sorting items in the timeline relied on a sorting function sortByDateAndPriority() which deals with sorting Resources based on different fields and whether a resource is marked with a special priority. This makes it a bit tricky to sort notes which wouldn't have some of these fields necessarily and aren't shaped like Resources.

The solution was to make ResourceTimeline generic on items which implement an interface TimeSortable which guarantees a datatype is a Resource or has a time property with a date string. We then created a sortByDateAndPriorityGeneric() which can sort these objects alongside resources. In the future, if needed, more logic can be added to extract different fields from Resources and put them and sort them in the timeline as well.

@ThatOneBro ThatOneBro requested a review from a team as a code owner August 30, 2023 23:57
@vercel
Copy link

vercel bot commented Aug 30, 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 Aug 31, 2023 5:58am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
medplum-www ⬜️ Ignored (Inspect) Visit Preview Aug 31, 2023 5:58am

@coveralls
Copy link

coveralls commented Aug 31, 2023

Coverage Status

coverage: 94.182% (-0.03%) from 94.209% when pulling 62958ca on derrick-add-notes-to-timeline into d97e0d4 on main.

@reshmakh reshmakh added this to the August 31, 2023 milestone Aug 31, 2023
@reshmakh reshmakh added the react Features, fixes and enhancements to react component library label Aug 31, 2023
@sonarcloud
Copy link

sonarcloud bot commented Aug 31, 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 8 Code Smells

89.1% 89.1% Coverage
0.0% 0.0% Duplication

@ThatOneBro ThatOneBro marked this pull request as draft September 1, 2023 18:14
@ThatOneBro
Copy link
Member Author

Closing this one for now after talking about product direction for the React component suite. This seems like it may be a bit too opinionated as is but we may come back to this later

@ThatOneBro ThatOneBro closed this Sep 11, 2023
@codyebberson codyebberson deleted the derrick-add-notes-to-timeline branch September 28, 2023 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
react Features, fixes and enhancements to react component library
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Add Notes to the timeline view
3 participants