diff --git a/arches_her/migrations/0001_initial.py b/arches_her/migrations/0001_initial.py index abe5074e9..0217ad60a 100644 --- a/arches_her/migrations/0001_initial.py +++ b/arches_her/migrations/0001_initial.py @@ -12,6 +12,10 @@ class Migration(migrations.Migration): ("models", "9945_file_thumbnail_bin_file_thumbnail_text"), ] + run_before = [ + ("models", "9946_alter_notification_context"), + ] + def add_plugins(apps, schema_editor): Plugin = apps.get_model("models", "Plugin") diff --git a/arches_her/migrations/0002_move_pkg_sql.py b/arches_her/migrations/0002_move_pkg_sql.py new file mode 100644 index 000000000..8b52b79eb --- /dev/null +++ b/arches_her/migrations/0002_move_pkg_sql.py @@ -0,0 +1,170 @@ +from django.db import migrations, models +from django.utils.translation import gettext as _ + + +class Migration(migrations.Migration): + + dependencies = [ + ("arches_her", "0001_initial"), + ("models", "11499_add_editlog_resourceinstance_idx") + ] + + def add_map_layers(apps, schema_editor): + MapLayer = apps.get_model("models", "MapLayer") + + # Add/update map layers previously in preliminary_sql/search_overlays.sql + # Previously layers were added using random uuid1, so name is only primary identifier + + existing_map = MapLayer.objects.filter(layerdefinitions__contains=[{"source":"search-results-hashes"}]) + if not existing_map: + MapLayer.objects.update_or_create( + maplayerid="ede8a6af-110a-4dab-9d0b-f0eccb4cef86", + name="Search Results Heat Map", + layerdefinitions=[ + { + "source": "search-results-hashes", + "paint": { + "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 0, 1, 20, 5], + "heatmap-weight": ["interpolate", ["linear"], ["get", "doc_count"], 0, 0, 6, 1], + "heatmap-color": [ + "interpolate", + ["linear"], + ["heatmap-density"], + 0, + "#ffffb2", + 0.2, + "#fed976", + 0.4, + "#feb24c", + 0.6, + "#fd8d3c", + 0.8, + "#f03b20", + 0.9, + "#fff", + 1, + "#bd0026", + ], + "heatmap-radius": ["interpolate", ["linear"], ["zoom"], 0, 2, 9, 40, 15, 90, 20, 190], + "heatmap-opacity": 0.6, + }, + "minzoom": 9, + "maxzoom": 17, + "type": "heatmap", + "id": "search-results-heat", + } + ], + isoverlay=True, + icon="ion-search", + activated=True, + addtomap=False, + searchonly=True, + sortorder=0, + ispublic=True, + ) + + existing_map = MapLayer.objects.filter(layerdefinitions__contains=[{"source":"search-results-points"}]) + if not existing_map: + MapLayer.objects.update_or_create( + maplayerid="77ec30f0-3dda-499a-a126-c67d41f7ba3a", + name="Map Markers", + layerdefinitions=[ + { + "layout": {"icon-image": "marker-15", "icon-allow-overlap": True, "icon-offset": [0, -6], "icon-size": 1}, + "source": "search-results-points", + "filter": ["all", ["==", "$type", "Point"], ["!=", "highlight", True]], + "paint": {}, + "type": "symbol", + "id": "search-results-points-markers", + }, + { + "layout": {"icon-image": "marker-15", "icon-allow-overlap": True, "icon-offset": [0, -6], "icon-size": 1.3}, + "source": "search-results-points", + "filter": ["all", ["==", "$type", "Point"], ["==", "highlight", True]], + "paint": {}, + "type": "symbol", + "id": "search-results-points-markers-highlighted", + }, + { + "layout": {"visibility": "visible"}, + "source": "search-results-points", + "filter": ["all", ["==", "$type", "Point"], ["==", "highlight", True]], + "paint": {"circle-translate": [0, -25], "circle-color": "rgba(0,0,0,0)", "circle-radius": 16}, + "type": "circle", + "id": "search-results-points-markers-point-highlighted", + }, + { + "layout": {"visibility": "visible"}, + "source": "search-results-points", + "filter": ["all", ["==", "$type", "Point"]], + "paint": {"circle-translate": [0, -16], "circle-color": "rgba(0,0,0,0)", "circle-radius": 11}, + "type": "circle", + "id": "search-results-points-markers-point", + }, + ], + isoverlay=True, + icon="ion-location", + activated=True, + addtomap=True, + searchonly=True, + sortorder=0, + ispublic=True, + ) + + existing_map = MapLayer.objects.filter(layerdefinitions__contains=[{"source":"search-results-hex"}]) + if not existing_map: + MapLayer.objects.update_or_create( + maplayerid="604bd229-85ca-42db-a7ef-eb2ed81e8537", + name="Hex", + layerdefinitions=[ + { + "layout": {}, + "source": "search-results-hex", + "filter": ["==", "id", ""], + "paint": { + "fill-extrusion-color": "#54278f", + "fill-extrusion-height": {"property": "doc_count", "type": "exponential", "stops": [[0, 0], [500, 5000]]}, + "fill-extrusion-opacity": 0.85, + }, + "type": "fill-extrusion", + "id": "search-results-hex-outline-highlighted", + }, + { + "layout": {}, + "source": "search-results-hex", + "filter": ["all", [">", "doc_count", 0]], + "paint": { + "fill-extrusion-color": { + "property": "doc_count", + "stops": [[1, "#f2f0f7"], [5, "#cbc9e2"], [10, "#9e9ac8"], [20, "#756bb1"], [50, "#54278f"]], + }, + "fill-extrusion-height": {"property": "doc_count", "type": "exponential", "stops": [[0, 0], [500, 5000]]}, + "fill-extrusion-opacity": 0.5, + }, + "type": "fill-extrusion", + "id": "search-results-hex", + }, + ], + isoverlay=True, + icon="ion-funnel", + activated=True, + addtomap=False, + searchonly=True, + sortorder=0, + ispublic=True, + ) + + def remove_map_layers(apps, schema_editor): + MapLayer = apps.get_model("models", "MapLayer") + + for map_layers in MapLayer.objects.filter(name__in=[ + "Search Results Heat Map", + "Map Markers", + "Hex" + ]): + map_layers.delete() + + + operations = [ + migrations.RunPython(add_map_layers, remove_map_layers), + ] diff --git a/arches_her/migrations/0003_add_bng_search_view.py b/arches_her/migrations/0003_add_bng_search_view.py new file mode 100644 index 000000000..a5170e6db --- /dev/null +++ b/arches_her/migrations/0003_add_bng_search_view.py @@ -0,0 +1,72 @@ +from django.db import migrations, models +from django.utils.translation import gettext as _ + + +class Migration(migrations.Migration): + + dependencies = [ + ("arches_her", "0002_move_pkg_sql") + ] + + def add_bng_component_to_search_view(apps, scheme_editor): + SearchComponent = apps.get_model("models", "SearchComponent") + + standard_search_view = SearchComponent.objects.get(searchcomponentid="69695d63-6f03-4536-8da9-841b07116381") + standard_search_view.config["linkedSearchFilters"].append( + { + "componentname": "bng-filter", + "layoutSortorder": 1, + "searchcomponentid": "25ca3536-9eb4-4fd5-b2a5-badfd9a266de" + } + ) + standard_search_view.save() + + def remove_bng_component_from_search_view(apps, scheme_editor): + SearchComponent = apps.get_model("models", "SearchComponent") + + standard_search_view = SearchComponent.objects.get(searchcomponentid="69695d63-6f03-4536-8da9-841b07116381") + for search_filter in standard_search_view.config["linkedSearchFilters"]: + if search_filter["searchcomponentid"] == "25ca3536-9eb4-4fd5-b2a5-badfd9a266de": + standard_search_view.config["linkedSearchFilters"].remove(search_filter) + standard_search_view.save() + + + def apply_bng_layout_type(apps, scheme_editor): + SearchComponent = apps.get_model("models", "SearchComponent") + + SearchComponent.objects.update_or_create( + searchcomponentid="25ca3536-9eb4-4fd5-b2a5-badfd9a266de", + name="BNG Filter", + icon="fa fa-compass", + modulename="bng-filter.py", + classname="BngFilter", + componentpath="views/components/search/bng-filter", + componentname="bng-filter", + defaults={ + "config":{"layoutType": "popup"}, # add previous layout type into new config + "type":"bng-filter-type" # previously "popup" which has now moved + } + ) + + def revert_bng_layout_type(apps, scheme_editor): + SearchComponent = apps.get_model("models", "SearchComponent") + + # Revert BNG search component to how it used to be + SearchComponent.objects.update_or_create( + searchcomponentid="25ca3536-9eb4-4fd5-b2a5-badfd9a266de", + name="BNG Filter", + icon="fa fa-compass", + modulename="bng-filter.py", + classname="BngFilter", + componentpath="views/components/search/bng-filter", + componentname="bng-filter", + defaults={ + "config":{}, + "type":"popup" + } + ) + + operations = [ + migrations.RunPython(add_bng_component_to_search_view, remove_bng_component_from_search_view), + migrations.RunPython(apply_bng_layout_type, revert_bng_layout_type) + ] diff --git a/arches_her/pkg/post_sql/create_spatial_views.sql b/arches_her/pkg/post_sql/create_spatial_views.sql index a831b422f..d637827f9 100644 --- a/arches_her/pkg/post_sql/create_spatial_views.sql +++ b/arches_her/pkg/post_sql/create_spatial_views.sql @@ -1,13 +1,13 @@ -- Create required spatial views DELETE FROM public.spatial_views; -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('289d89bb-47ad-40ef-89fe-3df03c265135', 'public', 'maritime', 'Used to record the details of historic vessels which are either retained as monuments (eg. Museum Ships or Memorials) or have been identified through the discovery of associated wreck sites. A Monument record should be created for the wreck site where known.', false, '[{"nodeid": "656c68c4-3ec0-11eb-859a-f875a44e0e11", "description": "maritime_vessel_type"}, {"nodeid": "656c41b0-3ec0-11eb-8d87-f875a44e0e11", "description": "cultural_period"}, {"nodeid": "72996eeb-3ecb-11eb-9e47-f875a44e0e11", "description": "use_phase_period"}, {"nodeid": "d00d4c8c-299f-11eb-bc0e-f875a44e0e11", "description": "name"}, {"nodeid": "ed3c32e6-29a1-11eb-82fa-f875a44e0e11", "description": "description"}, {"nodeid": "72996ee3-3ecb-11eb-ad29-f875a44e0e11", "description": "functional_craft_type"}]', false, '9f07fa25-f457-11eb-98c7-a87eeabdefba'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('440db097-a7f6-4c34-b650-14f993c8153b', 'public', 'activity', 'Used to record events relating to a particular Heritage Resource. Activities can be used to give context and meaning to the records of heritage assets. They provide information on ‘how we know what we know’ (for example investigative activities or research and analysis) or on how a particular Heritage Asset has been managed through time (management activities).', false, '[{"nodeid": "4f5eeb27-993e-11ea-b9f7-f875a44e0e11", "description": "display_date"}, {"nodeid": "be3831a5-813e-11e9-9a94-80000b44d1d9", "description": "record_status"}, {"nodeid": "2a5b99ad-fe48-11ea-84a1-f875a44e0e11", "description": "actor"}, {"nodeid": "394d15b8-8f7a-11ea-b4f5-f875a44e0e11", "description": "activity_type"}, {"nodeid": "4a7be135-9938-11ea-b0e2-f875a44e0e11", "description": "activity_name"}]', false, 'a5419248-f121-11eb-86a9-a87eeabdefba'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('eba8c62d-1c13-474d-aeba-0296559172f4', 'public', 'applicationarea', 'An area of land which is subject to a planning application and as such may have an impact on the historic environment or the setting of heritage assets.', false, '[{"nodeid": "9c9f9dc0-83bf-11ea-8d22-f875a44e0e11", "description": "application_area_name"}, {"nodeid": "48509bd3-83d4-11ea-9923-f875a44e0e11", "description": "associated_consultations"}]', false, '1909956f-3a3b-11eb-ae99-f875a44e0e11'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('2a578e84-b21a-431d-8de0-59e4d46a88fb', 'public', 'artefact', 'Defines information relating to the character of man made items of heritage significance as identified by the Portable Antiquities Scheme includes individual artefacts, architectural items, artefact assemblages, individual ecofacts and ecofact assemblages, and environmental samples.', false, '[{"nodeid": "c30977b0-991e-11ea-ba04-f875a44e0e11", "description": "description"}, {"nodeid": "dd8032af-b494-11ea-8110-f875a44e0e11", "description": "primary_reference_number"}, {"nodeid": "dd8032b1-b494-11ea-a183-f875a44e0e11", "description": "legacy_id"}, {"nodeid": "99cfe72e-381d-11e8-882c-dca90488358a", "description": "from_date"}, {"nodeid": "22e7c550-afc2-11ea-a4a8-f875a44e0e11", "description": "repository_owner"}, {"nodeid": "50edbf22-ab25-11ea-a258-f875a44e0e11", "description": "storage_area_name"}, {"nodeid": "546b1630-3ba4-11eb-9030-f875a44e0e11", "description": "artefact_type"}, {"nodeid": "5b0dfb27-7fe2-11ea-8ac9-f875a44e0e11", "description": "artefact_name"}, {"nodeid": "99cff7f8-381d-11e8-a059-dca90488358a", "description": "to_date"}, {"nodeid": "99cfffd1-381d-11e8-ab51-dca90488358a", "description": "cultural_period"}]', false, 'f7ccc8b9-f447-11eb-9cb1-a87eeabdefba'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('a9053144-4127-4519-b0e4-d5572c7c6b24', 'public', 'consultations', 'Version 0.1; A model to represent activities and information related to the review and evaluation of proposed developments or alterations to a structure. This model supposes that an official of a government agency must review proposed construction activities and determine whether the activities require conditions/mitigations to conform with local requirements. This model allows for formal application review and informal (e.g.: pre-application) consultations.', false, '[{"nodeid": "1b0e15ec-8864-11ea-8493-f875a44e0e11", "description": "proposal_text"}, {"nodeid": "40eff4cd-893a-11ea-b0cc-f875a44e0e11", "description": "log_date"}, {"nodeid": "4ad69684-951f-11ea-b5c3-f875a44e0e11", "description": "consultation_name"}, {"nodeid": "54de6acc-8895-11ea-9067-f875a44e0e11", "description": "application_type"}, {"nodeid": "73fdfe62-8895-11ea-a058-f875a44e0e11", "description": "development_type"}, {"nodeid": "b37552bd-9527-11ea-97f4-f875a44e0e11", "description": "primary_reference_number"}]', false, 'b949053a-184f-11eb-ac4a-f875a44e0e11'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('bdbd2722-70dd-4c2b-ad56-a0622c6acff7', 'public', 'area', 'Used to record complex human-made, or human conceived, sites, areas or landscapes. Areas can be anything from a simple prehistoric settlement site (evidenced by a few flint-working fragments) to large-scale, urban conservation areas incorporating multiple assets within a city. The use of Area or Monument will be a question of granularity. For building complexes such as castles, prisons and airfields, Area may be used to record the footprint of the site, eg. the curtain wall and outer defences of a castle. This Area can then be used as the parent for multiple Monument records.', false, '[{"nodeid": "d17aa1e4-28cd-11eb-83b8-f875a44e0e11", "description": "shine_significance"}, {"nodeid": "8dca12b3-edeb-11eb-a9ee-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "a4a816e6-efa9-11eb-b0de-a87eeabdefba", "description": "designation_or_protection_type"}, {"nodeid": "a4a816f0-efa9-11eb-969d-a87eeabdefba", "description": "grade"}, {"nodeid": "b334dde5-4e87-11eb-9576-f875a44e0e11", "description": "cultural_period"}, {"nodeid": "b334dde6-4e87-11eb-a67c-f875a44e0e11", "description": "asset_type"}, {"nodeid": "ed6c28c2-1861-11eb-9f92-f875a44e0e11", "description": "functional_type"}, {"nodeid": "ed6c28c3-1861-11eb-9f6e-f875a44e0e11", "description": "use_phase_period"}, {"nodeid": "f3cc1684-185b-11eb-9a07-f875a44e0e11", "description": "description"}]', false, '64be56e3-3ee5-11eb-b1f0-f875a44e0e11'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('3291b08d-a6be-4782-b4cc-b568a1418644', 'public', 'heritagestory', 'Used to record thematic stories (usually associated with an historic event or period) which can provide more detailed background to the heritage assets, areas and artefact. The Heritage Story creates a user-friendly story which helps place the assets in their context within the historic environment.', false, '[{"nodeid": "4365828a-99e3-11ea-b6fb-f875a44e0e11", "description": "description"}, {"nodeid": "44441e0c-99ac-11ea-97cc-f875a44e0e11", "description": "primary_reference_number"}, {"nodeid": "4bc44105-99aa-11ea-aaa3-f875a44e0e11", "description": "name"}]', false, '38521798-3bd0-11eb-ad57-f875a44e0e11'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('82591001-1462-4045-923b-df8c8fa2d8f8', 'public', 'aircraft', 'Last Updated 1st May 2019', false, '[{"nodeid": "7f5591c5-efed-11eb-8e44-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "20d7355e-28e1-11eb-bdbc-f875a44e0e11", "description": "description"}, {"nodeid": "446d5c4c-3e14-11eb-8095-f875a44e0e11", "description": "aircraft_type"}, {"nodeid": "490c26da-efe9-11eb-abc4-a87eeabdefba", "description": "name"}]', false, '9766b0d4-f450-11eb-83b6-a87eeabdefba'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('a67d179c-e16c-429d-9d8b-0fd47e2d5abb', 'public', 'historiclandscapecharacter', 'Used to record areas of the historic landscape. Historic Landscape Characterization is a method of identifying and interpreting the varying historic character within an area that looks beyond individual heritage assets as it brings together an understanding of the whole landscape and townscape.', false, '[{"nodeid": "4cf307e2-07b5-11eb-8253-f875a44e0e11", "description": "name"}, {"nodeid": "89a3e510-07b9-11eb-b1b2-f875a44e0e11", "description": "hlc_type"}, {"nodeid": "4a1e7dc7-f000-11eb-ac44-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "3d22bf22-1aa8-11eb-a368-f875a44e0e11", "description": "description"}]', false, '6678040f-3dff-11eb-a042-f875a44e0e11'); -INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid) VALUES ('27318c10-adc4-421c-9e93-9c007ceee035', 'public', 'monument', 'Used to record built works, human-made structures and human-modified features. These can range from a single post box to a palace complex. The use of Monument or Area will be a question of granularity.', false, '[{"nodeid": "77e8f28d-efdc-11eb-afe4-a87eeabdefba", "description": "construction_phase_type"}, {"nodeid": "676d47ff-9c1c-11ea-b07f-f875a44e0e11", "description": "monument_name"}, {"nodeid": "325a2f33-efe4-11eb-b0bb-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "ba345577-b554-11ea-a9ee-f875a44e0e11", "description": "description"}, {"nodeid": "6af2a0ce-efc5-11eb-88d1-a87eeabdefba", "description": "designation_or_protection_type"}, {"nodeid": "b2133e72-efdc-11eb-a68d-a87eeabdefba", "description": "use_phase_period"}, {"nodeid": "b2133e6b-efdc-11eb-aa04-a87eeabdefba", "description": "functional_type"}, {"nodeid": "77e8f29d-efdc-11eb-b890-a87eeabdefba", "description": "cultural_period"}]', false, '87d3d7dc-f44f-11eb-bee9-a87eeabdefba'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('289d89bb-47ad-40ef-89fe-3df03c265135', 'public', 'maritime', 'Used to record the details of historic vessels which are either retained as monuments (eg. Museum Ships or Memorials) or have been identified through the discovery of associated wreck sites. A Monument record should be created for the wreck site where known.', false, '[{"nodeid": "656c68c4-3ec0-11eb-859a-f875a44e0e11", "description": "maritime_vessel_type"}, {"nodeid": "656c41b0-3ec0-11eb-8d87-f875a44e0e11", "description": "cultural_period"}, {"nodeid": "72996eeb-3ecb-11eb-9e47-f875a44e0e11", "description": "use_phase_period"}, {"nodeid": "d00d4c8c-299f-11eb-bc0e-f875a44e0e11", "description": "name"}, {"nodeid": "ed3c32e6-29a1-11eb-82fa-f875a44e0e11", "description": "description"}, {"nodeid": "72996ee3-3ecb-11eb-ad29-f875a44e0e11", "description": "functional_craft_type"}]', false, '9f07fa25-f457-11eb-98c7-a87eeabdefba', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('440db097-a7f6-4c34-b650-14f993c8153b', 'public', 'activity', 'Used to record events relating to a particular Heritage Resource. Activities can be used to give context and meaning to the records of heritage assets. They provide information on ‘how we know what we know’ (for example investigative activities or research and analysis) or on how a particular Heritage Asset has been managed through time (management activities).', false, '[{"nodeid": "4f5eeb27-993e-11ea-b9f7-f875a44e0e11", "description": "display_date"}, {"nodeid": "be3831a5-813e-11e9-9a94-80000b44d1d9", "description": "record_status"}, {"nodeid": "2a5b99ad-fe48-11ea-84a1-f875a44e0e11", "description": "actor"}, {"nodeid": "394d15b8-8f7a-11ea-b4f5-f875a44e0e11", "description": "activity_type"}, {"nodeid": "4a7be135-9938-11ea-b0e2-f875a44e0e11", "description": "activity_name"}]', false, 'a5419248-f121-11eb-86a9-a87eeabdefba', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('eba8c62d-1c13-474d-aeba-0296559172f4', 'public', 'applicationarea', 'An area of land which is subject to a planning application and as such may have an impact on the historic environment or the setting of heritage assets.', false, '[{"nodeid": "9c9f9dc0-83bf-11ea-8d22-f875a44e0e11", "description": "application_area_name"}, {"nodeid": "48509bd3-83d4-11ea-9923-f875a44e0e11", "description": "associated_consultations"}]', false, '1909956f-3a3b-11eb-ae99-f875a44e0e11', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('2a578e84-b21a-431d-8de0-59e4d46a88fb', 'public', 'artefact', 'Defines information relating to the character of man made items of heritage significance as identified by the Portable Antiquities Scheme includes individual artefacts, architectural items, artefact assemblages, individual ecofacts and ecofact assemblages, and environmental samples.', false, '[{"nodeid": "c30977b0-991e-11ea-ba04-f875a44e0e11", "description": "description"}, {"nodeid": "dd8032af-b494-11ea-8110-f875a44e0e11", "description": "primary_reference_number"}, {"nodeid": "dd8032b1-b494-11ea-a183-f875a44e0e11", "description": "legacy_id"}, {"nodeid": "99cfe72e-381d-11e8-882c-dca90488358a", "description": "from_date"}, {"nodeid": "22e7c550-afc2-11ea-a4a8-f875a44e0e11", "description": "repository_owner"}, {"nodeid": "50edbf22-ab25-11ea-a258-f875a44e0e11", "description": "storage_area_name"}, {"nodeid": "546b1630-3ba4-11eb-9030-f875a44e0e11", "description": "artefact_type"}, {"nodeid": "5b0dfb27-7fe2-11ea-8ac9-f875a44e0e11", "description": "artefact_name"}, {"nodeid": "99cff7f8-381d-11e8-a059-dca90488358a", "description": "to_date"}, {"nodeid": "99cfffd1-381d-11e8-ab51-dca90488358a", "description": "cultural_period"}]', false, 'f7ccc8b9-f447-11eb-9cb1-a87eeabdefba', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('a9053144-4127-4519-b0e4-d5572c7c6b24', 'public', 'consultations', 'Version 0.1; A model to represent activities and information related to the review and evaluation of proposed developments or alterations to a structure. This model supposes that an official of a government agency must review proposed construction activities and determine whether the activities require conditions/mitigations to conform with local requirements. This model allows for formal application review and informal (e.g.: pre-application) consultations.', false, '[{"nodeid": "1b0e15ec-8864-11ea-8493-f875a44e0e11", "description": "proposal_text"}, {"nodeid": "40eff4cd-893a-11ea-b0cc-f875a44e0e11", "description": "log_date"}, {"nodeid": "4ad69684-951f-11ea-b5c3-f875a44e0e11", "description": "consultation_name"}, {"nodeid": "54de6acc-8895-11ea-9067-f875a44e0e11", "description": "application_type"}, {"nodeid": "73fdfe62-8895-11ea-a058-f875a44e0e11", "description": "development_type"}, {"nodeid": "b37552bd-9527-11ea-97f4-f875a44e0e11", "description": "primary_reference_number"}]', false, 'b949053a-184f-11eb-ac4a-f875a44e0e11', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('bdbd2722-70dd-4c2b-ad56-a0622c6acff7', 'public', 'area', 'Used to record complex human-made, or human conceived, sites, areas or landscapes. Areas can be anything from a simple prehistoric settlement site (evidenced by a few flint-working fragments) to large-scale, urban conservation areas incorporating multiple assets within a city. The use of Area or Monument will be a question of granularity. For building complexes such as castles, prisons and airfields, Area may be used to record the footprint of the site, eg. the curtain wall and outer defences of a castle. This Area can then be used as the parent for multiple Monument records.', false, '[{"nodeid": "d17aa1e4-28cd-11eb-83b8-f875a44e0e11", "description": "shine_significance"}, {"nodeid": "8dca12b3-edeb-11eb-a9ee-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "a4a816e6-efa9-11eb-b0de-a87eeabdefba", "description": "designation_or_protection_type"}, {"nodeid": "a4a816f0-efa9-11eb-969d-a87eeabdefba", "description": "grade"}, {"nodeid": "b334dde5-4e87-11eb-9576-f875a44e0e11", "description": "cultural_period"}, {"nodeid": "b334dde6-4e87-11eb-a67c-f875a44e0e11", "description": "asset_type"}, {"nodeid": "ed6c28c2-1861-11eb-9f92-f875a44e0e11", "description": "functional_type"}, {"nodeid": "ed6c28c3-1861-11eb-9f6e-f875a44e0e11", "description": "use_phase_period"}, {"nodeid": "f3cc1684-185b-11eb-9a07-f875a44e0e11", "description": "description"}]', false, '64be56e3-3ee5-11eb-b1f0-f875a44e0e11', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('3291b08d-a6be-4782-b4cc-b568a1418644', 'public', 'heritagestory', 'Used to record thematic stories (usually associated with an historic event or period) which can provide more detailed background to the heritage assets, areas and artefact. The Heritage Story creates a user-friendly story which helps place the assets in their context within the historic environment.', false, '[{"nodeid": "4365828a-99e3-11ea-b6fb-f875a44e0e11", "description": "description"}, {"nodeid": "44441e0c-99ac-11ea-97cc-f875a44e0e11", "description": "primary_reference_number"}, {"nodeid": "4bc44105-99aa-11ea-aaa3-f875a44e0e11", "description": "name"}]', false, '38521798-3bd0-11eb-ad57-f875a44e0e11', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('82591001-1462-4045-923b-df8c8fa2d8f8', 'public', 'aircraft', 'Last Updated 1st May 2019', false, '[{"nodeid": "7f5591c5-efed-11eb-8e44-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "20d7355e-28e1-11eb-bdbc-f875a44e0e11", "description": "description"}, {"nodeid": "446d5c4c-3e14-11eb-8095-f875a44e0e11", "description": "aircraft_type"}, {"nodeid": "490c26da-efe9-11eb-abc4-a87eeabdefba", "description": "name"}]', false, '9766b0d4-f450-11eb-83b6-a87eeabdefba', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('a67d179c-e16c-429d-9d8b-0fd47e2d5abb', 'public', 'historiclandscapecharacter', 'Used to record areas of the historic landscape. Historic Landscape Characterization is a method of identifying and interpreting the varying historic character within an area that looks beyond individual heritage assets as it brings together an understanding of the whole landscape and townscape.', false, '[{"nodeid": "4cf307e2-07b5-11eb-8253-f875a44e0e11", "description": "name"}, {"nodeid": "89a3e510-07b9-11eb-b1b2-f875a44e0e11", "description": "hlc_type"}, {"nodeid": "4a1e7dc7-f000-11eb-ac44-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "3d22bf22-1aa8-11eb-a368-f875a44e0e11", "description": "description"}]', false, '6678040f-3dff-11eb-a042-f875a44e0e11', 'en'); +INSERT INTO public.spatial_views (spatialviewid, schema, slug, description, ismixedgeometrytypes, attributenodes, isactive, geometrynodeid, languageid) VALUES ('27318c10-adc4-421c-9e93-9c007ceee035', 'public', 'monument', 'Used to record built works, human-made structures and human-modified features. These can range from a single post box to a palace complex. The use of Monument or Area will be a question of granularity.', false, '[{"nodeid": "77e8f28d-efdc-11eb-afe4-a87eeabdefba", "description": "construction_phase_type"}, {"nodeid": "676d47ff-9c1c-11ea-b07f-f875a44e0e11", "description": "monument_name"}, {"nodeid": "325a2f33-efe4-11eb-b0bb-a87eeabdefba", "description": "primary_reference_number"}, {"nodeid": "ba345577-b554-11ea-a9ee-f875a44e0e11", "description": "description"}, {"nodeid": "6af2a0ce-efc5-11eb-88d1-a87eeabdefba", "description": "designation_or_protection_type"}, {"nodeid": "b2133e72-efdc-11eb-a68d-a87eeabdefba", "description": "use_phase_period"}, {"nodeid": "b2133e6b-efdc-11eb-aa04-a87eeabdefba", "description": "functional_type"}, {"nodeid": "77e8f29d-efdc-11eb-b890-a87eeabdefba", "description": "cultural_period"}]', false, '87d3d7dc-f44f-11eb-bee9-a87eeabdefba', 'en'); diff --git a/arches_her/pkg/post_sql/spatial_views_intl_hotfix.sql b/arches_her/pkg/post_sql/spatial_views_intl_hotfix.sql deleted file mode 100644 index e91b7dbe7..000000000 --- a/arches_her/pkg/post_sql/spatial_views_intl_hotfix.sql +++ /dev/null @@ -1,159 +0,0 @@ --- Hotfix for spatial views to support internationalisation. This is only required for --- Arches versions <7.6 as this has been fixed in 7.6. - --- ######################################################################################### --- # NOTE: This hotfix only supports the 'en' language. If you need to support another --- # language, you will need to modify the functions below to support the desired --- # language. --- ######################################################################################### - --- Adds a language parameter to the __arches_get_resourceinstance_label function -DROP FUNCTION IF EXISTS public.__arches_get_resourceinstance_label(jsonb, text); - -CREATE OR REPLACE FUNCTION public.__arches_get_resourceinstance_label( - resourceinstance_value jsonb, - label_type text DEFAULT 'name'::text, - lang text DEFAULT 'en') -- << change this to the desired language code - RETURNS text - LANGUAGE 'plpgsql' - COST 100 - VOLATILE PARALLEL UNSAFE -AS $BODY$ - declare - return_label text := ''; - target_resourceinstanceid uuid; - begin - - if resourceinstance_value is null or resourceinstance_value::text = 'null' then - return return_label; - end if; - - target_resourceinstanceid := ((resourceinstance_value -> 0) ->> 'resourceId')::uuid; - if target_resourceinstanceid is null then - target_resourceinstanceid := (resourceinstance_value ->> 'resourceId')::uuid; - end if; - if target_resourceinstanceid is null then - return return_label; - end if; - - select r.descriptors -> lang ->> 'name' - into return_label - from resource_instances r - where resourceinstanceid = target_resourceinstanceid; - - if return_label = '' then - return 'Undefined'; - end if; - return return_label; - end; - -$BODY$; - - --- Adds a language parameter to the __arches_get_resourceinstance_list_label function -DROP FUNCTION IF EXISTS public.__arches_get_resourceinstance_list_label(jsonb, text); - -CREATE OR REPLACE FUNCTION public.__arches_get_resourceinstance_list_label( - resourceinstance_value jsonb, - label_type text DEFAULT 'name'::text, - lang text DEFAULT 'en') -- << change this to the desired language code - RETURNS text - LANGUAGE 'plpgsql' - COST 100 - VOLATILE PARALLEL UNSAFE -AS $BODY$ - declare - return_label text := ''; - begin - if resourceinstance_value is null OR resourceinstance_value::text = 'null' then - return ''; - end if; - - select string_agg(dvl.label, ', ') - from - ( - select __arches_get_resourceinstance_label(dv.resource_instance, label_type, lang) as label - from ( - select jsonb_array_elements(resourceinstance_value) as resource_instance - ) dv - ) dvl - into return_label; - - return return_label; - - end; - -$BODY$; - --- Adds a language parameter to the __arches_get_concept_label function -DROP FUNCTION IF EXISTS public.__arches_get_node_display_value(jsonb, uuid); - -CREATE OR REPLACE FUNCTION public.__arches_get_node_display_value( - in_tiledata jsonb, - in_nodeid uuid, - lang text DEFAULT 'en') -- << change this to the desired language code - RETURNS text - LANGUAGE 'plpgsql' - COST 100 - VOLATILE PARALLEL UNSAFE -AS $BODY$ - declare - display_value text := ''; - in_node_type text; - in_node_config json; - begin - if in_nodeid is null or in_nodeid is null then - return ''; - end if; - - if in_tiledata is null then - return ''; - end if; - - select n.datatype, n.config - into in_node_type, in_node_config - from nodes n where nodeid = in_nodeid::uuid; - - if in_node_type = 'semantic' then - return ''; - end if; - - if in_node_type is null then - return ''; - end if; - - case in_node_type - when 'string' then - display_value := ((in_tiledata -> in_nodeid::text) -> lang) ->> 'value'; - when 'concept' then - display_value := __arches_get_concept_label((in_tiledata ->> in_nodeid::text)::uuid); - when 'concept-list' then - display_value := __arches_get_concept_list_label(in_tiledata -> in_nodeid::text); - when 'edtf' then - display_value := (in_tiledata ->> in_nodeid::text); - when 'file-list' then - select string_agg(f.url,' | ') - from (select (jsonb_array_elements(in_tiledata -> in_nodeid::text) -> 'name')::text as url) f - into display_value; - when 'domain-value' then - display_value := __arches_get_domain_label((in_tiledata ->> in_nodeid::text)::uuid, in_nodeid); - when 'domain-value-list' then - display_value := __arches_get_domain_list_label(in_tiledata -> in_nodeid, in_nodeid); - when 'url' then - display_value := (in_tiledata -> in_nodeid::text ->> 'url'); - when 'node-value' then - display_value := __arches_get_nodevalue_label(in_tiledata -> in_nodeid::text, in_nodeid); - when 'resource-instance' then - display_value := __arches_get_resourceinstance_label(in_tiledata -> in_nodeid::text, 'name', lang); - when 'resource-instance-list' then - display_value := __arches_get_resourceinstance_list_label(in_tiledata -> in_nodeid::text, 'name', lang); - else - display_value := (in_tiledata ->> in_nodeid::text)::text; - - end case; - - return display_value; - end; - - -$BODY$; diff --git a/arches_her/pkg/preliminary_sql/search_filters.sql b/arches_her/pkg/preliminary_sql/search_filters.sql deleted file mode 100644 index b13456401..000000000 --- a/arches_her/pkg/preliminary_sql/search_filters.sql +++ /dev/null @@ -1,22 +0,0 @@ ---- Adds custom search filters to the database. Temporary solution until issue with command line registering is resolved. -INSERT INTO search_component (searchcomponentid, - name, - icon, - modulename, - classname, - type, - componentpath, - componentname, - sortorder, - enabled) - VALUES ( - '8fc3d979-e51a-45d2-8136-6bcf207c9355', - 'BNG Filter', - 'fa fa-compass', - 'bng-filter.py', - 'BngFilter', - 'popup', - 'views/components/search/bng-filter', - 'bng-filter', - 0, - true); \ No newline at end of file diff --git a/arches_her/pkg/preliminary_sql/search_overlays.sql b/arches_her/pkg/preliminary_sql/search_overlays.sql deleted file mode 100644 index 93ea0ba84..000000000 --- a/arches_her/pkg/preliminary_sql/search_overlays.sql +++ /dev/null @@ -1,287 +0,0 @@ -INSERT INTO map_layers(maplayerid, name, layerdefinitions, isoverlay, icon, activated, addtomap, searchonly, sortorder, ispublic) - VALUES (public.uuid_generate_v1mc(), 'Search Results Heat Map', '[ - { - "source": "search-results-hashes", - "paint": { - "heatmap-intensity": [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 0, - 1, - 20, - 5 - ], - "heatmap-weight": [ - "interpolate", - [ - "linear" - ], - [ - "get", - "doc_count" - ], - 0, - 0, - 6, - 1 - ], - "heatmap-color": [ - "interpolate", - [ - "linear" - ], - [ - "heatmap-density" - ], - 0, - "#ffffb2", - 0.2, - "#fed976", - 0.4, - "#feb24c", - 0.6, - "#fd8d3c", - 0.8, - "#f03b20", - 0.9, - "#fff", - 1, - "#bd0026" - ], - "heatmap-radius": [ - "interpolate", - [ - "linear" - ], - [ - "zoom" - ], - 0, - 2, - 9, - 40, - 15, - 90, - 20, - 190 - ], - "heatmap-opacity": 0.6 - }, - "minzoom": 9, - "maxzoom": 17, - "type": "heatmap", - "id": "search-results-heat" - } - ]', TRUE, 'ion-search', TRUE, FALSE, TRUE, 0, TRUE); - - - -INSERT INTO map_layers(maplayerid, name, layerdefinitions, isoverlay, icon, activated, addtomap, searchonly, sortorder, ispublic) - VALUES (public.uuid_generate_v1mc(), 'Map Markers', '[ - { - "layout": { - "icon-image": "marker-15", - "icon-allow-overlap": true, - "icon-offset": [ - 0, - -6 - ], - "icon-size": 1 - }, - "source": "search-results-points", - "filter": [ - "all", - [ - "==", - "$type", - "Point" - ], - [ - "!=", - "highlight", - true - ] - ], - "paint": {}, - "type": "symbol", - "id": "search-results-points-markers" - }, - { - "layout": { - "icon-image": "marker-15", - "icon-allow-overlap": true, - "icon-offset": [ - 0, - -6 - ], - "icon-size": 1.3 - }, - "source": "search-results-points", - "filter": [ - "all", - [ - "==", - "$type", - "Point" - ], - [ - "==", - "highlight", - true - ] - ], - "paint": {}, - "type": "symbol", - "id": "search-results-points-markers-highlighted" - }, - { - "layout": { - "visibility": "visible" - }, - "source": "search-results-points", - "filter": [ - "all", - [ - "==", - "$type", - "Point" - ], - [ - "==", - "highlight", - true - ] - ], - "paint": { - "circle-translate": [ - 0, - -25 - ], - "circle-color": "rgba(0,0,0,0)", - "circle-radius": 16 - }, - "type": "circle", - "id": "search-results-points-markers-point-highlighted" - }, - { - "layout": { - "visibility": "visible" - }, - "source": "search-results-points", - "filter": [ - "all", - [ - "==", - "$type", - "Point" - ] - ], - "paint": { - "circle-translate": [ - 0, - -16 - ], - "circle-color": "rgba(0,0,0,0)", - "circle-radius": 11 - }, - "type": "circle", - "id": "search-results-points-markers-point" - } - ]', TRUE, 'ion-location', TRUE, TRUE, TRUE, 0, TRUE); - - - -INSERT INTO map_layers(maplayerid, name, layerdefinitions, isoverlay, icon, activated, addtomap, searchonly, sortorder, ispublic) - VALUES (public.uuid_generate_v1mc(), 'Hex', '[ - { - "layout": {}, - "source": "search-results-hex", - "filter": [ - "==", - "id", - "" - ], - "paint": { - "fill-extrusion-color": "#54278f", - "fill-extrusion-height": { - "property": "doc_count", - "type": "exponential", - "stops": [ - [ - 0, - 0 - ], - [ - 500, - 5000 - ] - ] - }, - "fill-extrusion-opacity": 0.85 - }, - "type": "fill-extrusion", - "id": "search-results-hex-outline-highlighted" - }, - { - "layout": {}, - "source": "search-results-hex", - "filter": [ - "all", - [ - ">", - "doc_count", - 0 - ] - ], - "paint": { - "fill-extrusion-color": { - "property": "doc_count", - "stops": [ - [ - 1, - "#f2f0f7" - ], - [ - 5, - "#cbc9e2" - ], - [ - 10, - "#9e9ac8" - ], - [ - 20, - "#756bb1" - ], - [ - 50, - "#54278f" - ] - ] - }, - "fill-extrusion-height": { - "property": "doc_count", - "type": "exponential", - "stops": [ - [ - 0, - 0 - ], - [ - 500, - 5000 - ] - ] - }, - "fill-extrusion-opacity": 0.5 - }, - "type": "fill-extrusion", - "id": "search-results-hex" - } - - ]', TRUE, 'ion-funnel', TRUE, FALSE, TRUE, 0, TRUE);