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

import Amazonka.ComprehendMedical.Types.RxNormAttribute
import Amazonka.ComprehendMedical.Types.RxNormConcept
import Amazonka.ComprehendMedical.Types.RxNormEntityCategory
import Amazonka.ComprehendMedical.Types.RxNormEntityType
import Amazonka.ComprehendMedical.Types.RxNormTrait
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The collection of medical entities extracted from the input text and
-- their associated information. For each entity, the response provides the
-- entity text, the entity category, where the entity text begins and ends,
-- and the level of confidence that Amazon Comprehend Medical has in the
-- detection and analysis. Attributes and traits of the entity are also
-- returned.
--
-- /See:/ 'newRxNormEntity' smart constructor.
data RxNormEntity = RxNormEntity'
  { -- | The RxNorm concepts that the entity could refer to, along with a score
    -- indicating the likelihood of the match.
    RxNormEntity -> Maybe [RxNormConcept]
rxNormConcepts :: Prelude.Maybe [RxNormConcept],
    -- | The 0-based character offset in the input text that shows where the
    -- entity begins. The offset returns the UTF-8 code point in the string.
    RxNormEntity -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
    -- | The segment of input text extracted from which the entity was detected.
    RxNormEntity -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
    -- | The category of the entity. The recognized categories are @GENERIC@ or
    -- @BRAND_NAME@.
    RxNormEntity -> Maybe RxNormEntityCategory
category :: Prelude.Maybe RxNormEntityCategory,
    -- | The level of confidence that Amazon Comprehend Medical has in the
    -- accuracy of the detected entity.
    RxNormEntity -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
    -- | Contextual information for the entity.
    RxNormEntity -> Maybe [RxNormTrait]
traits :: Prelude.Maybe [RxNormTrait],
    -- | The extracted attributes that relate to the entity. The attributes
    -- recognized by InferRxNorm are @DOSAGE@, @DURATION@, @FORM@, @FREQUENCY@,
    -- @RATE@, @ROUTE_OR_MODE@, and @STRENGTH@.
    RxNormEntity -> Maybe [RxNormAttribute]
attributes :: Prelude.Maybe [RxNormAttribute],
    -- | The 0-based character offset in the input text that shows where the
    -- entity ends. The offset returns the UTF-8 code point in the string.
    RxNormEntity -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
    -- | The numeric identifier for the entity. This is a monotonically
    -- increasing id unique within this response rather than a global unique
    -- identifier.
    RxNormEntity -> Maybe Int
id :: Prelude.Maybe Prelude.Int,
    -- | Describes the specific type of entity. For InferRxNorm, the recognized
    -- entity type is @MEDICATION@.
    RxNormEntity -> Maybe RxNormEntityType
type' :: Prelude.Maybe RxNormEntityType
  }
  deriving (RxNormEntity -> RxNormEntity -> Bool
(RxNormEntity -> RxNormEntity -> Bool)
-> (RxNormEntity -> RxNormEntity -> Bool) -> Eq RxNormEntity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RxNormEntity -> RxNormEntity -> Bool
$c/= :: RxNormEntity -> RxNormEntity -> Bool
== :: RxNormEntity -> RxNormEntity -> Bool
$c== :: RxNormEntity -> RxNormEntity -> Bool
Prelude.Eq, ReadPrec [RxNormEntity]
ReadPrec RxNormEntity
Int -> ReadS RxNormEntity
ReadS [RxNormEntity]
(Int -> ReadS RxNormEntity)
-> ReadS [RxNormEntity]
-> ReadPrec RxNormEntity
-> ReadPrec [RxNormEntity]
-> Read RxNormEntity
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RxNormEntity]
$creadListPrec :: ReadPrec [RxNormEntity]
readPrec :: ReadPrec RxNormEntity
$creadPrec :: ReadPrec RxNormEntity
readList :: ReadS [RxNormEntity]
$creadList :: ReadS [RxNormEntity]
readsPrec :: Int -> ReadS RxNormEntity
$creadsPrec :: Int -> ReadS RxNormEntity
Prelude.Read, Int -> RxNormEntity -> ShowS
[RxNormEntity] -> ShowS
RxNormEntity -> String
(Int -> RxNormEntity -> ShowS)
-> (RxNormEntity -> String)
-> ([RxNormEntity] -> ShowS)
-> Show RxNormEntity
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RxNormEntity] -> ShowS
$cshowList :: [RxNormEntity] -> ShowS
show :: RxNormEntity -> String
$cshow :: RxNormEntity -> String
showsPrec :: Int -> RxNormEntity -> ShowS
$cshowsPrec :: Int -> RxNormEntity -> ShowS
Prelude.Show, (forall x. RxNormEntity -> Rep RxNormEntity x)
-> (forall x. Rep RxNormEntity x -> RxNormEntity)
-> Generic RxNormEntity
forall x. Rep RxNormEntity x -> RxNormEntity
forall x. RxNormEntity -> Rep RxNormEntity x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RxNormEntity x -> RxNormEntity
$cfrom :: forall x. RxNormEntity -> Rep RxNormEntity x
Prelude.Generic)

