CSW harvester OutputSchema config support #258#259
Conversation
amercader
left a comment
There was a problem hiding this comment.
This looks good and useful @ccancellieri. I just added some minor comments
|
|
||
|
|
||
| # load config | ||
| self._set_source_config(harvest_object.source.config) |
There was a problem hiding this comment.
Can you document the new output_schema option and its default value in here so others are aware of it?
https://github.com/ckan/ckanext-spatial/blob/master/doc/harvesters.rst
There was a problem hiding this comment.
added fallback to default in case the server is not supporting iso19139 -> 19115 transformation
the fallback will log and switch back to default asking for iso19139 -> iso19139.
| self.sortby = SortBy([SortProperty('dc:identifier')]) | ||
| # check capabilities | ||
| _cap = self.getcapabilities(endpoint)['response'] | ||
| self.capabilities=etree.ElementTree(etree.fromstring(_cap)) |
There was a problem hiding this comment.
Please try to follow PEP8 guidelines, specially spacing between = and , :)
There was a problem hiding this comment.
sorry, I can't validate the whole project and my code editor is not helping me, good catch, I'll try to fix my bad.
| csw = self._ows(**kw) | ||
|
|
||
| # fetch target csw server capabilities for requested output schema | ||
| output_schemas=self._get_output_schemas('GetRecords') |
There was a problem hiding this comment.
Can we move this call to the __init__() method to avoid duplication and multiple calls to GetCapabilities?
Something like:
def __init__(self, endpoint=None):
_cap = self.getcapabilities(endpoint)['response']
self.capabilities = etree.ElementTree(etree.fromstring(_cap))
self.output_schemas = {
'GetRecords': self._get_output_schemas('GetRecords'),
'GetRecordById': self._get_output_schemas('GetRecordById'),
}| # fetch target csw server capabilities for requested output schema | ||
| output_schemas=output_schemas = self.output_schemas['GetRecordById'] | ||
| if not output_schemas.get(outputschema): | ||
| raise CswError('Output schema \'{}\' not supported by target server: '.format(output_schemas)) |
There was a problem hiding this comment.
Probably here I should be more tolerant Logging ERROR and returning.
|
This is great :) Do you need any help with this PR? |
|
I get this generic error after applying this PR (rebased on master) : |
|
Ciao @frafra thanks to look into this. Would you be able to check the response provided by the server? I'm apologize but I'm not using this plugin anymore, I changed approach, so my help can be very limited on this. |
|
@ccancellieri I think you are right, I will look into that. |
|
Please search for json and geospatial keywords under ckan discussions ;)
Il giorno ven 4 mar 2022 alle ore 10:22 Francesco Frassinelli <
***@***.***> ha scritto:
… @ccancellieri <https://github.com/ccancellieri> I think you are right, I
will look into that.
Which approach have you taken, If I may ask? I am interested into
harvesting data from GeoNetwork too.
—
Reply to this email directly, view it on GitHub
<#259 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAG5WW6GMNHSSTZJGE5UIHTU6HI5NANCNFSM5GQO7MWA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
Carlo Cancellieri
*Skype*: ccancellieri
*Twitter*: @cancellieric
*LinkedIn*: http://it.linkedin.com/in/ccancellieri/
|
This will close #258 adding support to an additional param into the csw json config:
"output_schema": "mdb"mdb is the namespace of the schema to use (in this case it's an iso19115-3.2018)
{'mdb':'http://standards.iso.org/iso/19115/-3/mdb/2.0'}Full Example below:
Doing this the CSW harvester will receive the metadata in the configured outputschema (must be supported by the target csw server).