From 8dc82342aa62e3c4eb5445d9b7412daf671bb458 Mon Sep 17 00:00:00 2001 From: Kim Rutherford Date: Tue, 24 Oct 2023 20:01:17 +1300 Subject: [PATCH] Process canto_approver_orcid pubprop Store in ReferenceDetails and write to APICURON JSON file. Refs pombase/pombase-chado#1013 --- src/pombase/data_types.rs | 2 ++ src/pombase/web/data.rs | 30 +++++++++++++++++++----------- src/pombase/web/data_build.rs | 4 ++++ 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/pombase/data_types.rs b/src/pombase/data_types.rs index fc73f66b..cb16697d 100644 --- a/src/pombase/data_types.rs +++ b/src/pombase/data_types.rs @@ -554,6 +554,8 @@ pub struct ReferenceDetails { #[serde(skip_serializing_if="Option::is_none")] pub canto_approved_date: Option, #[serde(skip_serializing_if="Option::is_none")] + pub canto_approver_orcid: Option, + #[serde(skip_serializing_if="Option::is_none")] pub canto_session_submitted_date: Option, #[serde(skip_serializing_if="Option::is_none")] pub canto_added_date: Option, diff --git a/src/pombase/web/data.rs b/src/pombase/web/data.rs index bf584532..b79bbd0c 100644 --- a/src/pombase/web/data.rs +++ b/src/pombase/web/data.rs @@ -1519,22 +1519,30 @@ impl WebData { let timestamp = flex_fmt!("{}T{}.000Z", approved_date, approved_time); - let mut add_record = |annotation_curator: &AnnotationCurator, activity_term: FlexStr| { - if let Some(ref curator_orcid) = annotation_curator.orcid { - curation_reports.push(ApicuronReport { - activity_term, - curator_orcid: curator_orcid.clone(), - timestamp: timestamp.clone(), - entity_uri: flex_fmt!("{}/reference/{}", config.base_url, ref_details.uniquename), - }); - } + let mut add_record = |orcid: &FlexStr, activity_term: FlexStr| { + curation_reports.push(ApicuronReport { + activity_term, + curator_orcid: orcid.clone(), + timestamp: timestamp.clone(), + entity_uri: flex_fmt!("{}/reference/{}", config.base_url, ref_details.uniquename), + }); }; + let mut maybe_add_record = + |annotation_curator: &AnnotationCurator, activity_term: FlexStr| { + if let Some(ref curator_orcid) = annotation_curator.orcid { + add_record(curator_orcid, activity_term); + } + }; + for annotation_curator in &ref_details.annotation_curators { - add_record(&annotation_curator, flex_str!("publication_curated")); + maybe_add_record(&annotation_curator, flex_str!("publication_curated")); } for annotation_curator in &ref_details.annotation_file_curators { - add_record(&annotation_curator, flex_str!("provided_dataset")); + maybe_add_record(&annotation_curator, flex_str!("provided_dataset")); + } + if let Some(ref canto_approver_orcid) = ref_details.canto_approver_orcid { + add_record(canto_approver_orcid, flex_str!("approved_publication")); } } diff --git a/src/pombase/web/data_build.rs b/src/pombase/web/data_build.rs index 5e309607..777aef37 100644 --- a/src/pombase/web/data_build.rs +++ b/src/pombase/web/data_build.rs @@ -1484,6 +1484,7 @@ phenotypes, so just the first part of this extension will be used: let mut canto_curator_name: Option = None; let mut canto_first_approved_date: Option = None; let mut canto_approved_date: Option = None; + let mut canto_approver_orcid: Option = None; let mut canto_added_date: Option = None; let mut canto_session_submitted_date: Option = None; let mut annotation_curators = vec![]; @@ -1516,6 +1517,8 @@ phenotypes, so just the first part of this extension will be used: canto_first_approved_date = Some(prop.value.clone()), "canto_approved_date" => canto_approved_date = Some(prop.value.clone()), + "canto_approver_orcid" => + canto_approver_orcid = Some(prop.value.clone()), "canto_added_date" => canto_added_date = Some(prop.value.clone()), "canto_session_submitted_date" => @@ -1634,6 +1637,7 @@ phenotypes, so just the first part of this extension will be used: canto_curator_name, canto_first_approved_date, canto_approved_date, + canto_approver_orcid, canto_session_submitted_date, canto_added_date, annotation_curators,