From a9414e755dbde75f7f02a9643c92d9771c0ad2bf Mon Sep 17 00:00:00 2001 From: fxia Date: Thu, 29 Aug 2013 00:05:24 -0400 Subject: [PATCH 1/3] add progress into the iso values --- ckanext/spatial/harvesters/base.py | 1 + ckanext/spatial/harvesters/gemini.py | 1 + ckanext/spatial/model/harvested_metadata.py | 10 ++++++++++ 3 files changed, 12 insertions(+) diff --git a/ckanext/spatial/harvesters/base.py b/ckanext/spatial/harvesters/base.py index 98649bf..b01d022 100644 --- a/ckanext/spatial/harvesters/base.py +++ b/ckanext/spatial/harvesters/base.py @@ -234,6 +234,7 @@ class SpatialHarvester(HarvesterBase): 'coupled-resource', 'contact-email', 'frequency-of-update', + 'progress', 'spatial-data-service-type', ]: extras[name] = iso_values[name] diff --git a/ckanext/spatial/harvesters/gemini.py b/ckanext/spatial/harvesters/gemini.py index 76120a8..e9bcd9e 100644 --- a/ckanext/spatial/harvesters/gemini.py +++ b/ckanext/spatial/harvesters/gemini.py @@ -200,6 +200,7 @@ class GeminiHarvester(SpatialHarvester): 'coupled-resource', 'contact-email', 'frequency-of-update', + 'progress', 'spatial-data-service-type', ]: extras[name] = gemini_values[name] diff --git a/ckanext/spatial/model/harvested_metadata.py b/ckanext/spatial/model/harvested_metadata.py index 86700c5..cf02467 100644 --- a/ckanext/spatial/model/harvested_metadata.py +++ b/ckanext/spatial/model/harvested_metadata.py @@ -481,6 +481,16 @@ class ISODocument(MappedXmlDocument): ], multiplicity="0..1", ), + ISOElement( + name="progress", + search_paths=[ + "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:status/gmd:MD_ProgressCode/@codeListValue", + "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:status/gmd:MD_ProgressCode/@codeListValue", + "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:status/gmd:MD_ProgressCode/text()", + "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:status/gmd:MD_ProgressCode/text()", + ], + multiplicity="0..1", + ), ISOElement( name="keyword-inspire-theme", search_paths=[ From c1fe37647f1bb9b3a45f70735e76de0c0fb11965 Mon Sep 17 00:00:00 2001 From: fxia Date: Mon, 9 Sep 2013 14:47:14 -0400 Subject: [PATCH 2/3] change progress multiplicity to * --- ckanext/spatial/harvesters/base.py | 5 ++++- ckanext/spatial/harvesters/gemini.py | 6 +++++- ckanext/spatial/model/harvested_metadata.py | 2 +- ckanext/spatial/tests/test_harvest.py | 1 + 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ckanext/spatial/harvesters/base.py b/ckanext/spatial/harvesters/base.py index b01d022..245ead6 100644 --- a/ckanext/spatial/harvesters/base.py +++ b/ckanext/spatial/harvesters/base.py @@ -234,11 +234,14 @@ class SpatialHarvester(HarvesterBase): 'coupled-resource', 'contact-email', 'frequency-of-update', - 'progress', 'spatial-data-service-type', ]: extras[name] = iso_values[name] + if len(iso_values.get('progress', [])): + extras['progress'] = iso_values['progress'][0] + else: + extras['progress'] = '' if len(iso_values.get('resource-type', [])): extras['resource-type'] = iso_values['resource-type'][0] diff --git a/ckanext/spatial/harvesters/gemini.py b/ckanext/spatial/harvesters/gemini.py index e9bcd9e..e293376 100644 --- a/ckanext/spatial/harvesters/gemini.py +++ b/ckanext/spatial/harvesters/gemini.py @@ -200,11 +200,15 @@ class GeminiHarvester(SpatialHarvester): 'coupled-resource', 'contact-email', 'frequency-of-update', - 'progress', 'spatial-data-service-type', ]: extras[name] = gemini_values[name] + if len(iso_values.get('progress', [])): + extras['progress'] = iso_values['progress'][0] + else: + extras['progress'] = '' + extras['resource-type'] = gemini_values['resource-type'][0] # Use-constraints can contain values which are: diff --git a/ckanext/spatial/model/harvested_metadata.py b/ckanext/spatial/model/harvested_metadata.py index cf02467..0b424b1 100644 --- a/ckanext/spatial/model/harvested_metadata.py +++ b/ckanext/spatial/model/harvested_metadata.py @@ -489,7 +489,7 @@ class ISODocument(MappedXmlDocument): "gmd:identificationInfo/gmd:MD_DataIdentification/gmd:status/gmd:MD_ProgressCode/text()", "gmd:identificationInfo/srv:SV_ServiceIdentification/gmd:status/gmd:MD_ProgressCode/text()", ], - multiplicity="0..1", + multiplicity="*", ), ISOElement( name="keyword-inspire-theme", diff --git a/ckanext/spatial/tests/test_harvest.py b/ckanext/spatial/tests/test_harvest.py index 3deda2a..559a089 100644 --- a/ckanext/spatial/tests/test_harvest.py +++ b/ckanext/spatial/tests/test_harvest.py @@ -329,6 +329,7 @@ class TestHarvest(HarvestFixtureBase): 'spatial': u'{"type": "Polygon", "coordinates": [[[0.205857204, 54.529947158], [0.205857204, 61.06066944], [-8.97114288, 61.06066944], [-8.97114288, 54.529947158], [0.205857204, 54.529947158]]]}', # Other 'coupled-resource': u'[]', + 'progress': u'["completed"]', 'dataset-reference-date': u'[{"type": "creation", "value": "2004-02"}, {"type": "revision", "value": "2006-07-03"}]', 'frequency-of-update': u'irregular', 'licence': u'["Reference and PSMA Only", "http://www.test.gov.uk/licenseurl"]', From f7f1a72df8282528f9950ced1f70d6c1c3e78525 Mon Sep 17 00:00:00 2001 From: amercader Date: Tue, 10 Sep 2013 11:08:06 +0100 Subject: [PATCH 3/3] Remove progress field from tests --- ckanext/spatial/tests/test_harvest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ckanext/spatial/tests/test_harvest.py b/ckanext/spatial/tests/test_harvest.py index 559a089..3deda2a 100644 --- a/ckanext/spatial/tests/test_harvest.py +++ b/ckanext/spatial/tests/test_harvest.py @@ -329,7 +329,6 @@ class TestHarvest(HarvestFixtureBase): 'spatial': u'{"type": "Polygon", "coordinates": [[[0.205857204, 54.529947158], [0.205857204, 61.06066944], [-8.97114288, 61.06066944], [-8.97114288, 54.529947158], [0.205857204, 54.529947158]]]}', # Other 'coupled-resource': u'[]', - 'progress': u'["completed"]', 'dataset-reference-date': u'[{"type": "creation", "value": "2004-02"}, {"type": "revision", "value": "2006-07-03"}]', 'frequency-of-update': u'irregular', 'licence': u'["Reference and PSMA Only", "http://www.test.gov.uk/licenseurl"]',