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

Add temperature change card in site dashboard #1046

Merged
merged 14 commits into from
Oct 31, 2024
Merged

Conversation

K-Markopoulos
Copy link
Collaborator

@K-Markopoulos K-Markopoulos commented Oct 25, 2024

Issue #1022

Add 7-days temperature change card in place of Buoy Observation card when site doesn't have a spotter.

  • Calculate the change based on satelliteTemperature from site's dailyData: avg of 7 last days minus avg of 8-14 days back
  • Calculate the avg temp of the last 7 days.

image

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

⚠️ This pull request was not sent to the PullRequest network because the pull request is a draft.

Copy link

github-actions bot commented Oct 25, 2024

Build succeeded and deployed at https://aqualink-app-1046.surge.sh
(hash f356dfd deployed at 2024-10-31T10:15:20)

@@ -42,7 +43,7 @@ import Map from './Map';
import SketchFab from './SketchFab';
import FeaturedMedia from './FeaturedMedia';
import Satellite from './Satellite';
import Sensor from './Sensor';
// import Sensor from './Sensor';
Copy link
Member

Choose a reason for hiding this comment

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

Note that we still want to display the Sensor card when there is a spotter/buoy with live data for that site

@Caesarh97
Copy link
Collaborator

Hi @K-Markopoulos,

I think many of the changes look great. However, I'd like to add some more information about the card. We would like the number in color to be calculated by the past 7 days compared to the 7 days before that. As Eric mentioned, this card should be shown if there's no buoy data available. If a site has water quality data and no buoy, we should still display the heat stress card together with the water quality card like before. I think we would want to show the temperature and one decimal number (ex. 22.6°C, just like you've done in the example).

I think this calculation would be the most accurate to calculate the past 7 days compared to the 7 days before that.
(sum of most recent 7 days) / 7 = (average temp for past 7 days)
(Sum of past 14-8 days / 7 = (average temp for past 14-8 days)
(average temp for past 7 days) - (average temp for past 14-8 days) = average 7-day change in temperature for the past 7 days compared to the previous 7 days.

Example:
Past 14 days (Day 14 - Day 1. Left to right)
23, 24, 26, 22, 19, 20, 24, 22, 25, 26, 25, 23, 23, 22
(Sum of 22, 25, 26, 25, 23, 23, 22) / 7 = 23.7 (average most recent 7 days)
(Sum of 23, 24, 26, 22, 19, 20, 24) / 7 = 22.6 (average past 14-8 days)
23.7-22.6=1.1
The average 7-day change in temperature for the past 7 days compared to the previous 7 days is 1.1°C.

@K-Markopoulos
Copy link
Collaborator Author

@Caesarh97 Thanks for the detailed explanation, I've updated the logic. Please let me know if anything seems off.

@K-Markopoulos K-Markopoulos marked this pull request as ready for review October 30, 2024 13:08
Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

✅ This pull request was sent to the PullRequest network for review. Expert reviewers are now being matched to your request based on the code's requirements. Stay tuned!

What to expect from this code review:
  • Comments posted to any areas of potential concern or improvement.
  • Detailed feedback or actions needed to resolve issues that are found.
  • Turnaround times vary, but we aim to be swift.

@K-Markopoulos you can click here to see the review status or cancel the code review job.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest Breakdown

Reviewable lines of change

+ 944
- 411

83% Jest Snapshot (tests)
13% TSX
4% TSX (tests)
1% TypeScript

Generated lines of change

+ 1
- 0

Type of change

Feature - These changes are adding a new feature or improvement to existing code.

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

I have no concerns with this pull request, security or otherwise.

Image of Jacob Jacob


Reviewed with ❤️ by PullRequest

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest reviewed the updates made to #1046 up until the latest commit (13fcbf8). No further issues were found.

Reviewed by:

Image of Jacob Jacob

Copy link

@pullrequest pullrequest bot left a comment

Choose a reason for hiding this comment

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

PullRequest reviewed the updates made to #1046 up until the latest commit (cfc9aa6). No further issues were found.

Reviewed by:

Image of Jacob Jacob

@Caesarh97
Copy link
Collaborator

Caesarh97 commented Oct 30, 2024

@K-Markopoulos That looks great! Thank you!

@ericboucher ericboucher merged commit 24dfd66 into master Oct 31, 2024
3 checks passed
@ericboucher ericboucher deleted the temperature-card branch October 31, 2024 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants