                   science-quality-flag
                   science-quality-flag-explanation]}
           qa-flags]
-      {:AutomaticQualityFlag automatic-quality-flag
+      {:AutomaticQualityFlag (sanitize-quality-flag :automatic-quality-flag
+                                                    automatic-quality-flag)
        :AutomaticQualityFlagExplanation automatic-quality-flag-explanation
-       :OperationalQualityFlag operational-quality-flag
+       :OperationalQualityFlag (sanitize-quality-flag :operational-quality-flag
+                                                      operational-quality-flag)
        :OperationalQualityFlagExplanation operational-quality-flag-explanation
-       :ScienceQualityFlag science-quality-flag
+       :ScienceQualityFlag (sanitize-quality-flag :science-quality-flag
+                                                  science-quality-flag)
        :ScienceQualityFlagExplanation science-quality-flag-explanation})))
 
 (defn- umm-g-measured-parameter->MeasuredParmeter

        :operational-quality-flag-explanation OperationalQualityFlagExplanation
        :science-quality-flag ScienceQualityFlag
        :science-quality-flag-explanation ScienceQualityFlagExplanation}))))

(defn- QAFlags->umm-g-qa-flags
  "Returns umm-lib QAFlags from given UMM-G QAFlags."

                  OperationalQualityFlagExplanation
                  ScienceQualityFlag
                  ScienceQualityFlagExplanation]}
          qa-flags]
      (g/map->QAFlags
       {:automatic-quality-flag AutomaticQualityFlag
