{-# 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-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.RxNormConcept where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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'
  { -- | 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,
    -- | 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
  }
  deriving (RxNormConcept -> RxNormConcept -> Bool
(RxNormConcept -> RxNormConcept -> Bool)
-> (RxNormConcept -> RxNormConcept -> Bool) -> Eq RxNormConcept
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]
(Int -> ReadS RxNormConcept)
-> ReadS [RxNormConcept]
-> ReadPrec RxNormConcept
-> ReadPrec [RxNormConcept]
-> Read 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
(Int -> RxNormConcept -> ShowS)
-> (RxNormConcept -> String)
-> ([RxNormConcept] -> ShowS)
-> Show RxNormConcept
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. RxNormConcept -> Rep RxNormConcept x)
-> (forall x. Rep RxNormConcept x -> RxNormConcept)
-> Generic RxNormConcept
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:
--
-- 'score', 'rxNormConcept_score' - The level of confidence that Amazon Comprehend Medical has that the
-- entity is accurately linked to the reported RxNorm concept.
--
-- 'code', 'rxNormConcept_code' - RxNorm concept ID, also known as the RxCUI.
--
-- 'description', 'rxNormConcept_description' - The description of the RxNorm concept.
newRxNormConcept ::
  RxNormConcept
newRxNormConcept :: RxNormConcept
newRxNormConcept =
  RxNormConcept' :: Maybe Double -> Maybe Text -> Maybe Text -> RxNormConcept
RxNormConcept'
    { $sel:score:RxNormConcept' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:code:RxNormConcept' :: Maybe Text
code = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:RxNormConcept' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Double -> f (Maybe Double))
-> RxNormConcept -> f RxNormConcept
rxNormConcept_score = (RxNormConcept -> Maybe Double)
-> (RxNormConcept -> Maybe Double -> RxNormConcept)
-> Lens RxNormConcept RxNormConcept (Maybe Double) (Maybe Double)
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)

-- | RxNorm concept ID, also known as the RxCUI.
rxNormConcept_code :: Lens.Lens' RxNormConcept (Prelude.Maybe Prelude.Text)
rxNormConcept_code :: (Maybe Text -> f (Maybe Text)) -> RxNormConcept -> f RxNormConcept
rxNormConcept_code = (RxNormConcept -> Maybe Text)
-> (RxNormConcept -> Maybe Text -> RxNormConcept)
-> Lens RxNormConcept RxNormConcept (Maybe Text) (Maybe Text)
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 :: (Maybe Text -> f (Maybe Text)) -> RxNormConcept -> f RxNormConcept
rxNormConcept_description = (RxNormConcept -> Maybe Text)
-> (RxNormConcept -> Maybe Text -> RxNormConcept)
-> Lens RxNormConcept RxNormConcept (Maybe Text) (Maybe Text)
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)

instance Core.FromJSON RxNormConcept where
  parseJSON :: Value -> Parser RxNormConcept
parseJSON =
    String
-> (Object -> Parser RxNormConcept)
-> Value
-> Parser RxNormConcept
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RxNormConcept"
      ( \Object
x ->
          Maybe Double -> Maybe Text -> Maybe Text -> RxNormConcept
RxNormConcept'
            (Maybe Double -> Maybe Text -> Maybe Text -> RxNormConcept)
-> Parser (Maybe Double)
-> Parser (Maybe Text -> Maybe Text -> RxNormConcept)
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 Text -> Maybe Text -> RxNormConcept)
-> Parser (Maybe Text) -> Parser (Maybe Text -> RxNormConcept)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Code")
            Parser (Maybe Text -> RxNormConcept)
-> Parser (Maybe Text) -> Parser RxNormConcept
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Description")
      )

instance Prelude.Hashable RxNormConcept

instance Prelude.NFData RxNormConcept