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

Fix MECA path issue (getting the latest version of the gsheet) #121

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions data_hub_api/docmaps/v2/sql/docmaps_index.sql
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,14 @@ t_latest_biorxiv_medrxiv_tdm_path_by_doi_and_version AS (
),

t_rp_meca_path_update AS (
SELECT
* EXCEPT(rn)
FROM
(
SELECT
*,
ROW_NUMBER() OVER(PARTITION BY manuscript_id, long_manuscript_identifier ORDER BY imported_timestamp DESC) AS rn
SELECT
*
FROM `elife-data-pipeline.prod.reviewed_preprint_meca_path_update`
WHERE imported_timestamp = (
SELECT
MAX(imported_timestamp)
FROM `elife-data-pipeline.prod.reviewed_preprint_meca_path_update`
)
WHERE rn=1
),

t_manual_preprint_match_for_published_date AS (
Expand Down Expand Up @@ -353,7 +351,20 @@ t_preprint_published_at_date_and_meca_path AS (
'-meca.zip'
)
ELSE NULL
END AS meca_path
END AS meca_path,
CASE
WHEN meca_path_update.meca_path IS NOT NULL
THEN 'gsheet manual match'
WHEN result.preprint_doi LIKE '10.1101/%'
THEN 'biorxiv meca path api'
WHEN (
result.preprint_doi LIKE '10.21203/rs%'
OR result.preprint_doi LIKE '%arXiv%'
OR result.preprint_doi LIKE '%/osf.io/%'
)
THEN 'generated from manuscript_id and version'
ELSE NULL
END AS meca_path_source
FROM t_result_with_preprint_version AS result
LEFT JOIN t_rp_meca_path_update AS meca_path_update
ON result.long_manuscript_identifier = meca_path_update.long_manuscript_identifier
Expand Down Expand Up @@ -415,6 +426,7 @@ t_result_with_sorted_manuscript_versions_array AS (
result.preprint_doi_url,
preprint.preprint_published_at_date,
preprint.meca_path,
preprint.meca_path_source,
result.editor_details,
result.senior_editor_details,
result.author_names_csv,
Expand Down
Loading