Skip to content

Commit

Permalink
bug(osti-sync): Adds default for sponsor org that is sent to OSTI
Browse files Browse the repository at this point in the history
Closes #440
  • Loading branch information
vchendrix committed Nov 7, 2024
1 parent cf977de commit 42efeb8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions archive_api/service/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ def __init__(self, msg: str, service: int):
super().__init__(f"Service Account {service}: {msg}")


FUNDER_DOE_BER = "U.S. DOE > Office of Science > Biological and Environmental Research (BER)"
6 changes: 4 additions & 2 deletions archive_api/service/essdive_transfer/crosswalk.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
import re
from io import StringIO

from typing import Dict, IO, List, Optional, TextIO, Tuple, Union
from typing import Dict, List, Optional, TextIO, Tuple, Union

import logging

from service.common import FUNDER_DOE_BER

# NGEE-Tropics Project information
LOCATION_NOT_APPLICABLE = "N/A"
LOCATION_RF_KEYWORD = "ESS-DIVE Location Metadata Reporting Format"
Expand All @@ -30,7 +32,7 @@
JSONLD_LICENSE = "http://creativecommons.org/licenses/by/4.0/"

# Funding Organization
JSONLD_FUNDER = {"name": "U.S. DOE > Office of Science > Biological and Environmental Research (BER)"}
JSONLD_FUNDER = {"name": FUNDER_DOE_BER}

DESCRIPTION_MIRROR_FORMAT = "This dataset was originally published on the NGEE Tropics Archive and is " \
"being mirrored on ESS-DIVE for long-term archival"
Expand Down
4 changes: 2 additions & 2 deletions archive_api/service/osti.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

import archive_api
from archive_api.models import DataSet, Author, ServiceAccount
from archive_api.service.common import ServiceAccountException
from archive_api.service.common import ServiceAccountException, FUNDER_DOE_BER

MAPPING = [('title', 'name', ""),
('contract_nos', 'doe_funding_contract_numbers', "None"),
('non-doe_contract_nos', 'doe_funding_contract_numbers', ""),
('originating_research_org', 'originating_institution', ""),
('description', 'description', ""),
('sponsor_org', 'funding_organizations', ""),
('sponsor_org', 'funding_organizations', FUNDER_DOE_BER),
('related_resource', 'reference', "")]


Expand Down
2 changes: 1 addition & 1 deletion archive_api/tests/test_osti.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


OSTI_XML = '<records><record><title>Data Set 3</title><contract_nos>None</contract_nos><non-doe_contract_nos /><originating_research_org /><description>Qui illud verear persequeris te. Vis probo nihil verear an, zril tamquam philosophia eos te, quo ne fugit movet contentiones. Quas mucius detraxit vis an, vero omnesque petentium sit ea. Id ius inimicus comprehensam.</description><sponsor_org>A few funding organizations for my self</sponsor_org><related_resource /><product_nos>NGT0002</product_nos><osti_id>8343947</osti_id><site_url>https://ngt-data.lbl.gov/dois/NGT0002</site_url><publication_date>2016</publication_date><dataset_type>SM</dataset_type><contact_name>NGEE Tropics Archive Team, Support Organization</contact_name><contact_email>NGEE Tropics Archive Test &lt;ngeet-team@testserver&gt;</contact_email><contact_org>Lawrence Berkeley National Lab</contact_org><site_code>NGEE-TRPC</site_code><doi_infix>ngt</doi_infix><subject_categories_code>54 ENVIRONMENTAL SCIENCES</subject_categories_code><language>English</language><country>US</country><creatorsblock><creators_detail><first_name>Luke</first_name><last_name>Cage</last_name><private_email>[email protected]</private_email><affiliation_name>POWER</affiliation_name></creators_detail></creatorsblock></record></records>'
OSTI_XML_DUMMY = '<records><record><title /><contract_nos>None</contract_nos><non-doe_contract_nos /><originating_research_org /><description /><sponsor_org /><related_resource /><product_nos /><set_reserved /><dataset_type>SM</dataset_type><contact_name>NGEE Tropics Archive Team, Support Organization</contact_name><contact_email>NGEE Tropics Archive Test &lt;ngeet-team@testserver&gt;</contact_email><contact_org>Lawrence Berkeley National Lab</contact_org><site_code>NGEE-TRPC</site_code><doi_infix>ngt</doi_infix><subject_categories_code>54 ENVIRONMENTAL SCIENCES</subject_categories_code><language>English</language><country>US</country></record></records>'
OSTI_XML_DUMMY = '<records><record><title /><contract_nos>None</contract_nos><non-doe_contract_nos /><originating_research_org /><description /><sponsor_org>U.S. DOE &gt; Office of Science &gt; Biological and Environmental Research (BER)</sponsor_org><related_resource /><product_nos /><set_reserved /><dataset_type>SM</dataset_type><contact_name>NGEE Tropics Archive Team, Support Organization</contact_name><contact_email>NGEE Tropics Archive Test &lt;ngeet-team@testserver&gt;</contact_email><contact_org>Lawrence Berkeley National Lab</contact_org><site_code>NGEE-TRPC</site_code><doi_infix>ngt</doi_infix><subject_categories_code>54 ENVIRONMENTAL SCIENCES</subject_categories_code><language>English</language><country>US</country></record></records>'
BASEPATH = os.path.dirname(__file__)


Expand Down

0 comments on commit 42efeb8

Please sign in to comment.