-- |
-- Create a value of 'RxNormEntity' 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:
--
-- 'rxNormConcepts', 'rxNormEntity_rxNormConcepts' - The RxNorm concepts that the entity could refer to, along with a score
-- indicating the likelihood of the match.
--
-- 'beginOffset', 'rxNormEntity_beginOffset' - The 0-based character offset in the input text that shows where the
-- entity begins. The offset returns the UTF-8 code point in the string.
--
-- 'text', 'rxNormEntity_text' - The segment of input text extracted from which the entity was detected.
--
-- 'category', 'rxNormEntity_category' - The category of the entity. The recognized categories are @GENERIC@ or
-- @BRAND_NAME@.
--
-- 'score', 'rxNormEntity_score' - The level of confidence that Amazon Comprehend Medical has in the
-- accuracy of the detected entity.
--
-- 'traits', 'rxNormEntity_traits' - Contextual information for the entity.
--
-- 'attributes', 'rxNormEntity_attributes' - The extracted attributes that relate to the entity. The attributes
-- recognized by InferRxNorm are @DOSAGE@, @DURATION@, @FORM@, @FREQUENCY@,
-- @RATE@, @ROUTE_OR_MODE@, and @STRENGTH@.
--
-- 'endOffset', 'rxNormEntity_endOffset' - The 0-based character offset in the input text that shows where the
-- entity ends. The offset returns the UTF-8 code point in the string.
--
-- 'id', 'rxNormEntity_id' - The numeric identifier for the entity. This is a monotonically
-- increasing id unique within this response rather than a global unique
-- identifier.
--
-- 'type'', 'rxNormEntity_type' - Describes the specific type of entity. For InferRxNorm, the recognized
-- entity type is @MEDICATION@.
newRxNormEntity ::
  RxNormEntity
newRxNormEntity :: RxNormEntity
newRxNormEntity =
  RxNormEntity' :: Maybe [RxNormConcept]
-> Maybe Int
-> Maybe Text
-> Maybe RxNormEntityCategory
-> Maybe Double
-> Maybe [RxNormTrait]
-> Maybe [RxNormAttribute]
-> Maybe Int
-> Maybe Int
-> Maybe RxNormEntityType
-> RxNormEntity
RxNormEntity'
    { $sel:rxNormConcepts:RxNormEntity' :: Maybe [RxNormConcept]
rxNormConcepts = Maybe [RxNormConcept]
forall a. Maybe a
Prelude.Nothing,
      $sel:beginOffset:RxNormEntity' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:text:RxNormEntity' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:category:RxNormEntity' :: Maybe RxNormEntityCategory
category = Maybe RxNormEntityCategory
forall a. Maybe a
Prelude.Nothing,
      $sel:score:RxNormEntity' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:traits:RxNormEntity' :: Maybe [RxNormTrait]
traits = Maybe [RxNormTrait]
forall a. Maybe a
Prelude.Nothing,
      $sel:attributes:RxNormEntity' :: Maybe [RxNormAttribute]
attributes = Maybe [RxNormAttribute]
forall a. Maybe a
Prelude.Nothing,
      $sel:endOffset:RxNormEntity' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:id:RxNormEntity' :: Maybe Int
id = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:type':RxNormEntity' :: Maybe RxNormEntityType
type' = Maybe RxNormEntityType
forall a. Maybe a
Prelude.Nothing
    }

