{-# 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.RxNormConcept
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.ComprehendMedical.Types.RxNormConcept where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | The RxNorm concept that the entity could refer to, along with a score
-- indicating the likelihood of the match.
--
-- /See:/ 'newRxNormConcept' smart constructor.
data RxNormConcept = RxNormConcept'
  { -- | RxNorm concept ID, also known as the RxCUI.
    RxNormConcept -> Maybe Text
code :: Prelude.Maybe Prelude.Text,
    -- | The description of the RxNorm concept.
    RxNormConcept -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The level of confidence that Amazon Comprehend Medical has that the
    -- entity is accurately linked to the reported RxNorm concept.
    RxNormConcept -> Maybe Double
score :: Prelude.Maybe Prelude.Double
  }
  deriving (RxNormConcept -> RxNormConcept -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RxNormConcept -> RxNormConcept -> Bool
$c/= :: RxNormConcept -> RxNormConcept -> Bool
== :: RxNormConcept -> RxNormConcept -> Bool
$c== :: RxNormConcept -> RxNormConcept -> Bool
Prelude.Eq, ReadPrec [RxNormConcept]
ReadPrec RxNormConcept
Int -> ReadS RxNormConcept
ReadS [RxNormConcept]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RxNormConcept]
$creadListPrec :: ReadPrec [RxNormConcept]
readPrec :: ReadPrec RxNormConcept
$creadPrec :: ReadPrec RxNormConcept
readList :: ReadS [RxNormConcept]
$creadList :: ReadS [RxNormConcept]
readsPrec :: Int -> ReadS RxNormConcept
$creadsPrec :: Int -> ReadS RxNormConcept
Prelude.Read, Int -> RxNormConcept -> ShowS
[RxNormConcept] -> ShowS
RxNormConcept -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RxNormConcept] -> ShowS
$cshowList :: [RxNormConcept] -> ShowS
show :: RxNormConcept -> String
$cshow :: RxNormConcept -> String
showsPrec :: Int -> RxNormConcept -> ShowS
$cshowsPrec :: Int -> RxNormConcept -> ShowS
Prelude.Show, forall x. Rep RxNormConcept x -> RxNormConcept
forall x. RxNormConcept -> Rep RxNormConcept x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RxNormConcept x -> RxNormConcept
$cfrom :: forall x. RxNormConcept -> Rep RxNormConcept x
Prelude.Generic)

-- |
-- Create a value of 'RxNormConcept' 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:
--
-- 'code', 'rxNormConcept_code' - RxNorm concept ID, also known as the RxCUI.
--
-- 'description', 'rxNormConcept_description' - The description of the RxNorm concept.
--
-- 'score', 'rxNormConcept_score' - The level of confidence that Amazon Comprehend Medical has that the
-- entity is accurately linked to the reported RxNorm concept.
newRxNormConcept ::
  RxNormConcept
newRxNormConcept :: RxNormConcept
newRxNormConcept =
  RxNormConcept'
    { $sel:code:RxNormConcept' :: Maybe Text
code = forall a. Maybe a
Prelude.Nothing,
      $sel:description:RxNormConcept' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:score:RxNormConcept' :: Maybe Double
score = forall a. Maybe a
Prelude.Nothing
    }

-- | RxNorm concept ID, also known as the RxCUI.
rxNormConcept_code :: Lens.Lens' RxNormConcept (Prelude.Maybe Prelude.Text)
rxNormConcept_code :: Lens' RxNormConcept (Maybe Text)
rxNormConcept_code = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormConcept' {Maybe Text
code :: Maybe Text
$sel:code:RxNormConcept' :: RxNormConcept -> Maybe Text
code} -> Maybe Text
code) (\s :: RxNormConcept
s@RxNormConcept' {} Maybe Text
a -> RxNormConcept
s {$sel:code:RxNormConcept' :: Maybe Text
code = Maybe Text
a} :: RxNormConcept)

-- | The description of the RxNorm concept.
rxNormConcept_description :: Lens.Lens' RxNormConcept (Prelude.Maybe Prelude.Text)
rxNormConcept_description :: Lens' RxNormConcept (Maybe Text)
rxNormConcept_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormConcept' {Maybe Text
description :: Maybe Text
$sel:description:RxNormConcept' :: RxNormConcept -> Maybe Text
description} -> Maybe Text
description) (\s :: RxNormConcept
s@RxNormConcept' {} Maybe Text
a -> RxNormConcept
s {$sel:description:RxNormConcept' :: Maybe Text
description = Maybe Text
a} :: RxNormConcept)

-- | The level of confidence that Amazon Comprehend Medical has that the
-- entity is accurately linked to the reported RxNorm concept.
rxNormConcept_score :: Lens.Lens' RxNormConcept (Prelude.Maybe Prelude.Double)
rxNormConcept_score :: Lens' RxNormConcept (Maybe Double)
rxNormConcept_score = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormConcept' {Maybe Double
score :: Maybe Double
$sel:score:RxNormConcept' :: RxNormConcept -> Maybe Double
score} -> Maybe Double
score) (\s :: RxNormConcept
s@RxNormConcept' {} Maybe Double
a -> RxNormConcept
s {$sel:score:RxNormConcept' :: Maybe Double
score = Maybe Double
a} :: RxNormConcept)

instance Data.FromJSON RxNormConcept where
  parseJSON :: Value -> Parser RxNormConcept
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"RxNormConcept"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Double -> RxNormConcept
RxNormConcept'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Code")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Description")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"Score")
      )

instance Prelude.Hashable RxNormConcept where
  hashWithSalt :: Int -> RxNormConcept -> Int
hashWithSalt Int
_salt RxNormConcept' {Maybe Double
Maybe Text
score :: Maybe Double
description :: Maybe Text
code :: Maybe Text
$sel:score:RxNormConcept' :: RxNormConcept -> Maybe Double
$sel:description:RxNormConcept' :: RxNormConcept -> Maybe Text
$sel:code:RxNormConcept' :: RxNormConcept -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
code
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
score

instance Prelude.NFData RxNormConcept where
  rnf :: RxNormConcept -> ()
rnf RxNormConcept' {Maybe Double
Maybe Text
score :: Maybe Double
description :: Maybe Text
code :: Maybe Text
$sel:score:RxNormConcept' :: RxNormConcept -> Maybe Double
$sel:description:RxNormConcept' :: RxNormConcept -> Maybe Text
$sel:code:RxNormConcept' :: RxNormConcept -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
code
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
score