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

Changed Query for validation statistics to add refMatch field #12

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

peppermint-juli
Copy link

Datasets query clean up—added Ref match field to query as well.

Copy link

@glemson glemson left a comment

Choose a reason for hiding this comment

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

probably need to change along the line I suggest based on Tina's comment.

SELECT * FROM u
WHERE r = ${run_id}
ORDER BY r;
declare @run_id bigint = ${run_id}
Copy link

Choose a reason for hiding this comment

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

from Tina's response, that the refmatch should count unique publications, i gather that the following should be the query:
declare @run_id bigint = ${run_id}
declare @refmatch_id bigint
select @refmatch_id=id from model where name='refmatch'
;
with valid_datasets as (
SELECT da.parent_alias_id
FROM snippet_validation sv
join dyad d on d.id=sv.dyad_id
JOIN dataset_alias da ON d.dataset_alias_id = da.id
where sv.run_id = @run_id and sv.agency_dataset_identified = 1
union
SELECT da.parent_alias_id
FROM dyad_model dm
join dyad d on d.id=dm.dyad_id
JOIN dataset_alias da ON d.dataset_alias_id = da.id and d.run_id = @run_id
where dm.model_id=@refmatch_id
)
SELECT 'n_datasets' k, count(distinct parent_alias_id) v FROM valid_datasets
UNION
SELECT 'n_refmatch' k, count(distinct d.publication_id) v
FROM dyad_model dm join dyad d on d.id = dm.dyad_id
WHERE dm.model_id=@refmatch_id and dm.run_id=@run_id

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.

2 participants