Analysis sub-step that takes a fingerprint for a Field and infers and saves appropriate information like special type. Each 'classifier' takes the information available to it and decides whether or not to run. We currently have the following classifiers:
All classifier functions take two arguments, a In the future, we plan to add more classifiers, including ML ones that run offline. | (ns metabase.analyze.classifiers.core (:require [metabase.analyze.classifiers.category :as classifiers.category] [metabase.analyze.classifiers.name :as classifiers.name] [metabase.analyze.classifiers.no-preview-display :as classifiers.no-preview-display] [metabase.analyze.classifiers.text-fingerprint :as classifiers.text-fingerprint] [metabase.analyze.fingerprint.schema :as fingerprint.schema] [metabase.analyze.schema :as analyze.schema] [metabase.sync.util :as sync-util] [metabase.util.malli :as mu])) |
+----------------------------------------------------------------------------------------------------------------+ | CLASSIFYING INDIVIDUAL FIELDS | +----------------------------------------------------------------------------------------------------------------+ | |
Various classifier functions available. These should all take two args, a A classifier may see the original field (before any classifiers were run) in the metadata of the field at
| (def ^:private classifiers [#'classifiers.name/infer-and-assoc-semantic-type-by-name #'classifiers.category/infer-is-category-or-list #'classifiers.no-preview-display/infer-no-preview-display #'classifiers.text-fingerprint/infer-semantic-type]) |
(mu/defn run-classifiers :- analyze.schema/Field "Run all the available `classifiers` against `field` and `fingerprint`, and return the resulting `field` with changes decided upon by the classifiers. The original field can be accessed in the metadata at `:sync.classify/original`." [field :- analyze.schema/Field fingerprint :- [:maybe fingerprint.schema/Fingerprint]] (reduce (fn [field classifier] (or (sync-util/with-error-handling (format "Error running classifier on %s" (sync-util/name-for-logging field)) (classifier field fingerprint)) field)) (vary-meta field assoc :sync.classify/original field) classifiers)) | |