'''
Harvester for the Inter-University Consortium for Political and Social Research for the SHARE project

Example API call: http://www.icpsr.umich.edu/icpsrweb/ICPSR/oai/studies?verb=ListRecords&metadataPrefix=oai_dc
'''
from __future__ import unicode_literals

from scrapi.base import OAIHarvester


class IcpsrHarvester(OAIHarvester):
    short_name = 'icpsr'
    long_name = 'Inter-University Consortium for Political and Social Research'
    url = 'http://www.icpsr.umich.edu/icpsrweb/ICPSR/oai/studies'

    base_url = 'http://www.icpsr.umich.edu/icpsrweb/ICPSR/oai/studies'
    property_list = ['date', 'identifier', 'type', 'coverage']
    timezone_granularity = False

@@ -256,16 +256,48 @@
 terals%0A%0A
+from scrapi.base import helpers%0A
 from scr
@@ -543,167 +543,752 @@
     
-base_url = 'http://www.icpsr.umich.edu/icpsrweb/ICPSR/oai/studies'%0A    property_list = %5B'date', 'identifier', 'type', 'coverage'%5D%0A    timezone_granularity = False
+@property%0A    def schema(self):%0A        return helpers.updated_schema(self._schema, %7B%0A            %22uris%22: %7B%0A                %22canonicalUri%22: ('//dc:identifier/node()', helpers.compose(create_icpsr_url, helpers.single_result)),%0A                %22objectUris%22: %5B('//dc:identifier/node()', icpsr_exttract_doi)%5D%0A            %7D%0A        %7D)%0A%0A    base_url = 'http://www.icpsr.umich.edu/icpsrweb/ICPSR/oai/studies'%0A    property_list = %5B'date', 'identifier', 'type', 'coverage'%5D%0A    timezone_granularity = False%0A%0A%0Adef create_icpsr_url(identifier):%0A    return 'http://www.icpsr.umich.edu/icpsrweb/ICPSR/studies/%7B%7D'.format(identifier)%0A%0A%0Adef icpsr_exttract_doi(identifiers):%0A    return %5B'http://dx.doi.org/%7B%7D'.format(item) for item in identifiers if '10.' in item%5D
 %0A

Add URL updates to icpsr harvester