Skip to content

Signal Documentation Coverage Endpoint #1584

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

Merged
merged 30 commits into from
Feb 3, 2025
Merged

Signal Documentation Coverage Endpoint #1584

merged 30 commits into from
Feb 3, 2025

Conversation

nolangormley
Copy link
Contributor

@nolangormley nolangormley commented Jan 27, 2025

addresses issue(s) #1583

Summary:

Create a new endpoint that returns a list of signals when given a geo. There were other endpoints that did this in the past, but the tables they read from are no longer around in epi v4. Starting from scratch will be much quicker and rely less on legacy code.

Once this is merged, I will also make issues to delete the old coverage code so that we don't have duplicate endpoints.

Prerequisites:

  • Unless it is a documentation hotfix it should be merged against the dev branch
  • Branch is up-to-date with the branch to be merged with, i.e. dev
  • Build is successful
  • Code is cleaned up and formatted

@nolangormley
Copy link
Contributor Author

Proposed SQL for this endpoint

CREATE TABLE coverage_crossref (
    signal_key_id bigint NOT NULL,
    geo_key_id bigint NOT NULL,
    min_time_value int NOT NULL,
    max_time_value int NOT NULL
)
SELECT
    el.signal_key_id,
    el.geo_key_id,
    MIN(el.time_value) as min_time_value,
    MAX(el.time_value) as max_time_value
FROM epimetric_latest el
GROUP BY el.signal_key_id, el.geo_key_id;

CREATE INDEX coverage_crossref_signal_key_id ON coverage_crossref (signal_key_id);
CREATE INDEX coverage_crossref_geo_key_id ON coverage_crossref (geo_key_id);


CREATE VIEW coverage_crossref_v AS
SELECT
    sd.source,
    sd.signal,
    gd.geo_type,
    gd.geo_value,
    cc.min_time_value,
    cc.max_time_value
FROM coverage_crossref cc
JOIN signal_dim sd USING (signal_key_id)
JOIN geo_dim gd USING (geo_key_id)

@nolangormley nolangormley self-assigned this Jan 27, 2025
@nolangormley nolangormley changed the title first pass at coverage endpoint Signal Documentation Coverage Endpoint Jan 27, 2025
@nolangormley nolangormley marked this pull request as ready for review January 29, 2025 21:17
@nolangormley
Copy link
Contributor Author

Sonar is failing on a security flaw around using HTTP instead of HTTPS, but it is for a test. This is how it's done in other tests too.

Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

this is good stuff, its nice and tight! i wouldnt have even thought about going with QueryBuilder and a db VIEW, but together they work well in getting the job done.

ive got a number of smallish suggestions that you can hopefully just hit "accept" for, a couple that you can ignore if you want, and a couple for removing duplicate results. for a bigger change, you should at least one more test case (which shouldnt be that complicated if you use CovidcastTestRow).

Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

a few things more to clean up the script runner, i dont know why i didnt mark them before

Copy link

sonarqubecloud bot commented Feb 3, 2025

Copy link
Collaborator

@melange396 melange396 left a comment

Choose a reason for hiding this comment

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

awesome! nice work!

@melange396 melange396 merged commit 5863680 into dev Feb 3, 2025
8 checks passed
@melange396 melange396 deleted the sig_doc_coverage branch February 3, 2025 19:27
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