{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.Types.ModelDataQuality
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.ModelDataQuality where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SageMaker.Types.MetricsSource

-- | Data quality constraints and statistics for a model.
--
-- /See:/ 'newModelDataQuality' smart constructor.
data ModelDataQuality = ModelDataQuality'
  { -- | Data quality constraints for a model.
    ModelDataQuality -> Maybe MetricsSource
constraints :: Prelude.Maybe MetricsSource,
    -- | Data quality statistics for a model.
    ModelDataQuality -> Maybe MetricsSource
statistics :: Prelude.Maybe MetricsSource
  }
  deriving (ModelDataQuality -> ModelDataQuality -> Bool
(ModelDataQuality -> ModelDataQuality -> Bool)
-> (ModelDataQuality -> ModelDataQuality -> Bool)
-> Eq ModelDataQuality
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModelDataQuality -> ModelDataQuality -> Bool
$c/= :: ModelDataQuality -> ModelDataQuality -> Bool
== :: ModelDataQuality -> ModelDataQuality -> Bool
$c== :: ModelDataQuality -> ModelDataQuality -> Bool
Prelude.Eq, ReadPrec [ModelDataQuality]
ReadPrec ModelDataQuality
Int -> ReadS ModelDataQuality
ReadS [ModelDataQuality]
(Int -> ReadS ModelDataQuality)
-> ReadS [ModelDataQuality]
-> ReadPrec ModelDataQuality
-> ReadPrec [ModelDataQuality]
-> Read ModelDataQuality
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModelDataQuality]
$creadListPrec :: ReadPrec [ModelDataQuality]
readPrec :: ReadPrec ModelDataQuality
$creadPrec :: ReadPrec ModelDataQuality
readList :: ReadS [ModelDataQuality]
$creadList :: ReadS [ModelDataQuality]
readsPrec :: Int -> ReadS ModelDataQuality
$creadsPrec :: Int -> ReadS ModelDataQuality
Prelude.Read, Int -> ModelDataQuality -> ShowS
[ModelDataQuality] -> ShowS
ModelDataQuality -> String
(Int -> ModelDataQuality -> ShowS)
-> (ModelDataQuality -> String)
-> ([ModelDataQuality] -> ShowS)
-> Show ModelDataQuality
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModelDataQuality] -> ShowS
$cshowList :: [ModelDataQuality] -> ShowS
show :: ModelDataQuality -> String
$cshow :: ModelDataQuality -> String
showsPrec :: Int -> ModelDataQuality -> ShowS
$cshowsPrec :: Int -> ModelDataQuality -> ShowS
Prelude.Show, (forall x. ModelDataQuality -> Rep ModelDataQuality x)
-> (forall x. Rep ModelDataQuality x -> ModelDataQuality)
-> Generic ModelDataQuality
forall x. Rep ModelDataQuality x -> ModelDataQuality
forall x. ModelDataQuality -> Rep ModelDataQuality x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ModelDataQuality x -> ModelDataQuality
$cfrom :: forall x. ModelDataQuality -> Rep ModelDataQuality x
Prelude.Generic)

-- |
-- Create a value of 'ModelDataQuality' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'constraints', 'modelDataQuality_constraints' - Data quality constraints for a model.
--
-- 'statistics', 'modelDataQuality_statistics' - Data quality statistics for a model.
newModelDataQuality ::
  ModelDataQuality
newModelDataQuality :: ModelDataQuality
newModelDataQuality =
  ModelDataQuality' :: Maybe MetricsSource -> Maybe MetricsSource -> ModelDataQuality
ModelDataQuality'
    { $sel:constraints:ModelDataQuality' :: Maybe MetricsSource
constraints = Maybe MetricsSource
forall a. Maybe a
Prelude.Nothing,
      $sel:statistics:ModelDataQuality' :: Maybe MetricsSource
statistics = Maybe MetricsSource
forall a. Maybe a
Prelude.Nothing
    }

