-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GNIP 86 - metadata parsing and storing #7263
Comments
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
@stefmec Please take a look at this proposal and check if it would solve some of our current issues with metadata ingestion. |
+1 |
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
… of set_metadata to accept 5 output value instead of 5
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
…m dict to list, replace all occurences of set_metadata with parse_metadata
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
…rename underscores with custom, first scheleton of keyword handler
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 9, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 12, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 12, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 13, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 13, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 13, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 13, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 14, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 15, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 15, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 15, 2021
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 15, 2021
12 tasks
mattiagiupponi
added a commit
to mattiagiupponi/geonode
that referenced
this issue
Apr 15, 2021
afabiani
pushed a commit
that referenced
this issue
Apr 16, 2021
* test * rollback * [Fixes #7263] Add test for current set_metadata * [Fixes #7263] Add test for current set_metadata * [Fixes #7263] Add dummy xml for tests * [Fixes #7263] Add multiple metadata_parser, fix all currencies of set_metadata to accept 5 output value instead of 5 * [Fixes #7263] Add smoke test description, METADATA_PARSERS from dict to list, replace all occurences of set_metadata with parse_metadata * [Fixes #7263] Add thesaurus to test xml, fix flake8 issue and rename underscores with custom, first scheleton of keyword handler * [Fixes #7263] Keyword handler moted to object * [Fixes #7263] KeywordHandler assign keyword to object * [Fixes #7279] Keyword Handler for metadata upload, remove keyword from geoserver step and add tests * [Fixes #7279] Add test for set_metadata_function cd /opt/geonode ; /usr/bin/env /home/mattia/.virtualenvs/local-geonode/bin/python /home/mattia/.vscode-server/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/launcher 41039 -- /opt/geonode/manage.py test geonode.layers.tests.TestSetMetadata -v 2 --settings=geonode.local_settings --keepdb * [Fixes #7279] Test coverage for set_metadata with ISO xml dummy * [Fixes #7279] Add keyword handler in upload * [Fixes #7279] Flake8 indentation * [Fixes #7279] Fix KeywordHandler descripiton * [Fixes #7279] Add tests for convert_keyword * [Fixes #7263]cleanup wrong code * Merge with ISSUE_7279 * [Fixes #7288] Layer information handling moved to final step instead of geoserver_finalize_upload * [Fixes #7288] rollback metadata file * [Fixes #7288] flake8 indentation * [Fixes #7263] Add custom field in parsers * [Fixes #7263] Add metadata_storer feature * [Fixes #7263] Fix flake8 indentation * [Fixes #7263] Rename storer * [Fixes #7288] Remove xml reading * [Fixes #7288] Fix flake8 warnings * [Fixes #7263] Fix parser evaluator * - Double check "gs_resource" is not None * - Avoid unneeded attribute value assignments * - Updaye GeoServer resource anyaway * - Add more checks on Keywors "dict" and upload error messages * Use KeywordHandler * [Fixes #7263] Removed duplicated def * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix set_metadata return variable number * - Metadata file exception error handling Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it> Co-authored-by: afabiani <alessio.fabiani@gmail.com> (cherry picked from commit fc9d81a)
12 tasks
afabiani
pushed a commit
that referenced
this issue
Apr 16, 2021
* test * rollback * [Fixes #7263] Add test for current set_metadata * [Fixes #7263] Add test for current set_metadata * [Fixes #7263] Add dummy xml for tests * [Fixes #7263] Add multiple metadata_parser, fix all currencies of set_metadata to accept 5 output value instead of 5 * [Fixes #7263] Add smoke test description, METADATA_PARSERS from dict to list, replace all occurences of set_metadata with parse_metadata * [Fixes #7263] Add thesaurus to test xml, fix flake8 issue and rename underscores with custom, first scheleton of keyword handler * [Fixes #7263] Keyword handler moted to object * [Fixes #7263] KeywordHandler assign keyword to object * [Fixes #7279] Keyword Handler for metadata upload, remove keyword from geoserver step and add tests * [Fixes #7279] Add test for set_metadata_function cd /opt/geonode ; /usr/bin/env /home/mattia/.virtualenvs/local-geonode/bin/python /home/mattia/.vscode-server/extensions/ms-python.python-2021.3.680753044/pythonFiles/lib/python/debugpy/launcher 41039 -- /opt/geonode/manage.py test geonode.layers.tests.TestSetMetadata -v 2 --settings=geonode.local_settings --keepdb * [Fixes #7279] Test coverage for set_metadata with ISO xml dummy * [Fixes #7279] Add keyword handler in upload * [Fixes #7279] Flake8 indentation * [Fixes #7279] Fix KeywordHandler descripiton * [Fixes #7279] Add tests for convert_keyword * [Fixes #7263]cleanup wrong code * Merge with ISSUE_7279 * [Fixes #7288] Layer information handling moved to final step instead of geoserver_finalize_upload * [Fixes #7288] rollback metadata file * [Fixes #7288] flake8 indentation * [Fixes #7263] Add custom field in parsers * [Fixes #7263] Add metadata_storer feature * [Fixes #7263] Fix flake8 indentation * [Fixes #7263] Rename storer * [Fixes #7288] Remove xml reading * [Fixes #7288] Fix flake8 warnings * [Fixes #7263] Fix parser evaluator * - Double check "gs_resource" is not None * - Avoid unneeded attribute value assignments * - Updaye GeoServer resource anyaway * - Add more checks on Keywors "dict" and upload error messages * Use KeywordHandler * [Fixes #7263] Removed duplicated def * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix flake8 and tests alignement * [Fixes #7263] Fix set_metadata return variable number * - Metadata file exception error handling Co-authored-by: Alessio Fabiani <alessio.fabiani@geo-solutions.it> Co-authored-by: afabiani <alessio.fabiani@gmail.com> (cherry picked from commit fc9d81a) Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GNIP 86 - metadata parsing and storing
Overview
Metadata parsing is not easily customizable.
The proposed changes allows to
Other tasks included:
Proposed By
@etj (Emanuele Tajariol)
Assigned to Release
This proposal is for GeoNode .
State
Motivation
I want to be able to provide one or more metadata parsers, in order to be able to override a mapping implemented by the default parser.
Examples:
gco:CharacterString
, but intogmx:Anchor
, and the current owslib parser is not able to parse them. We could of course fix owslib, but it would be a much longer process and it's not said that a particular profile is of general interest, so we need to fine tune the parsing on geonode itself.gmd:MD_LegalConstraints
level, while owslib loops overgmd:MD_RestrictionCode
s andgmd:otherConstraints
separately.In this latter case (model extension), we may want to save the extra data parsed. That's why we also need a way to call some logic that knows how to deal with the custom parsed data.
In case the customization has extended the base model, the parser will put the added values into the
val
dict and the default logic will save the new fields along with the "official" ones.In case the customization added a 1:1 relationship to another table, we'll provide all of the parsed values to the custom logic.
We need to explicitly call the custom logic to deal with other db objects, and can not rely on signals because in this latter case there is no way we can provide the parsed data.
Proposal
Metadata parsing
In settings, a new variable
METADATA_PARSERS
will be added.It's a dict, having as keys
MD_Metadata
,metadata
,Record
-- these values are taken frommetadata.py
, related to the root element names of the related metadata; Anyway, since this proposed implementation makes it dynamic, you will be able to define a parser for a brand new metadata format only by implementing the function and declaring it in this setting.The value related to a key in the dict will be a list containing:
__DEFAULT__
" a fixed string, to indicate the default parser (the existing one, if already defined for that type of metadata), only as optional first elementParser functions must be implemented so that they will return a 5 element tuple:
uuid
, as it is nowvals
, as it is now, a dict holdingResourceBase
fieldsregions
, as it is nowkeywords
, as it is nowcustom
, a dict that containsThe parser function should take as params:
The parser function can alter (refine / improve) the content of each one of the params, and then return them back.
In meta-code the defined functions should be called like that (excluding error checking and default assignments):
Current parsing is called for instance in https://github.com/GeoNode/geonode/blob/3.1/geonode/upload/upload.py#L845
Storing
At the end of
final_step()
, we'll be providing the layer and all the parsed info to any function defined in settings.As an example, we may have a parser which extracts al "process steps" from the metadata, and store them into
custom['processes']
.A storer function will then use the
Layer
info and thecustom['processes']
info to create new DB records referencing to layer with a foreign key and other text fields holding the process steps details.As an alternative to have so many params in the Layer storer functions, they may require only
layer
andcustom
parameters, since all the other ones have already been stored in the Layer instance.Sub-issues
When considering this GNIP, other topics were involved, which have been moved as standalone issues:
Backwards Compatibility
The logic will not be implemented for the synch uploader (i.e.
since it's going to be deprecated.
Future evolution
Explain which could be future evolutions.
Feedback
Update this section with relevant feedbacks, if any.
Voting
Project Steering Committee:
Links
Remove unused links below.
The text was updated successfully, but these errors were encountered: