Skip to content

Commit

Permalink
Process canto_approver_orcid pubprop
Browse files Browse the repository at this point in the history
Store in ReferenceDetails and write to APICURON JSON file.

Refs pombase/pombase-chado#1013
  • Loading branch information
kimrutherford committed Oct 24, 2023
1 parent 2da6d55 commit 8dc8234
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/pombase/data_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,8 @@ pub struct ReferenceDetails {
#[serde(skip_serializing_if="Option::is_none")]
pub canto_approved_date: Option<FlexStr>,
#[serde(skip_serializing_if="Option::is_none")]
pub canto_approver_orcid: Option<FlexStr>,
#[serde(skip_serializing_if="Option::is_none")]
pub canto_session_submitted_date: Option<FlexStr>,
#[serde(skip_serializing_if="Option::is_none")]
pub canto_added_date: Option<FlexStr>,
Expand Down
30 changes: 19 additions & 11 deletions src/pombase/web/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/pombase/web/data_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ phenotypes, so just the first part of this extension will be used:
let mut canto_curator_name: Option<FlexStr> = None;
let mut canto_first_approved_date: Option<FlexStr> = None;
let mut canto_approved_date: Option<FlexStr> = None;
let mut canto_approver_orcid: Option<FlexStr> = None;
let mut canto_added_date: Option<FlexStr> = None;
let mut canto_session_submitted_date: Option<FlexStr> = None;
let mut annotation_curators = vec![];
Expand Down Expand Up @@ -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" =>
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8dc8234

Please sign in to comment.