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):
except 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):
__author__ = 'abuddenberg'
from gcis_clients.domain import Person
'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',
'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'
......@@ -37,7 +43,30 @@ PARENT_PUBTYPE_MAP = {
'Web Page': 'webpage'
'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')
'NOAA NCDC/CICS-NC': 'cooperative-institute-climate-satellites-nc',
......@@ -66,41 +95,77 @@ ORG_IDS = {
'Susanne Moser Research & Consulting': 'susanne-moser-research-consulting',
'NEMAC': 'national-environmental-modeling-analysis-center',
'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
'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'}),
'Kenneth Kunkel': 'scientist',
'Xungang Yin': 'scientist',
'Nina Bednarsek': 'scientist',
'Henry Schwartz': 'scientist',
'Jessicca Griffin': 'graphic_artist',
'James Youtz': 'scientist',
'Chris Fenimore': 'scientist',
'Deb Misch': 'graphic_artist',
'James Galloway': 'scientist',
'Laura Stevens': 'scientist',
'Nichole Hefty': 'point_of_contact',
'Mike Squires': 'scientist',
'Peter Thorne': 'scientist',
'Donald Wuebbles': 'scientist',
'Felix Landerer': 'scientist',
'David Wuertz': 'scientist',
'Russell Vose': 'scientist',
'Gregg Garfin': 'scientist',
'Jeremy Littell': 'scientist',
'Emily Cloyd': 'contributing_author',
'F. Chapin': 'scientist',
' Chapin': 'scientist',
'Andrew Buddenberg': 'analyst',
'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'
'Kenneth Kunkel': ('cooperative-institute-climate-satellites-nc', 'scientist'),
'Allison Crimmins': ('us-environmental-protection-agency', 'point_of_contact'),
'Micah Hahn': ('centers-disease-control-and-prevention', 'scientist'),
'Jada Garofalo': ('centers-disease-control-and-prevention', 'point_of_contact'),
'Ben Beard': ('centers-disease-control-and-prevention', 'scientist'),
'Dave Mills': ('stratus-consulting', 'analyst'),
'David Mills': ('stratus-consulting', 'analyst'),
'Alexis Juliana': ('stratus-consulting', 'analyst'),
'Neal Fann': ('us-environmental-protection-agency', 'analyst'),
'Pat Dolwick': ('us-environmental-protection-agency', 'scientist'),
'Lewis Ziska': ('us-department-agriculture', 'scientist'),
'Juli Trtanj': ('national-oceanic-atmospheric-administration', 'point_of_contact'),
'Alan Joyner': ('university-north-carolina-chapel-hill', 'graphic_artist'),
'Jeanette Thurston': ('us-department-agriculture', 'scientist'),
'Richard Streeter': ('stratus-consulting', 'analyst'),
'Stephanie Moore': ('national-oceanic-atmospheric-administration', 'scientist'),
'Steve Kibler': ('national-oceanic-atmospheric-administration', 'scientist'),
'Jesse Bell': ('national-oceanic-atmospheric-administration', 'scientist'),
'Lesley Jantarasami': ('us-environmental-protection-agency', 'analyst'),
'Daniel Dodgen': ('us-department-health-human-services', 'point_of_contact'),
'Andrea Maguire': ('us-environmental-protection-agency', 'point_of_contact'),
'Lesley Crimmins)': ('us-environmental-protection-agency', 'analyst'),
'Allison Jantarasami)': ('us-environmental-protection-agency', 'point_of_contact')
from __future__ import print_function
__author__ = 'abuddenberg'
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
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
raise Exception('Local file missing ' + image.local_path)
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)
......@@ -34,32 +38,28 @@ def realize_contributors(gcis_client, contributors):
person = cont.person
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)
if len(name_matches) == 1: = name_matches[0][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)
print '\t', 'Ambiguous results for ' + person.first_name + ' ' + person.last_name
print '\t\t', name_matches
warning('Ambiguous results for ' + person.first_name + ' ' + person.last_name)
if org.identifier in (None, '') and not in (None, ''):
print 'No ID found for ' +
if org and org.identifier in (None, '') and not in (None, ''):
warning('No ID found for ' +
#Check if we missed any organizations in our hardcoding...
if not all(map(lambda c: c.organization.identifier is not None, contributors)):
print 'Missing organizations: ', contributors
if not all(map(lambda c: c.organization is None or c.organization.identifier is not None, contributors)):
warning('Missing organizations: ', contributors)
def realize_parents(gcis_client, parents):
for parent in parents:
# print parent.publication_type_identifier, parent.label
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)))
parent_matches = gcis_client.lookup_publication(parent.publication_type_identifier, parent.label)
......@@ -67,7 +67,7 @@ def realize_parents(gcis_client, parents):
if len(parent_matches) == 1:
parent.url = '/{type}/{id}'.format(type=parent.publication_type_identifier, id=parent_matches[0][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)))
print '\t', ' '.join(('Ambiguous results for', parent.publication_type_identifier, parent.label))
print '\t\t', parent_matches
\ No newline at end of file
warning(' '.join(('Ambiguous results for', parent.publication_type_identifier, parent.label)))
This diff is collapsed.
Supports Markdown
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