{-# 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.ComprehendMedical.Types.ICD10CMTrait
-- 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.ComprehendMedical.Types.ICD10CMTrait where

import Amazonka.ComprehendMedical.Types.ICD10CMTraitName
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contextual information for the entity. The traits recognized by
-- InferICD10CM are @DIAGNOSIS@, @SIGN@, @SYMPTOM@, and @NEGATION@.
--
-- /See:/ 'newICD10CMTrait' smart constructor.
data ICD10CMTrait = ICD10CMTrait'
  { -- | The level of confidence that Amazon Comprehend Medical has that the
    -- segment of text is correctly recognized as a trait.
    ICD10CMTrait -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
    -- | Provides a name or contextual description about the trait.
    ICD10CMTrait -> Maybe ICD10CMTraitName
name :: Prelude.Maybe ICD10CMTraitName
  }
  deriving (ICD10CMTrait -> ICD10CMTrait -> Bool
(ICD10CMTrait -> ICD10CMTrait -> Bool)
-> (ICD10CMTrait -> ICD10CMTrait -> Bool) -> Eq ICD10CMTrait
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ICD10CMTrait -> ICD10CMTrait -> Bool
$c/= :: ICD10CMTrait -> ICD10CMTrait -> Bool
== :: ICD10CMTrait -> ICD10CMTrait -> Bool
$c== :: ICD10CMTrait -> ICD10CMTrait -> Bool
Prelude.Eq, ReadPrec [ICD10CMTrait]
ReadPrec ICD10CMTrait
Int -> ReadS ICD10CMTrait
ReadS [ICD10CMTrait]
(Int -> ReadS ICD10CMTrait)
-> ReadS [ICD10CMTrait]
-> ReadPrec ICD10CMTrait
-> ReadPrec [ICD10CMTrait]
-> Read ICD10CMTrait
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ICD10CMTrait]
$creadListPrec :: ReadPrec [ICD10CMTrait]
readPrec :: ReadPrec ICD10CMTrait
$creadPrec :: ReadPrec ICD10CMTrait
readList :: ReadS [ICD10CMTrait]
$creadList :: ReadS [ICD10CMTrait]
readsPrec :: Int -> ReadS ICD10CMTrait
$creadsPrec :: Int -> ReadS ICD10CMTrait
Prelude.Read, Int -> ICD10CMTrait -> ShowS
[ICD10CMTrait] -> ShowS
ICD10CMTrait -> String
(Int -> ICD10CMTrait -> ShowS)
-> (ICD10CMTrait -> String)
-> ([ICD10CMTrait] -> ShowS)
-> Show ICD10CMTrait
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ICD10CMTrait] -> ShowS
$cshowList :: [ICD10CMTrait] -> ShowS
show :: ICD10CMTrait -> String
$cshow :: ICD10CMTrait -> String
showsPrec :: Int -> ICD10CMTrait -> ShowS
$cshowsPrec :: Int -> ICD10CMTrait -> ShowS
Prelude.Show, (forall x. ICD10CMTrait -> Rep ICD10CMTrait x)
-> (forall x. Rep ICD10CMTrait x -> ICD10CMTrait)
-> Generic ICD10CMTrait
forall x. Rep ICD10CMTrait x -> ICD10CMTrait
forall x. ICD10CMTrait -> Rep ICD10CMTrait x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ICD10CMTrait x -> ICD10CMTrait
$cfrom :: forall x. ICD10CMTrait -> Rep ICD10CMTrait x
Prelude.Generic)

-- |
-- Create a value of 'ICD10CMTrait' 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:
--
-- 'score', 'iCD10CMTrait_score' - The level of confidence that Amazon Comprehend Medical has that the
-- segment of text is correctly recognized as a trait.
--
-- 'name', 'iCD10CMTrait_name' - Provides a name or contextual description about the trait.
newICD10CMTrait ::
  ICD10CMTrait
newICD10CMTrait :: ICD10CMTrait
newICD10CMTrait =
  ICD10CMTrait' :: Maybe Double -> Maybe ICD10CMTraitName -> ICD10CMTrait
ICD10CMTrait'
    { $sel:score:ICD10CMTrait' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:name:ICD10CMTrait' :: Maybe ICD10CMTraitName
name = Maybe ICD10CMTraitName
forall a. Maybe a
Prelude.Nothing
    }

-- | The level of confidence that Amazon Comprehend Medical has that the
-- segment of text is correctly recognized as a trait.
iCD10CMTrait_score :: Lens.Lens' ICD10CMTrait (Prelude.Maybe Prelude.Double)
iCD10CMTrait_score :: (Maybe Double -> f (Maybe Double))
-> ICD10CMTrait -> f ICD10CMTrait
iCD10CMTrait_score = (ICD10CMTrait -> Maybe Double)
-> (ICD10CMTrait -> Maybe Double -> ICD10CMTrait)
-> Lens ICD10CMTrait ICD10CMTrait (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ICD10CMTrait' {Maybe Double
score :: Maybe Double
$sel:score:ICD10CMTrait' :: ICD10CMTrait -> Maybe Double
score} -> Maybe Double
score) (\s :: ICD10CMTrait
s@ICD10CMTrait' {} Maybe Double
a -> ICD10CMTrait
s {$sel:score:ICD10CMTrait' :: Maybe Double
score = Maybe Double
a} :: ICD10CMTrait)

-- | Provides a name or contextual description about the trait.
iCD10CMTrait_name :: Lens.Lens' ICD10CMTrait (Prelude.Maybe ICD10CMTraitName)
iCD10CMTrait_name :: (Maybe ICD10CMTraitName -> f (Maybe ICD10CMTraitName))
-> ICD10CMTrait -> f ICD10CMTrait
iCD10CMTrait_name = (ICD10CMTrait -> Maybe ICD10CMTraitName)
-> (ICD10CMTrait -> Maybe ICD10CMTraitName -> ICD10CMTrait)
-> Lens
     ICD10CMTrait
     ICD10CMTrait
     (Maybe ICD10CMTraitName)
     (Maybe ICD10CMTraitName)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ICD10CMTrait' {Maybe ICD10CMTraitName
name :: Maybe ICD10CMTraitName
$sel:name:ICD10CMTrait' :: ICD10CMTrait -> Maybe ICD10CMTraitName
name} -> Maybe ICD10CMTraitName
name) (\s :: ICD10CMTrait
s@ICD10CMTrait' {} Maybe ICD10CMTraitName
a -> ICD10CMTrait
s {$sel:name:ICD10CMTrait' :: Maybe ICD10CMTraitName
name = Maybe ICD10CMTraitName
a} :: ICD10CMTrait)

instance Core.FromJSON ICD10CMTrait where
  parseJSON :: Value -> Parser ICD10CMTrait
parseJSON =
    String
-> (Object -> Parser ICD10CMTrait) -> Value -> Parser ICD10CMTrait
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ICD10CMTrait"
      ( \Object
x ->
          Maybe Double -> Maybe ICD10CMTraitName -> ICD10CMTrait
ICD10CMTrait'
            (Maybe Double -> Maybe ICD10CMTraitName -> ICD10CMTrait)
-> Parser (Maybe Double)
-> Parser (Maybe ICD10CMTraitName -> ICD10CMTrait)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Score") Parser (Maybe ICD10CMTraitName -> ICD10CMTrait)
-> Parser (Maybe ICD10CMTraitName) -> Parser ICD10CMTrait
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ICD10CMTraitName)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Name")
      )

instance Prelude.Hashable ICD10CMTrait

instance Prelude.NFData ICD10CMTrait