geosolutions-it/geonode-rndt

Migrating values

Opened this issue · 1 comments

etj commented

RNDT implementation requires a 1:1 relation from LayerRNDT->Layer.

At the moment LayerRNDT instances are created at Layer creation, or on demand when a Layer metadata is edited.

The RNDT model partially overrides the exisiting one, so that at least the old value of other_constraints may be lost when

  1. an existing layer is created before RNDT app is installed
  2. RNDT app is installed
  3. the old layer is edited

A migration scripts in the rndt app should:

  • for each existing layer
    • create the related LayerRndt
    • copy the layer.constraints_other value into LayerRNDT.constraints_other
etj commented

A bit of rationale behind this issue, or "why didn't you keep the old value in its original field?"

GeoNode "vanilla" merges the layer.constraints_other value into the XML metadata template as an access constraint.
When adding RNDT, we wanted to maintain the same semantic for that field, but RNDT requires that field to be populated with a value from a controlled vocabulary (a thesaurus), so any original value would be quite surely not valid, and then replaced with a value from the vocabulary once the layer metadata is edited.

RNDT also requires use costraints, the the field LayerRNDT.constraints_other represents this kind of constraints.
This field allow either a value from a thesaurus (using a URI as a key) or a free text.

Since
- the GeoNode initial costraint is quite generic on screen,
- the RNDT use constraint allows for free text while the access costraint does not,

moving the text from on field to the other seems to be a decent solution.