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

[O2B-1365] Implement GAQ periods views #1808

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

xsalonx
Copy link
Collaborator

@xsalonx xsalonx commented Dec 3, 2024

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • NA

Notable changes for developers:

  • Implement stored SQL views for selecting GAQ periods and summaries information

Changes made to the database:

  • NA

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 43.60%. Comparing base (ae0db5f) to head (86cb1fc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...erver/services/qualityControlFlag/QcFlagService.js 91.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
- Coverage   43.79%   43.60%   -0.19%     
==========================================
  Files         893      893              
  Lines       15951    15964      +13     
  Branches     3002     3013      +11     
==========================================
- Hits         6985     6961      -24     
- Misses       8966     9003      +37     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@xsalonx xsalonx changed the title [O2B-1365] Implement GAQ periods and summeries views [O2B-1365] Implement GAQ periods views Dec 3, 2024
@xsalonx xsalonx requested a review from martinboulais December 4, 2024 11:36
UNION
( ${SELECT_RUNS_TO_TIMESTAMPS_FOR_GAQ_PERIODS} )
UNION
-- Two selectes for timestamps of QC flags' effective periods
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
-- Two selectes for timestamps of QC flags' effective periods
-- Two selects for timestamps of QC flags' effective periods

Simple typo

Comment on lines +66 to +71
NTH_VALUE(timestamp, 2) OVER (
PARTITION BY data_pass_id,
run_number
ORDER BY ap.ordering_timestamp
ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING
) AS \`to\`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This kind of function are relatively rarely used (in my experience), it might be useful to put a small comment stating what you are doing here?
Also, maybe you can replace the NTH_VALUE and ROWS BETWEEN... by the LAG function? You might need to reverse the order, not sure

gaq_periods.\`from\`,
gaq_periods.\`to\`;
SELECT * FROM gaq_periods
WHERE IF(gaq_periods.\`to\` = UNIX_TIMESTAMP(NOW(3)), null, gaq_periods.\`to\`) IS NOT NULL
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I am correct, you do not need the if anymore?

1,
null
),
SUM(
COALESCE(effectivePeriods.\`to\`, UNIX_TIMESTAMP(run.time_end))
- COALESCE(effectivePeriods.\`from\`, UNIX_TIMESTAMP(run.time_start))
COALESCE(gaq_periods.\`to\`, UNIX_TIMESTAMP(run.time_end))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure, but I think here what you should use is rct_time_start and rct_time_end. I created a PR here: #1816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants