Commit 7c913438 authored by abuddenberg's avatar abuddenberg
Browse files

Full support for all health assessment metadata (probably)

parent 9658bdbe
...@@ -100,7 +100,7 @@ def populate_activity(mthd_json): ...@@ -100,7 +100,7 @@ def populate_activity(mthd_json):
except Exception, e: except Exception, e:
warning('Activity exception: ', e) warning('Activity exception: ', e)
return act, mthd_json['image_name'], mthd_json['dataset'] return act, mthd_json['image_name'], mthd_json['dataset'].strip() if mthd_json['dataset'] else None
def populate_parent(pub_json): def populate_parent(pub_json):
......
__author__ = 'abuddenberg' __author__ = 'abuddenberg'
from gcis_clients.domain import Person
DATASET_IDS = { DATASET_IDS = {
'U.S. Climate Divisional Dataset Version 2': 'nca3-cddv2-r1', 'U.S. Climate Divisional Dataset Version 2': 'nca3-cddv2-r1',
'World Climate Research Program\'s (WCRP\'s) Coupled Model Intercomparison Project phase 5 (CMIP5) multi-model ensemble': 'nca3-cmip5-r1', 'World Climate Research Program\'s (WCRP\'s) Coupled Model Intercomparison Project phase 5 (CMIP5) multi-model ensemble': 'nca3-cmip5-r1',
'World Climate Research Program\'s (WCRP\'s) Coupled Model Intercomparison Project phase 5 (CMIP5) multi-model ensemble': 'nca3-cmip5-r1' 'World Climate Research Program\'s (WCRP\'s) Coupled Model Intercomparison Project phase 5 (CMIP5) multi-model ensemble': 'nca3-cmip5-r1',
'ArboNet': 'cdc-arbonet',
'U.S. Natural Hazard Statistics': 'noaa-nws-us-natural-hazard-statistics',
'Billion-Dollar Weather and Climate Disasters': 'noaa-ncdc-billion-dollar-weather-climate-disasters',
'ESRI USA10 dataset (ArcGIS version 10.0)': 'esri-arcgis-v10-0'
} }
COPYRIGHT_TRANSLATIONS = { COPYRIGHT_TRANSLATIONS = {
...@@ -37,7 +43,30 @@ PARENT_PUBTYPE_MAP = { ...@@ -37,7 +43,30 @@ PARENT_PUBTYPE_MAP = {
'Web Page': 'webpage' 'Web Page': 'webpage'
} }
PARENT_SEARCH_HINTS = {} PARENT_SEARCH_HINTS = {
'report': {
'Climate Change Impacts in the United States: The Third National Climate Assessment': 'nca3',
'Third National Climate Assessment': 'nca3',
'A conceptual framework for action on the social determinants of health': 'conceptual-framework-for-action-on-the-social-determinants-of-health'
},
'dataset': {
'Global Historical Climatology Network - Daily': 'noaa-ncdc-ghcn-daily'
},
'article': {
'Projections of future temperature-attributable deaths in 209 U.S. cities using a cluster based Poisson approach': 'projections-of-future-temperature-attributable-deaths-in-209-us-cities',
'A framework for examining climate driven changes to the seasonality and geographic range of coastal pathogens': '10.1016/j.crm.2015.03.002',
'Effects of Ocean Warming on Growth and Distribution of Five Ciguatera-Associated Dinoflagellates in the Caribbean and Implications for Ciguatera Fish Poisoning': 'potential-effects-of-climate-change-on-growth-and-distribution-of-five-caribbean-gambierdiscus-species',
'Effects of elevated CO2 on the protein concentration of food crops: a meta-analysis': '10.1111/j.1365-2486.2007.01511.x',
'A new scenario framework for climate change research: the concept of shared socio-economic pathways': '10.1007/s10584-013-0905-2',
'Climate Change influences on the annual onset of Lyme disease in the United States': '10.1016/j.ttbdis.2015.05.005'
},
'webpage': {
'Screenshot of: Social Vulnerability Index (SVI) Mapping Dashboard': '6d0ccc19-cdcc-4d56-acb7-d62f12611333'
},
'book': {
'Assessing Health Vulnerability to Climate Change: A Guide for Health Departments': ('report', 'assessing-health-vulnerability-to-climate-change-a-guide-for-health-departments')
}
}
ORG_IDS = { ORG_IDS = {
'NOAA NCDC/CICS-NC': 'cooperative-institute-climate-satellites-nc', 'NOAA NCDC/CICS-NC': 'cooperative-institute-climate-satellites-nc',
...@@ -66,41 +95,77 @@ ORG_IDS = { ...@@ -66,41 +95,77 @@ ORG_IDS = {
'Susanne Moser Research & Consulting': 'susanne-moser-research-consulting', 'Susanne Moser Research & Consulting': 'susanne-moser-research-consulting',
'NEMAC': 'national-environmental-modeling-analysis-center', 'NEMAC': 'national-environmental-modeling-analysis-center',
'LBNL': 'lawrence-berkeley-national-laboratory', 'LBNL': 'lawrence-berkeley-national-laboratory',
'Texas Tech University': 'texas-tech-university' 'Texas Tech University': 'texas-tech-university',
'Centers for Disease Control and Prevention / National Center for Atmospheric Research': 'centers-disease-control-and-prevention',
'Stratus Consulting Inc.': 'stratus-consulting'
}
# host
# point_of_contact
# editor
# analyst
# principal_author
# secondary_author
# data_producer
# author
# scientist
# coordinator
# manager
# convening_lead_author
# lead_author
# contributor
# lead_agency
# publisher
# executive_editor
# distributor
# engineer
# primary_author
# graphic_artist
# coordinating_lead_author
# contributing_editor
# funding_agency
# contributing_author
# data_archive
# advisor
# contributing_agency
PERSON_TRANSLATIONS = {
'Alexis Juliana': Person({'first_name': 'Alexis', 'last_name': 'St. Juliana'}),
'Pat Dolwick': Person({'first_name': 'Patrick', 'last_name': 'Dolwick'}),
'Alan Joyner': Person({'first_name': 'Alan', 'last_name': 'Joyner'}),
'Juli Trtanj': Person({'first_name': 'Juli M.', 'last_name': 'Trtanj'}),
'Stephanie Moore': Person({'first_name': 'Stephanie K.', 'last_name': 'Moore'}),
'Steve Kibler': Person({'first_name': 'Steven R.', 'last_name': 'Kibler'}),
'Jesse Bell': Person({'first_name': 'Jesse E.', 'last_name': 'Bell'}),
'Dave Mills': Person({'first_name': 'David M.', 'last_name': 'Mills'}),
'David Mills': Person({'first_name': 'David M.', 'last_name': 'Mills'}),
'Lesley Crimmins)': Person({'first_name': 'Lesley', 'last_name': 'Jantarasami'}),
'Allison Jantarasami)': Person({'first_name': 'Allison', 'last_name': 'Crimmins'}),
'Lewis Ziska': Person({'first_name': 'Lewis H.', 'last_name': 'Ziska'}),
} }
CONTRIB_ROLES = { CONTRIB_ROLES = {
'Kenneth Kunkel': 'scientist', 'Kenneth Kunkel': ('cooperative-institute-climate-satellites-nc', 'scientist'),
'Xungang Yin': 'scientist', 'Allison Crimmins': ('us-environmental-protection-agency', 'point_of_contact'),
'Nina Bednarsek': 'scientist', 'Micah Hahn': ('centers-disease-control-and-prevention', 'scientist'),
'Henry Schwartz': 'scientist', 'Jada Garofalo': ('centers-disease-control-and-prevention', 'point_of_contact'),
'Jessicca Griffin': 'graphic_artist', 'Ben Beard': ('centers-disease-control-and-prevention', 'scientist'),
'James Youtz': 'scientist', 'Dave Mills': ('stratus-consulting', 'analyst'),
'Chris Fenimore': 'scientist', 'David Mills': ('stratus-consulting', 'analyst'),
'Deb Misch': 'graphic_artist', 'Alexis Juliana': ('stratus-consulting', 'analyst'),
'James Galloway': 'scientist', 'Neal Fann': ('us-environmental-protection-agency', 'analyst'),
'Laura Stevens': 'scientist', 'Pat Dolwick': ('us-environmental-protection-agency', 'scientist'),
'Nichole Hefty': 'point_of_contact', 'Lewis Ziska': ('us-department-agriculture', 'scientist'),
'Mike Squires': 'scientist', 'Juli Trtanj': ('national-oceanic-atmospheric-administration', 'point_of_contact'),
'Peter Thorne': 'scientist', 'Alan Joyner': ('university-north-carolina-chapel-hill', 'graphic_artist'),
'Donald Wuebbles': 'scientist', 'Jeanette Thurston': ('us-department-agriculture', 'scientist'),
'Felix Landerer': 'scientist', 'Richard Streeter': ('stratus-consulting', 'analyst'),
'David Wuertz': 'scientist', 'Stephanie Moore': ('national-oceanic-atmospheric-administration', 'scientist'),
'Russell Vose': 'scientist', 'Steve Kibler': ('national-oceanic-atmospheric-administration', 'scientist'),
'Gregg Garfin': 'scientist', 'Jesse Bell': ('national-oceanic-atmospheric-administration', 'scientist'),
'Jeremy Littell': 'scientist', 'Lesley Jantarasami': ('us-environmental-protection-agency', 'analyst'),
'Emily Cloyd': 'contributing_author', 'Daniel Dodgen': ('us-department-health-human-services', 'point_of_contact'),
'F. Chapin': 'scientist', 'Andrea Maguire': ('us-environmental-protection-agency', 'point_of_contact'),
' Chapin': 'scientist', 'Lesley Crimmins)': ('us-environmental-protection-agency', 'analyst'),
'Andrew Buddenberg': 'analyst', 'Allison Jantarasami)': ('us-environmental-protection-agency', 'point_of_contact')
'Jerry Hatfield': 'author',
'George Luber': 'lead_author',
'Kathy Hibbard': 'lead_author',
'Susanne Moser': 'convening_lead_author',
'Bull Bennett': 'convening_lead_author',
'Ernesto Weil': 'scientist',
'William Elder': 'scientist',
'Greg Dobson': 'analyst',
'Michael Wehner': 'scientist',
'Katharine Hayhoe': 'scientist'
} }
from __future__ import print_function
__author__ = 'abuddenberg' __author__ = 'abuddenberg'
from os.path import exists from os.path import exists
import sys
def warning(*objs):
print("WARNING: ", *objs, file=sys.stderr)
#This function is for adding images to existing figures #This function is for adding images to existing figures
def move_images_to_gcis(webform_client, gcis_client, webform_url, gcis_id, report_id, subset_images=None): def move_images_to_gcis(webform_client, gcis_client, webform_url, gcis_id, report_id, subset_images=None):
...@@ -19,7 +23,7 @@ def move_images_to_gcis(webform_client, gcis_client, webform_url, gcis_id, repor ...@@ -19,7 +23,7 @@ def move_images_to_gcis(webform_client, gcis_client, webform_url, gcis_id, repor
raise Exception('Local file missing ' + image.local_path) raise Exception('Local file missing ' + image.local_path)
if not gcis_client.image_exists(image.identifier): if not gcis_client.image_exists(image.identifier):
print 'Creating image: {img}'.format(img=image.identifier) print('Creating image: {img}'.format(img=image.identifier))
gcis_client.create_image(image, report_id=report_id, figure_id=figure.identifier) gcis_client.create_image(image, report_id=report_id, figure_id=figure.identifier)
...@@ -34,32 +38,28 @@ def realize_contributors(gcis_client, contributors): ...@@ -34,32 +38,28 @@ def realize_contributors(gcis_client, contributors):
person = cont.person person = cont.person
org = cont.organization org = cont.organization
#Hack for F. Chapin
if '.' in person.first_name:
person.first_name = ''
name_matches = gcis_client.lookup_person(person.first_name + ' ' + person.last_name) name_matches = gcis_client.lookup_person(person.first_name + ' ' + person.last_name)
if len(name_matches) == 1: if len(name_matches) == 1:
person.id = name_matches[0][0] person.id = name_matches[0][0]
elif len(name_matches) == 0: elif len(name_matches) == 0:
print '\t', 'No ID found for ' + person.first_name + ' ' + person.last_name warning('No ID found for ' + person.first_name + ' ' + person.last_name)
else: else:
print '\t', 'Ambiguous results for ' + person.first_name + ' ' + person.last_name warning('Ambiguous results for ' + person.first_name + ' ' + person.last_name)
print '\t\t', name_matches warning(name_matches)
if org.identifier in (None, '') and org.name not in (None, ''): if org and org.identifier in (None, '') and org.name not in (None, ''):
print 'No ID found for ' + org.name warning('No ID found for ' + org.name)
#Check if we missed any organizations in our hardcoding... #Check if we missed any organizations in our hardcoding...
if not all(map(lambda c: c.organization.identifier is not None, contributors)): if not all(map(lambda c: c.organization is None or c.organization.identifier is not None, contributors)):
print 'Missing organizations: ', contributors warning('Missing organizations: ', contributors)
def realize_parents(gcis_client, parents): def realize_parents(gcis_client, parents):
for parent in parents: for parent in parents:
# print parent.publication_type_identifier, parent.label # print parent.publication_type_identifier, parent.label
if parent.url: if parent.url:
print '\t', ' '.join(('Using hint for', parent.publication_type_identifier, parent.label)) print(' '.join(('Using hint for', parent.publication_type_identifier, parent.label)))
continue continue
parent_matches = gcis_client.lookup_publication(parent.publication_type_identifier, parent.label) parent_matches = gcis_client.lookup_publication(parent.publication_type_identifier, parent.label)
...@@ -67,7 +67,7 @@ def realize_parents(gcis_client, parents): ...@@ -67,7 +67,7 @@ def realize_parents(gcis_client, parents):
if len(parent_matches) == 1: if len(parent_matches) == 1:
parent.url = '/{type}/{id}'.format(type=parent.publication_type_identifier, id=parent_matches[0][0]) parent.url = '/{type}/{id}'.format(type=parent.publication_type_identifier, id=parent_matches[0][0])
elif len(parent_matches) == 0: elif len(parent_matches) == 0:
print '\t', ' '.join(('No ID found for', parent.publication_type_identifier, parent.label)) warning(' '.join(('No ID found for', parent.publication_type_identifier, parent.label)))
else: else:
print '\t', ' '.join(('Ambiguous results for', parent.publication_type_identifier, parent.label)) warning(' '.join(('Ambiguous results for', parent.publication_type_identifier, parent.label)))
print '\t\t', parent_matches warning(parent_matches)
\ No newline at end of file
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment