version: "WRB 2022 (4th ed.) -- Qualifier mapping per RSG (Ch 4 + Ch 5 + Ch 6)"
implementation_status: "soilKey v0.9.5 -- Bloco F supplementary baselines for the remaining 25 RSGs (closes principal + supplementary coverage to 32/32)"
source: |
  IUSS Working Group WRB (2022). World Reference Base for Soil
  Resources, 4th edition. Chapter 4 (RSG-specific principal-qualifier
  lists) + Chapter 5 (qualifier definitions) + Chapter 6 (codes).

# v0.9 wired ~50 core qualifier diagnostics. v0.9.1 extends those
# diagnostics for the first 5 RSGs of the canonical key (Bloco A):
# Histosols, Anthrosols, Technosols, Cryosols, Leptosols. Each RSG's
# `principal:` list now reproduces the full Ch 4 canonical principal
# order. Subsequent blocs (B...E) wire the remaining 27 RSGs in v0.9.1+.
#
# Qualifier name resolution: each entry name N maps to function
# qual_<tolower(N)>. The principals are tested in YAML order; every
# one whose function returns passed=TRUE is appended to the result
# in YAML order (so the prefix on the soil name follows Ch 4). When
# no principal passes, Haplic is the default.
#
# Some Ch 4 qualifiers still lack a backing diagnostic in v0.9.1 (the
# engine reports them as "function not implemented in v0.9" in the
# trace and skips them). They are listed here so the canonical Ch 4
# coverage stays visible; v0.9.2 will close the remaining gaps with
# schema-extension diagnostics. See R/qualifiers-wrb2022-v091.R for
# the v0.9.1 implementations and proxy notes.

rsg_qualifiers:

  HS:   # Histosols (WRB 2022 Ch 4)
    principal: [Floatic, Subaquatic, Tidalic, Thionic, Folic, Limnic,
                Technic, Toxic, Cryic, Salic, Calcaric, Sapric, Hemic,
                Fibric, Ombric, Rheic, Drainic, Andic, Mollic, Umbric,
                Skeletic]
    # v0.9.5 baseline -- conservative subset of Ch 6 supplementary set
    # using qualifiers that already have backing functions (105 total
    # in v0.9.4). RSG-specific entries take priority; the universal
    # texture / saturation / depth tags fill out the list.
    supplementary: [Mulmic, Drainic, Reductic, Skeletic, Hyperskeletic,
                    Dystric, Eutric, Calcaric, Dolomitic, Ornithic,
                    Limnic, Humic, Ochric]
  AT:   # Anthrosols (WRB 2022 Ch 4)
    principal: [Hydragric, Anthraquic, Hortic, Plaggic, Pretic,
                Irragric, Terric, Salic, Calcic, Hyperartefactic,
                Stagnic, Gleyic, Andic, Vitric, Mollic, Umbric, Cambic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Reductic, Drainic, Cumulic]
  TC:   # Technosols (WRB 2022 Ch 4)
    principal: [Ekranic, Linic, Subaquatic, Urbic, Spolic, Garbic,
                Hyperartefactic, Cryic, Salic, Calcic, Calcaric,
                Reductic, Folic, Histic, Hyperskeletic, Limnic, Andic,
                Vitric, Stagnic, Gleyic, Mollic, Umbric, Plaggic,
                Hortic, Irragric, Terric, Skeletic, Leptic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Reductic, Drainic, Hyperartefactic]
  CR:   # Cryosols (WRB 2022 Ch 4)
    principal: [Glacic, Turbic, Histic, Folic, Technic, Hyperartefactic,
                Leptic, Hyperskeletic, Andic, Vitric, Salic, Sodic,
                Spodic, Yermic, Takyric, Mollic, Umbric, Calcic,
                Petrocalcic, Gypsic, Petrogypsic, Fluvic, Gleyic,
                Stagnic, Cambic, Skeletic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Hyperskeletic, Reductic, Drainic,
                    Calcaric, Ornithic]
  LP:   # Leptosols (WRB 2022 Ch 4)
    principal: [Nudilithic, Lithic, Hyperskeletic, Rendzic, Folic,
                Histic, Andic, Vitric, Mollic, Vermic, Umbric, Spodic,
                Cambic, Salic, Gypsic, Petrogypsic, Calcic, Petrocalcic,
                Gleyic, Stagnic, Yermic, Takyric, Skeletic, Calcaric,
                Hortic, Plaggic, Terric, Vertic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Hyperskeletic, Calcaric, Dolomitic,
                    Brunic, Chromic]
  SN:   # Solonetz (WRB 2022 Ch 4)
    principal: [Vitric, Andic, Folic, Histic, Vertic, Salic, Hyposalic,
                Mollic, Chernic, Calcic, Petrocalcic, Hypercalcic,
                Hypocalcic, Protocalcic, Gypsic, Petrogypsic,
                Hypergypsic, Hypogypsic, Stagnic, Gleyic, Albic,
                Magnesic, Hyposodic, Yermic, Takyric, Plaggic, Hortic,
                Terric, Abruptic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Calcaric, Cumulic, Chromic, Hyposalic,
                    Hyposodic]
  VR:   # Vertisols (WRB 2022 Ch 4)
    principal: [Mazic, Grumic, Pellic, Protovertic, Albic, Salic,
                Hyposalic, Sodic, Hyposodic, Hypersodic, Leptic,
                Petroduric, Duric, Gypsic, Petrogypsic, Hypergypsic,
                Petrocalcic, Hypercalcic, Calcic, Hypocalcic,
                Protocalcic, Chromic, Mollic, Stagnic, Gleyic, Hortic,
                Plaggic, Terric, Pretic]
    supplementary: [Aric, Clayic, Humic, Ochric, Dystric, Eutric,
                    Hyperdystric, Hypereutric, Skeletic, Pachic,
                    Calcaric, Chromic, Rhodic, Pellic, Mazic, Grumic]
  SC:   # Solonchaks (WRB 2022 Ch 4)
    principal: [Vitric, Andic, Folic, Histic, Vertic, Aceric,
                Hypersodic, Sodic, Hyposodic, Hypersalic, Hyposalic,
                Petrogypsic, Hypergypsic, Gypsic, Hypogypsic,
                Protogypsic, Petrocalcic, Hypercalcic, Calcic,
                Hypocalcic, Protocalcic, Mollic, Stagnic, Gleyic,
                Yermic, Takyric, Plaggic, Hortic, Terric, Fluvic,
                Skeletic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Calcaric, Cumulic, Chromic, Hyposalic,
                    Hyposodic]
  GL:   # Gleysols (WRB 2022 Ch 4)
    principal: [Tidalic, Subaquatic, Floatic, Folic, Histic, Vitric,
                Andic, Vertic, Thionic, Sulfidic, Salic, Petrogypsic,
                Gypsic, Petrocalcic, Calcic, Plinthic, Petric,
                Pisoplinthic, Spodic, Mollic, Chernic, Umbric, Sodic,
                Abruptic, Fluvic, Mazic, Plaggic, Hortic, Terric,
                Reductic, Drainic, Toxic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Reductic, Drainic, Cumulic, Brunic,
                    Calcaric]
  AN:   # Andosols (WRB 2022 Ch 4)
    principal: [Vitric, Aluandic, Silandic, Eutrosilic, Acroxic,
                Hydric, Pachic, Melanic, Folic, Histic, Leptic,
                Andic, Mollic, Chernic, Umbric, Vertic, Salic,
                Sodic, Gypsic, Petroduric, Duric, Petrocalcic, Calcic,
                Cambic, Stagnic, Gleyic, Fluvic, Plaggic, Hortic,
                Terric, Skeletic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Brunic, Pachic, Melanic, Hydric,
                    Acroxic, Tephric]
  PZ:   # Podzols (WRB 2022 Ch 4)
    principal: [Folic, Histic, Hyperspodic, Carbic, Rustic, Hyperalbic,
                Albic, Leptic, Hyperskeletic, Andic, Vitric, Ortsteinic,
                Placic, Densic, Gleyic, Stagnic, Mollic, Umbric, Cambic,
                Plaggic, Hortic, Terric, Skeletic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Skeletic,
                    Densic, Lamellic, Carbic, Rustic, Rubic, Chromic]
  PT:   # Plinthosols (WRB 2022 Ch 4)
    principal: [Petric, Pisoplinthic, Plinthic, Stagnic, Albic, Geric,
                Vetic, Posic, Hyperalic, Hyperdystric, Mollic, Umbric,
                Acric, Lixic, Alic, Luvic, Skeletic, Leptic, Vertic,
                Gleyic, Plaggic, Hortic, Pretic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Profondic, Rhodic, Rubic, Chromic,
                    Skeletic]
  PL:   # Planosols (WRB 2022 Ch 4)
    principal: [Hyperalbic, Albic, Histic, Folic, Vertic, Mollic,
                Umbric, Sodic, Aceric, Gleyic, Stagnic, Plinthic,
                Petroplinthic, Petrocalcic, Calcic, Petrogypsic,
                Gypsic, Acric, Lixic, Alic, Luvic, Hyperdystric,
                Hypereutric, Andic, Vitric, Geric, Plaggic, Hortic,
                Terric, Skeletic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Profondic, Rhodic, Rubic, Chromic,
                    Skeletic, Cumulic]
  ST:   # Stagnosols (WRB 2022 Ch 4)
    principal: [Hyperalbic, Albic, Vertic, Mollic, Umbric, Histic,
                Folic, Andic, Vitric, Plinthic, Petric, Pisoplinthic,
                Acric, Lixic, Alic, Luvic, Hyperalic, Calcic,
                Petrocalcic, Hyperdystric, Sodic, Salic, Reductic,
                Plaggic, Hortic, Terric, Skeletic, Leptic, Fluvic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Profondic, Rhodic, Rubic, Chromic,
                    Skeletic, Reductic]
  NT:   # Nitisols (WRB 2022 Ch 4)
    principal: [Vetic, Geric, Acric, Alic, Lixic, Luvic, Hyperalic,
                Hyperdystric, Hypereutric, Andic, Ferralic, Ferric,
                Leptic, Mollic, Chernic, Umbric, Pretic, Plaggic,
                Hortic, Terric, Posic, Rhodic, Chromic]
    supplementary: [Aric, Clayic, Loamic, Humic, Dystric, Eutric,
                    Hyperdystric, Hypereutric, Ochric, Profondic,
                    Rubic, Skeletic]
  FR:   # Ferralsols (WRB 2022 Ch 4)
    principal: [Vetic, Posic, Acric, Lixic, Geric, Hyperdystric,
                Hypereutric, Histic, Folic, Andic, Vitric, Sombric,
                Plinthic, Pisoplinthic, Petroplinthic, Mollic, Umbric,
                Ferric, Rhodic, Chromic, Xanthic, Stagnic, Gleyic,
                Plaggic, Hortic, Pretic, Terric, Anthraquic, Hydragric,
                Skeletic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Ochric, Profondic, Rubic, Skeletic]
  CH:   # Chernozems (WRB 2022 Ch 4)
    principal: [Vermic, Pachic, Chernic, Glossic, Vertic, Protovertic,
                Stagnic, Endostagnic, Gleyic, Endogleyic, Sodic,
                Hyposodic, Salic, Hyposalic, Petrocalcic, Hypercalcic,
                Calcic, Endocalcic, Hypocalcic, Protocalcic,
                Petrogypsic, Hypergypsic, Gypsic, Hypogypsic, Luvic,
                Cambic, Petroduric, Leptic, Skeletic, Plaggic, Hortic,
                Terric]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Pachic, Calcaric, Cumulic, Glossic,
                    Chromic]
  KS:   # Kastanozems (WRB 2022 Ch 4)
    principal: [Vermic, Pachic, Chernic, Vertic, Protovertic, Stagnic,
                Gleyic, Sodic, Hyposodic, Salic, Hyposalic, Petrogypsic,
                Hypergypsic, Gypsic, Hypogypsic, Petrocalcic,
                Hypercalcic, Calcic, Hypocalcic, Protocalcic, Luvic,
                Cambic, Petroduric, Leptic, Fluvic, Skeletic, Plaggic,
                Hortic, Terric]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Pachic, Calcaric, Cumulic, Chromic,
                    Hyposalic]
  PH:   # Phaeozems (WRB 2022 Ch 4)
    principal: [Vermic, Pachic, Chernic, Glossic, Vertic, Protovertic,
                Stagnic, Gleyic, Sodic, Hyposodic, Petrocalcic,
                Hypercalcic, Calcic, Hypocalcic, Protocalcic, Luvic,
                Cambic, Petroduric, Leptic, Andic, Vitric, Fluvic,
                Plaggic, Hortic, Terric, Skeletic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Pachic, Calcaric, Cumulic, Glossic,
                    Chromic]
  UM:   # Umbrisols (WRB 2022 Ch 4)
    principal: [Folic, Histic, Andic, Vitric, Leptic, Gleyic, Stagnic,
                Cambic, Hyperdystric, Fluvic, Skeletic, Plaggic,
                Hortic, Terric, Pretic]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Hyperdystric, Skeletic, Cumulic,
                    Pachic, Chromic, Rubic]
  DU:   # Durisols (WRB 2022 Ch 4)
    principal: [Petric, Petroduric, Duric, Petrogypsic, Hypergypsic,
                Gypsic, Hypogypsic, Protogypsic, Petrocalcic,
                Hypercalcic, Calcic, Hypocalcic, Protocalcic, Salic,
                Hyposalic, Sodic, Hyposodic, Vertic, Yermic, Takyric,
                Leptic, Cambic, Skeletic, Plaggic, Hortic, Terric]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Skeletic, Calcaric, Chromic,
                    Hyposalic, Hyposodic]
  GY:   # Gypsisols (WRB 2022 Ch 4)
    principal: [Petric, Petrogypsic, Hypergypsic, Gypsic, Hypogypsic,
                Petrocalcic, Hypercalcic, Calcic, Hypocalcic,
                Protocalcic, Mollic, Vertic, Salic, Hyposalic, Sodic,
                Hyposodic, Yermic, Takyric, Stagnic, Gleyic, Cambic,
                Leptic, Skeletic, Plaggic, Hortic, Terric]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Skeletic, Calcaric, Gypsiric,
                    Chromic, Hyposalic, Hyposodic, Cumulic]
  CL:   # Calcisols (WRB 2022 Ch 4)
    principal: [Petric, Petrocalcic, Hypercalcic, Calcic, Hypocalcic,
                Protocalcic, Vertic, Salic, Hyposalic, Sodic, Hyposodic,
                Mollic, Yermic, Takyric, Stagnic, Gleyic, Cambic,
                Leptic, Skeletic, Plaggic, Hortic, Terric, Fluvic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Skeletic, Calcaric, Dolomitic,
                    Chromic, Hyposalic, Hyposodic, Cumulic]
  RT:   # Retisols (WRB 2022 Ch 4)
    principal: [Albic, Hyperalbic, Folic, Histic, Andic, Vitric,
                Gleyic, Stagnic, Mollic, Umbric, Vertic, Cambic,
                Cutanic, Leptic, Skeletic, Plaggic, Hortic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Profondic, Rubic, Skeletic, Chromic]
  AC:   # Acrisols (WRB 2022 Ch 4)
    principal: [Vetic, Hyperdystric, Posic, Mollic, Chernic, Umbric,
                Albic, Hyperalbic, Plinthic, Petroplinthic, Pisoplinthic,
                Ferralic, Gleyic, Stagnic, Andic, Vitric, Vertic,
                Cutanic, Leptic, Skeletic, Plaggic, Hortic, Pretic,
                Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Ochric, Profondic, Rhodic, Rubic,
                    Skeletic, Chromic]
  LX:   # Lixisols (WRB 2022 Ch 4)
    principal: [Vetic, Posic, Hypereutric, Calcic, Petrocalcic, Mollic,
                Chernic, Umbric, Albic, Hyperalbic, Plinthic,
                Petroplinthic, Pisoplinthic, Ferralic, Gleyic, Stagnic,
                Andic, Vitric, Vertic, Cutanic, Leptic, Skeletic,
                Plaggic, Hortic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Lamellic, Ochric, Profondic, Rhodic, Rubic,
                    Skeletic, Chromic]
  AL:   # Alisols (WRB 2022 Ch 4)
    principal: [Hyperalic, Vetic, Hyperdystric, Mollic, Chernic, Umbric,
                Albic, Hyperalbic, Plinthic, Petroplinthic, Andic,
                Gleyic, Stagnic, Vertic, Cutanic, Leptic, Skeletic,
                Plaggic, Hortic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Dystric, Hyperdystric, Lamellic, Ochric, Profondic,
                    Rhodic, Rubic, Skeletic, Chromic]
  LV:   # Luvisols (WRB 2022 Ch 4)
    principal: [Hypereutric, Calcic, Petrocalcic, Mollic, Chernic,
                Umbric, Albic, Hyperalbic, Glossic, Andic, Gleyic,
                Stagnic, Vertic, Cutanic, Leptic, Cambic, Skeletic,
                Plaggic, Hortic, Pretic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Eutric, Hypereutric, Lamellic, Ochric, Profondic,
                    Rhodic, Rubic, Skeletic, Chromic]
  CM:   # Cambisols (WRB 2022 Ch 4)
    principal: [Andic, Vitric, Folic, Histic, Mollic, Chernic, Umbric,
                Vertic, Salic, Sodic, Calcic, Calcaric, Dolomitic,
                Tephric, Stagnic, Gleyic, Plinthic, Petric, Hyperdystric,
                Hypereutric, Eutric, Dystric, Skeletic, Leptic, Fluvic,
                Plaggic, Hortic, Pretic, Terric]
    supplementary: [Aric, Brunic, Clayic, Cumulic, Loamic, Siltic,
                    Humic, Ochric, Rhodic, Rubic, Skeletic, Chromic]
  AR:   # Arenosols (WRB 2022 Ch 4)
    principal: [Protic, Brunic, Albic, Hyperalbic, Folic, Histic,
                Mollic, Umbric, Cambic, Stagnic, Gleyic, Tidalic,
                Subaquatic, Plinthic, Calcic, Andic, Vitric, Yermic,
                Takyric, Leptic, Hyperskeletic, Skeletic, Plaggic,
                Hortic]
    supplementary: [Aric, Brunic, Loamic, Humic, Ochric, Dystric,
                    Eutric, Hyperdystric, Hypereutric, Skeletic,
                    Hyperskeletic, Cumulic, Rubic, Chromic, Calcaric]
  RG:   # Regosols (WRB 2022 Ch 4)
    principal: [Folic, Histic, Mollic, Chernic, Umbric, Vertic,
                Vitric, Andic, Calcic, Calcaric, Tephric, Salic, Sodic,
                Gleyic, Stagnic, Skeletic, Hyperskeletic, Leptic,
                Yermic, Takyric, Solimovic, Plaggic, Hortic, Terric]
    supplementary: [Aric, Brunic, Clayic, Loamic, Siltic, Humic,
                    Ochric, Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Hyperskeletic, Calcaric, Tephric,
                    Cumulic, Chromic]
  FL:   # Fluvisols (WRB 2022 Ch 4)
    principal: [Tidalic, Subaquatic, Sulfidic, Thionic, Folic, Histic,
                Mollic, Umbric, Vertic, Andic, Vitric, Salic, Stagnic,
                Gleyic, Calcic, Calcaric, Dolomitic, Sodic, Aceric,
                Skeletic, Plaggic, Hortic, Drainic, Reductic, Limnic]
    supplementary: [Aric, Clayic, Loamic, Siltic, Humic, Ochric,
                    Dystric, Eutric, Hyperdystric, Hypereutric,
                    Skeletic, Calcaric, Cumulic, Reductic, Drainic,
                    Sulfidic, Thionic]
