diff --git a/application/core/filters.py b/application/core/filters.py
index 5f7c6a9e..75f7481c 100644
--- a/application/core/filters.py
+++ b/application/core/filters.py
@@ -1,4 +1,4 @@
-from application.data_access.entity_queries import get_entity_query, get_entity_search
+from application.data_access.entity_queries import get_entity_query
from application.core.utils import NoneToEmptyStringEncoder
from jinja2 import pass_eval_context
from markdown import markdown
@@ -174,30 +174,6 @@ def get_entity_name_filter(eval_ctx, entity):
return entity.reference
-@pass_eval_context
-def lookup_entity_filter(eval_ctx, value, dataset):
- "lookup an entity by its name or reference"
- search_parameters = {
- "reference": [value],
- "dataset": [dataset],
- }
- params, count, entities = get_entity_search(search_parameters).values()
-
- if len(entities) == 1:
- return entities[0].entity
-
-
-@pass_eval_context
-def lookup_entity_custom_filter(eval_ctx, value, dataset):
-
- datasetMapping = {"permitted-development-rights": "permitted-development-right"}
-
- if dataset in datasetMapping:
- dataset = datasetMapping[dataset]
-
- return lookup_entity_filter(eval_ctx, value, dataset)
-
-
def get_entity_name(entity):
if entity.name:
return entity.name
diff --git a/application/core/models.py b/application/core/models.py
index aa01eeb7..d0ea4a3d 100644
--- a/application/core/models.py
+++ b/application/core/models.py
@@ -136,8 +136,7 @@ class DatasetPublicationCountModel(DigitalLandBaseModel):
def entity_factory(entity_orm: EntityOrm):
e = EntityModel.from_orm(entity_orm)
-
- if hasattr(entity_orm, "json") and entity_orm.json is not None:
+ if entity_orm.json is not None:
# if values in json present then extend the pydantic model
# TODO could add in additional validation using field informtion
field_definitions = {
diff --git a/application/core/templates.py b/application/core/templates.py
index ceb6e77f..eeef9f35 100644
--- a/application/core/templates.py
+++ b/application/core/templates.py
@@ -11,8 +11,6 @@
render_markdown,
entity_name_filter,
get_entity_name_filter,
- lookup_entity_filter,
- lookup_entity_custom_filter,
debug,
digital_land_to_json,
uri_encode,
@@ -75,8 +73,6 @@ def random_int(n=1):
templates.env.filters["render_markdown"] = render_markdown
templates.env.filters["entity_name"] = entity_name_filter
templates.env.filters["get_entity_name"] = get_entity_name_filter
-templates.env.filters["lookup_entity"] = lookup_entity_filter
-templates.env.filters["lookup_entity_custom"] = lookup_entity_custom_filter
templates.env.filters["debug"] = debug
templates.env.filters["digital_land_to_json"] = digital_land_to_json
templates.env.filters["uri_encode"] = uri_encode
diff --git a/application/templates/components/entity-value/macro.jinja b/application/templates/components/entity-value/macro.jinja
index 04a06b96..9e214785 100644
--- a/application/templates/components/entity-value/macro.jinja
+++ b/application/templates/components/entity-value/macro.jinja
@@ -66,8 +66,6 @@
{{ value }}
{% endif %}
- {%- elif field in ["article-4-direction", "permitted-development-rights", "tree-preservation-order"] %}
- {{ value }}
{%- elif field in ["parliament-thesaurus"] %}
{{ value }}
{%- elif field in ["statistical-geography"] %}