Liking cljdoc? Tell your friends :D

metabase.models.humanization

Logic related to humanization of table names and other identifiers, e.g. taking an identifier like my_table and returning a human-friendly one like My Table.

There are currently three implementations of humanization logic; :advanced, cost-based logic is the default; which implementation is used is determined by the Setting humanization-strategy; :simple, which merely replaces underscores and dashes with spaces, and :none, which predictibly is merely an identity function that does nothing to the results.

The actual algorithm for advanced humanization is in metabase.util.infer-spaces. (NOTE: some of the logic is here, such as the captialize-word function; maybe we should move that so all the logic is in one place?)

Logic related to humanization of table names and other identifiers, e.g. taking an identifier like `my_table` and
returning a human-friendly one like `My Table`.

There are currently three implementations of humanization logic; `:advanced`, cost-based logic is the default; which
implementation is used is determined by the Setting `humanization-strategy`; `:simple`, which merely replaces
underscores and dashes with spaces, and `:none`, which predictibly is merely an identity function that does nothing
to the results.

The actual algorithm for advanced humanization is in `metabase.util.infer-spaces`. (NOTE: some of the logic is here,
such as the `captialize-word` function; maybe we should move that so all the logic is in one place?)
raw docstring

humanization-strategyclj

(humanization-strategy)
(humanization-strategy new-value)

Metabase can attempt to transform your table and field names into more sensible, human-readable versions, e.g. "somehorriblename" becomes "Some Horrible Name". This doesn’t work all that well if the names are in a language other than English, however. Do you want us to take a guess?

humanization-strategy is a string Setting. You can get its value by calling:

(humanization-strategy)

and set its value by calling:

(humanization-strategy <new-value>)

You can also set its value with the env var MB_HUMANIZATION_STRATEGY.

Clear its value by calling:

(humanization-strategy nil)

Its default value is advanced.

Metabase can attempt to transform your table and field names into more sensible, human-readable versions, e.g. "somehorriblename" becomes "Some Horrible Name". This doesn’t work all that well if the names are in a language other than English, however. Do you want us to take a guess?

`humanization-strategy` is a string Setting. You can get its value by calling:

    (humanization-strategy)

and set its value by calling:

    (humanization-strategy <new-value>)

You can also set its value with the env var `MB_HUMANIZATION_STRATEGY`.

Clear its value by calling:

    (humanization-strategy nil)

Its default value is `advanced`.
sourceraw docstring

name->human-readable-namecljmultimethod

(name->human-readable-name s)
(name->human-readable-name strategy s)

Convert a name, such as num_toucans, to a human-readable name, such as Num Toucans. With one arg, this uses the strategy defined by the Setting humanization-strategy. With two args, you may specify a custom strategy (intended mainly for the internal implementation):

(humanization-strategy :advanced) (name->human-readable-name "cooltoucans") ;-> "Cool Toucans" ;; this is the same as: (name->human-readable-name (humanization-strategy) "cooltoucans") ;-> "Cool Toucans" ;; specifiy a different strategy: (name->human-readable-name :none "cooltoucans") ;-> "cooltoucans"

Convert a name, such as `num_toucans`, to a human-readable name, such as `Num Toucans`. With one arg, this uses the
strategy defined by the Setting `humanization-strategy`. With two args, you may specify a custom strategy (intended
mainly for the internal implementation):

   (humanization-strategy :advanced)
   (name->human-readable-name "cooltoucans")                         ;-> "Cool Toucans"
   ;; this is the same as:
   (name->human-readable-name (humanization-strategy) "cooltoucans") ;-> "Cool Toucans"
   ;; specifiy a different strategy:
   (name->human-readable-name :none "cooltoucans")                   ;-> "cooltoucans"
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close