-- | The RxNorm concepts that the entity could refer to, along with a score
-- indicating the likelihood of the match.
rxNormEntity_rxNormConcepts :: Lens.Lens' RxNormEntity (Prelude.Maybe [RxNormConcept])
rxNormEntity_rxNormConcepts :: (Maybe [RxNormConcept] -> f (Maybe [RxNormConcept]))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_rxNormConcepts = (RxNormEntity -> Maybe [RxNormConcept])
-> (RxNormEntity -> Maybe [RxNormConcept] -> RxNormEntity)
-> Lens
     RxNormEntity
     RxNormEntity
     (Maybe [RxNormConcept])
     (Maybe [RxNormConcept])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe [RxNormConcept]
rxNormConcepts :: Maybe [RxNormConcept]
$sel:rxNormConcepts:RxNormEntity' :: RxNormEntity -> Maybe [RxNormConcept]
rxNormConcepts} -> Maybe [RxNormConcept]
rxNormConcepts) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe [RxNormConcept]
a -> RxNormEntity
s {$sel:rxNormConcepts:RxNormEntity' :: Maybe [RxNormConcept]
rxNormConcepts = Maybe [RxNormConcept]
a} :: RxNormEntity) ((Maybe [RxNormConcept] -> f (Maybe [RxNormConcept]))
 -> RxNormEntity -> f RxNormEntity)
-> ((Maybe [RxNormConcept] -> f (Maybe [RxNormConcept]))
    -> Maybe [RxNormConcept] -> f (Maybe [RxNormConcept]))
-> (Maybe [RxNormConcept] -> f (Maybe [RxNormConcept]))
-> RxNormEntity
-> f RxNormEntity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RxNormConcept] [RxNormConcept] [RxNormConcept] [RxNormConcept]
-> Iso
     (Maybe [RxNormConcept])
     (Maybe [RxNormConcept])
     (Maybe [RxNormConcept])
     (Maybe [RxNormConcept])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [RxNormConcept] [RxNormConcept] [RxNormConcept] [RxNormConcept]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The 0-based character offset in the input text that shows where the
-- entity begins. The offset returns the UTF-8 code point in the string.
rxNormEntity_beginOffset :: Lens.Lens' RxNormEntity (Prelude.Maybe Prelude.Int)
rxNormEntity_beginOffset :: (Maybe Int -> f (Maybe Int)) -> RxNormEntity -> f RxNormEntity
rxNormEntity_beginOffset = (RxNormEntity -> Maybe Int)
-> (RxNormEntity -> Maybe Int -> RxNormEntity)
-> Lens RxNormEntity RxNormEntity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:RxNormEntity' :: RxNormEntity -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe Int
a -> RxNormEntity
s {$sel:beginOffset:RxNormEntity' :: Maybe Int
beginOffset = Maybe Int
a} :: RxNormEntity)

-- | The segment of input text extracted from which the entity was detected.
rxNormEntity_text :: Lens.Lens' RxNormEntity (Prelude.Maybe Prelude.Text)
rxNormEntity_text :: (Maybe Text -> f (Maybe Text)) -> RxNormEntity -> f RxNormEntity
rxNormEntity_text = (RxNormEntity -> Maybe Text)
-> (RxNormEntity -> Maybe Text -> RxNormEntity)
-> Lens RxNormEntity RxNormEntity (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe Text
text :: Maybe Text
$sel:text:RxNormEntity' :: RxNormEntity -> Maybe Text
text} -> Maybe Text
text) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe Text
a -> RxNormEntity
s {$sel:text:RxNormEntity' :: Maybe Text
text = Maybe Text
a} :: RxNormEntity)

-- | The category of the entity. The recognized categories are @GENERIC@ or
-- @BRAND_NAME@.
rxNormEntity_category :: Lens.Lens' RxNormEntity (Prelude.Maybe RxNormEntityCategory)
rxNormEntity_category :: (Maybe RxNormEntityCategory -> f (Maybe RxNormEntityCategory))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_category = (RxNormEntity -> Maybe RxNormEntityCategory)
-> (RxNormEntity -> Maybe RxNormEntityCategory -> RxNormEntity)
-> Lens
     RxNormEntity
     RxNormEntity
     (Maybe RxNormEntityCategory)
     (Maybe RxNormEntityCategory)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe RxNormEntityCategory
category :: Maybe RxNormEntityCategory
$sel:category:RxNormEntity' :: RxNormEntity -> Maybe RxNormEntityCategory
category} -> Maybe RxNormEntityCategory
category) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe RxNormEntityCategory
a -> RxNormEntity
s {$sel:category:RxNormEntity' :: Maybe RxNormEntityCategory
category = Maybe RxNormEntityCategory
a} :: RxNormEntity)

-- | The level of confidence that Amazon Comprehend Medical has in the
-- accuracy of the detected entity.
rxNormEntity_score :: Lens.Lens' RxNormEntity (Prelude.Maybe Prelude.Double)
rxNormEntity_score :: (Maybe Double -> f (Maybe Double))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_score = (RxNormEntity -> Maybe Double)
-> (RxNormEntity -> Maybe Double -> RxNormEntity)
-> Lens RxNormEntity RxNormEntity (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe Double
score :: Maybe Double
$sel:score:RxNormEntity' :: RxNormEntity -> Maybe Double
score} -> Maybe Double
score) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe Double
a -> RxNormEntity
s {$sel:score:RxNormEntity' :: Maybe Double
score = Maybe Double
a} :: RxNormEntity)

-- | Contextual information for the entity.
rxNormEntity_traits :: Lens.Lens' RxNormEntity (Prelude.Maybe [RxNormTrait])
rxNormEntity_traits :: (Maybe [RxNormTrait] -> f (Maybe [RxNormTrait]))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_traits = (RxNormEntity -> Maybe [RxNormTrait])
-> (RxNormEntity -> Maybe [RxNormTrait] -> RxNormEntity)
-> Lens
     RxNormEntity
     RxNormEntity
     (Maybe [RxNormTrait])
     (Maybe [RxNormTrait])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe [RxNormTrait]
traits :: Maybe [RxNormTrait]
$sel:traits:RxNormEntity' :: RxNormEntity -> Maybe [RxNormTrait]
traits} -> Maybe [RxNormTrait]
traits) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe [RxNormTrait]
a -> RxNormEntity
s {$sel:traits:RxNormEntity' :: Maybe [RxNormTrait]
traits = Maybe [RxNormTrait]
a} :: RxNormEntity) ((Maybe [RxNormTrait] -> f (Maybe [RxNormTrait]))
 -> RxNormEntity -> f RxNormEntity)
-> ((Maybe [RxNormTrait] -> f (Maybe [RxNormTrait]))
    -> Maybe [RxNormTrait] -> f (Maybe [RxNormTrait]))
-> (Maybe [RxNormTrait] -> f (Maybe [RxNormTrait]))
-> RxNormEntity
-> f RxNormEntity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [RxNormTrait] [RxNormTrait] [RxNormTrait] [RxNormTrait]
-> Iso
     (Maybe [RxNormTrait])
     (Maybe [RxNormTrait])
     (Maybe [RxNormTrait])
     (Maybe [RxNormTrait])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [RxNormTrait] [RxNormTrait] [RxNormTrait] [RxNormTrait]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The extracted attributes that relate to the entity. The attributes
-- recognized by InferRxNorm are @DOSAGE@, @DURATION@, @FORM@, @FREQUENCY@,
-- @RATE@, @ROUTE_OR_MODE@, and @STRENGTH@.
rxNormEntity_attributes :: Lens.Lens' RxNormEntity (Prelude.Maybe [RxNormAttribute])
rxNormEntity_attributes :: (Maybe [RxNormAttribute] -> f (Maybe [RxNormAttribute]))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_attributes = (RxNormEntity -> Maybe [RxNormAttribute])
-> (RxNormEntity -> Maybe [RxNormAttribute] -> RxNormEntity)
-> Lens
     RxNormEntity
     RxNormEntity
     (Maybe [RxNormAttribute])
     (Maybe [RxNormAttribute])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe [RxNormAttribute]
attributes :: Maybe [RxNormAttribute]
$sel:attributes:RxNormEntity' :: RxNormEntity -> Maybe [RxNormAttribute]
attributes} -> Maybe [RxNormAttribute]
attributes) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe [RxNormAttribute]
a -> RxNormEntity
s {$sel:attributes:RxNormEntity' :: Maybe [RxNormAttribute]
attributes = Maybe [RxNormAttribute]
a} :: RxNormEntity) ((Maybe [RxNormAttribute] -> f (Maybe [RxNormAttribute]))
 -> RxNormEntity -> f RxNormEntity)
-> ((Maybe [RxNormAttribute] -> f (Maybe [RxNormAttribute]))
    -> Maybe [RxNormAttribute] -> f (Maybe [RxNormAttribute]))
-> (Maybe [RxNormAttribute] -> f (Maybe [RxNormAttribute]))
-> RxNormEntity
-> f RxNormEntity
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RxNormAttribute]
  [RxNormAttribute]
  [RxNormAttribute]
  [RxNormAttribute]
-> Iso
     (Maybe [RxNormAttribute])
     (Maybe [RxNormAttribute])
     (Maybe [RxNormAttribute])
     (Maybe [RxNormAttribute])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [RxNormAttribute]
  [RxNormAttribute]
  [RxNormAttribute]
  [RxNormAttribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The 0-based character offset in the input text that shows where the
-- entity ends. The offset returns the UTF-8 code point in the string.
rxNormEntity_endOffset :: Lens.Lens' RxNormEntity (Prelude.Maybe Prelude.Int)
rxNormEntity_endOffset :: (Maybe Int -> f (Maybe Int)) -> RxNormEntity -> f RxNormEntity
rxNormEntity_endOffset = (RxNormEntity -> Maybe Int)
-> (RxNormEntity -> Maybe Int -> RxNormEntity)
-> Lens RxNormEntity RxNormEntity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:RxNormEntity' :: RxNormEntity -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe Int
a -> RxNormEntity
s {$sel:endOffset:RxNormEntity' :: Maybe Int
endOffset = Maybe Int
a} :: RxNormEntity)

-- | The numeric identifier for the entity. This is a monotonically
-- increasing id unique within this response rather than a global unique
-- identifier.
rxNormEntity_id :: Lens.Lens' RxNormEntity (Prelude.Maybe Prelude.Int)
rxNormEntity_id :: (Maybe Int -> f (Maybe Int)) -> RxNormEntity -> f RxNormEntity
rxNormEntity_id = (RxNormEntity -> Maybe Int)
-> (RxNormEntity -> Maybe Int -> RxNormEntity)
-> Lens RxNormEntity RxNormEntity (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe Int
id :: Maybe Int
$sel:id:RxNormEntity' :: RxNormEntity -> Maybe Int
id} -> Maybe Int
id) (\s :: RxNormEntity
s@RxNormEntity' {} Maybe Int
a -> RxNormEntity
s {$sel:id:RxNormEntity' :: Maybe Int
id = Maybe Int
a} :: RxNormEntity)

-- | Describes the specific type of entity. For InferRxNorm, the recognized
-- entity type is @MEDICATION@.
rxNormEntity_type :: Lens.Lens' RxNormEntity (Prelude.Maybe RxNormEntityType)
rxNormEntity_type :: (Maybe RxNormEntityType -> f (Maybe RxNormEntityType))
-> RxNormEntity -> f RxNormEntity
rxNormEntity_type = (RxNormEntity -> Maybe RxNormEntityType)
-> (RxNormEntity -> Maybe RxNormEntityType -> RxNormEntity)
-> Lens
     RxNormEntity
     RxNormEntity
     (Maybe RxNormEntityType)
     (Maybe RxNormEntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RxNormEntity' {Maybe RxNormEntityType
type' :: Maybe RxNormEntityType
$sel:type':RxNormEntity' :: RxNormEntity -> Maybe RxNormEntityType
type'} -> Maybe RxNormEntityType
type') (\s :: RxNormEntity
s@RxNormEntity' {} Maybe RxNormEntityType
a -> RxNormEntity
s {$sel:type':RxNormEntity' :: Maybe RxNormEntityType
type' = Maybe RxNormEntityType
a} :: RxNormEntity)

instance Core.FromJSON RxNormEntity where
  parseJSON :: Value -> Parser RxNormEntity
parseJSON =
    String
-> (Object -> Parser RxNormEntity) -> Value -> Parser RxNormEntity
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"RxNormEntity"
      ( \Object
x ->
          Maybe [RxNormConcept]
-> Maybe Int
-> Maybe Text
-> Maybe RxNormEntityCategory
-> Maybe Double
-> Maybe [RxNormTrait]
-> Maybe [RxNormAttribute]
-> Maybe Int
-> Maybe Int
-> Maybe RxNormEntityType
-> RxNormEntity
RxNormEntity'
            (Maybe [RxNormConcept]
 -> Maybe Int
 -> Maybe Text
 -> Maybe RxNormEntityCategory
 -> Maybe Double
 -> Maybe [RxNormTrait]
 -> Maybe [RxNormAttribute]
 -> Maybe Int
 -> Maybe Int
 -> Maybe RxNormEntityType
 -> RxNormEntity)
-> Parser (Maybe [RxNormConcept])
-> Parser
     (Maybe Int
      -> Maybe Text
      -> Maybe RxNormEntityCategory
      -> Maybe Double
      -> Maybe [RxNormTrait]
      -> Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (Maybe [RxNormConcept]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RxNormConcepts" Parser (Maybe (Maybe [RxNormConcept]))
-> Maybe [RxNormConcept] -> Parser (Maybe [RxNormConcept])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RxNormConcept]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Int
   -> Maybe Text
   -> Maybe RxNormEntityCategory
   -> Maybe Double
   -> Maybe [RxNormTrait]
   -> Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe Int)
-> Parser
     (Maybe Text
      -> Maybe RxNormEntityCategory
      -> Maybe Double
      -> Maybe [RxNormTrait]
      -> Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"BeginOffset")
            Parser
  (Maybe Text
   -> Maybe RxNormEntityCategory
   -> Maybe Double
   -> Maybe [RxNormTrait]
   -> Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe Text)
-> Parser
     (Maybe RxNormEntityCategory
      -> Maybe Double
      -> Maybe [RxNormTrait]
      -> Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
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
"Text")
            Parser
  (Maybe RxNormEntityCategory
   -> Maybe Double
   -> Maybe [RxNormTrait]
   -> Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe RxNormEntityCategory)
-> Parser
     (Maybe Double
      -> Maybe [RxNormTrait]
      -> Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RxNormEntityCategory)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Category")
            Parser
  (Maybe Double
   -> Maybe [RxNormTrait]
   -> Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe Double)
-> Parser
     (Maybe [RxNormTrait]
      -> Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => 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 [RxNormTrait]
   -> Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe [RxNormTrait])
-> Parser
     (Maybe [RxNormAttribute]
      -> Maybe Int
      -> Maybe Int
      -> Maybe RxNormEntityType
      -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [RxNormTrait]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Traits" Parser (Maybe (Maybe [RxNormTrait]))
-> Maybe [RxNormTrait] -> Parser (Maybe [RxNormTrait])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RxNormTrait]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe [RxNormAttribute]
   -> Maybe Int
   -> Maybe Int
   -> Maybe RxNormEntityType
   -> RxNormEntity)
-> Parser (Maybe [RxNormAttribute])
-> Parser
     (Maybe Int -> Maybe Int -> Maybe RxNormEntityType -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [RxNormAttribute]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Attributes" Parser (Maybe (Maybe [RxNormAttribute]))
-> Maybe [RxNormAttribute] -> Parser (Maybe [RxNormAttribute])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [RxNormAttribute]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Int -> Maybe Int -> Maybe RxNormEntityType -> RxNormEntity)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe RxNormEntityType -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"EndOffset")
            Parser (Maybe Int -> Maybe RxNormEntityType -> RxNormEntity)
-> Parser (Maybe Int)
-> Parser (Maybe RxNormEntityType -> RxNormEntity)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Id")
            Parser (Maybe RxNormEntityType -> RxNormEntity)
-> Parser (Maybe RxNormEntityType) -> Parser RxNormEntity
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RxNormEntityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
      )

instance Prelude.Hashable RxNormEntity

instance Prelude.NFData RxNormEntity