-- | Data quality constraints for a model.
modelDataQuality_constraints :: Lens.Lens' ModelDataQuality (Prelude.Maybe MetricsSource)
modelDataQuality_constraints :: (Maybe MetricsSource -> f (Maybe MetricsSource))
-> ModelDataQuality -> f ModelDataQuality
modelDataQuality_constraints = (ModelDataQuality -> Maybe MetricsSource)
-> (ModelDataQuality -> Maybe MetricsSource -> ModelDataQuality)
-> Lens
     ModelDataQuality
     ModelDataQuality
     (Maybe MetricsSource)
     (Maybe MetricsSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelDataQuality' {Maybe MetricsSource
constraints :: Maybe MetricsSource
$sel:constraints:ModelDataQuality' :: ModelDataQuality -> Maybe MetricsSource
constraints} -> Maybe MetricsSource
constraints) (\s :: ModelDataQuality
s@ModelDataQuality' {} Maybe MetricsSource
a -> ModelDataQuality
s {$sel:constraints:ModelDataQuality' :: Maybe MetricsSource
constraints = Maybe MetricsSource
a} :: ModelDataQuality)

-- | Data quality statistics for a model.
modelDataQuality_statistics :: Lens.Lens' ModelDataQuality (Prelude.Maybe MetricsSource)
modelDataQuality_statistics :: (Maybe MetricsSource -> f (Maybe MetricsSource))
-> ModelDataQuality -> f ModelDataQuality
modelDataQuality_statistics = (ModelDataQuality -> Maybe MetricsSource)
-> (ModelDataQuality -> Maybe MetricsSource -> ModelDataQuality)
-> Lens
     ModelDataQuality
     ModelDataQuality
     (Maybe MetricsSource)
     (Maybe MetricsSource)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModelDataQuality' {Maybe MetricsSource
statistics :: Maybe MetricsSource
$sel:statistics:ModelDataQuality' :: ModelDataQuality -> Maybe MetricsSource
statistics} -> Maybe MetricsSource
statistics) (\s :: ModelDataQuality
s@ModelDataQuality' {} Maybe MetricsSource
a -> ModelDataQuality
s {$sel:statistics:ModelDataQuality' :: Maybe MetricsSource
statistics = Maybe MetricsSource
a} :: ModelDataQuality)

instance Core.FromJSON ModelDataQuality where
  parseJSON :: Value -> Parser ModelDataQuality
parseJSON =
    String
-> (Object -> Parser ModelDataQuality)
-> Value
-> Parser ModelDataQuality
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ModelDataQuality"
      ( \Object
x ->
          Maybe MetricsSource -> Maybe MetricsSource -> ModelDataQuality
ModelDataQuality'
            (Maybe MetricsSource -> Maybe MetricsSource -> ModelDataQuality)
-> Parser (Maybe MetricsSource)
-> Parser (Maybe MetricsSource -> ModelDataQuality)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MetricsSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Constraints")
            Parser (Maybe MetricsSource -> ModelDataQuality)
-> Parser (Maybe MetricsSource) -> Parser ModelDataQuality
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe MetricsSource)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Statistics")
      )

instance Prelude.Hashable ModelDataQuality

instance Prelude.NFData ModelDataQuality

instance Core.ToJSON ModelDataQuality where
  toJSON :: ModelDataQuality -> Value
toJSON ModelDataQuality' {Maybe MetricsSource
statistics :: Maybe MetricsSource
constraints :: Maybe MetricsSource
$sel:statistics:ModelDataQuality' :: ModelDataQuality -> Maybe MetricsSource
$sel:constraints:ModelDataQuality' :: ModelDataQuality -> Maybe MetricsSource
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Constraints" Text -> MetricsSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MetricsSource -> Pair) -> Maybe MetricsSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsSource
constraints,
            (Text
"Statistics" Text -> MetricsSource -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (MetricsSource -> Pair) -> Maybe MetricsSource -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MetricsSource
statistics
          ]
      )