<commit_before>(ns cmr.search.services.parameter-converters.spatial
  "Contains parameter converters for spatial parameters"
  (:require [cmr.search.services.parameters :as p]
            [cmr.search.models.query :as qm]
            [cmr.spatial.codec :as spatial-codec]
            [cmr.common.services.errors :as errors]
            [clojure.string :as str]))

(defn url-value->spatial-condition
  [type value]
  (let [shape (spatial-codec/url-decode type value)]
    (when-let [errors (:errors shape)]
      (errors/internal-error!
        (format "Shape format was invalid [%s]. Issues should have be handled in validation."
                (str/join ", " errors))))
    (qm/->SpatialCondition shape)))

(defmethod p/parameter->condition :polygon
  [concept-type param value options]
  (url-value->spatial-condition :polygon value))<commit_msg>Adding code accidentally missing from previous commit.<commit_after>(ns cmr.search.services.parameter-converters.spatial
  "Contains parameter converters for spatial parameters"
  (:require [cmr.search.services.parameters :as p]
            [cmr.search.models.query :as qm]
            [cmr.spatial.codec :as spatial-codec]
            [cmr.common.services.errors :as errors]
            [clojure.string :as str]))

(defn url-value->spatial-condition
  [type value]
  (let [shape (spatial-codec/url-decode type value)]
    (when-let [errors (:errors shape)]
      (errors/internal-error!
        (format "Shape format was invalid [%s]. Issues should have be handled in validation."
                (str/join ", " errors))))
    (qm/->SpatialCondition shape)))

(defmethod p/parameter->condition :polygon
  [concept-type param value options]
  (url-value->spatial-condition :polygon value))

(defmethod p/parameter->condition :bounding-box
  [concept-type param value options]
  (url-value->spatial-condition :br value))
{'fraction_non_alphanumeric': 0.12640599892876273, 'fraction_numerical': 0.0, 'mean_word_length': 3.2648401826484017, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3746789', 'n_tokens_mistral': 574, 'n_tokens_neox': 550, 'n_words': 145}