Skip to content

Commit

Permalink
add registration agency when adding works. #377
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 12, 2015
1 parent 77db3e9 commit fa96fae
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/models/sources/bmc_fulltext.rb
Expand Up @@ -48,6 +48,7 @@ def get_related_works(result, work)
"DOI" => doi,
"type" => "article-journal",
"tracked" => tracked,
"registration_agency" => "crossref",
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => "cites" }] }
Expand Down
1 change: 1 addition & 0 deletions app/models/sources/cross_ref.rb
Expand Up @@ -68,6 +68,7 @@ def get_related_works(result, work)
"type" => metadata.fetch("type", nil),
"tracked" => tracked,
"publisher_id" => metadata.fetch("publisher_id", nil),
"registration_agency" => "crossref",
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => "cites" }] }
Expand Down
4 changes: 3 additions & 1 deletion app/models/sources/datacite_data.rb
Expand Up @@ -16,7 +16,8 @@ def get_related_works(result, work)

relation_type = RelationType.where(inverse_name: raw_relation_type.underscore).pluck(:name).first
doi = related_identifier.downcase
metadata = get_metadata(doi, get_doi_ra(doi))
registration_agency = get_doi_ra(doi)
metadata = get_metadata(doi, registration_agency)

if metadata[:error]
nil
Expand All @@ -32,6 +33,7 @@ def get_related_works(result, work)
"type" => metadata.fetch("type", nil),
"tracked" => tracked,
"publisher_id" => metadata.fetch("publisher_id", nil),
"registration_agency" => registration_agency,
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => relation_type }] }
Expand Down
1 change: 1 addition & 0 deletions app/models/sources/nature_opensearch.rb
Expand Up @@ -73,6 +73,7 @@ def get_related_works(result, work)
"URL" => url,
"type" => "article-journal",
"tracked" => tracked,
"registration_agency" => "crossref",
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => "cites" }] }
Expand Down
1 change: 1 addition & 0 deletions app/models/sources/plos_fulltext.rb
Expand Up @@ -44,6 +44,7 @@ def get_related_works(result, work)
"DOI" => doi,
"type" => "article-journal",
"tracked" => tracked,
"registration_agency" => "crossref",
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => "cites" }] }
Expand Down
3 changes: 3 additions & 0 deletions app/models/sources/pub_med.rb
Expand Up @@ -20,8 +20,10 @@ def get_related_works(result, work)

if doi.present?
metadata = get_metadata(doi, "crossref")
registration_agency = "crossref"
else
metadata = get_metadata(pmid, "pubmed")
registration_agency = "pubmed"
end

if metadata[:error]
Expand All @@ -40,6 +42,7 @@ def get_related_works(result, work)
"type" => metadata.fetch("type", nil),
"tracked" => tracked,
"publisher_id" => metadata.fetch("publisher_id", nil),
"registration_agency" => registration_agency,
"related_works" => [{ "related_work" => work.pid,
"source" => name,
"relation_type" => "cites" }] }
Expand Down

0 comments on commit fa96fae

Please sign in to comment.