{-# 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 #-}
module Amazonka.ComprehendMedical.Types.Attribute where
import Amazonka.ComprehendMedical.Types.EntitySubType
import Amazonka.ComprehendMedical.Types.EntityType
import Amazonka.ComprehendMedical.Types.RelationshipType
import Amazonka.ComprehendMedical.Types.Trait
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Attribute = Attribute'
{
Attribute -> Maybe Double
relationshipScore :: Prelude.Maybe Prelude.Double,
Attribute -> Maybe Int
beginOffset :: Prelude.Maybe Prelude.Int,
Attribute -> Maybe Text
text :: Prelude.Maybe Prelude.Text,
Attribute -> Maybe EntityType
category :: Prelude.Maybe EntityType,
Attribute -> Maybe Double
score :: Prelude.Maybe Prelude.Double,
Attribute -> Maybe [Trait]
traits :: Prelude.Maybe [Trait],
Attribute -> Maybe RelationshipType
relationshipType :: Prelude.Maybe RelationshipType,
Attribute -> Maybe Int
endOffset :: Prelude.Maybe Prelude.Int,
Attribute -> Maybe Int
id :: Prelude.Maybe Prelude.Int,
Attribute -> Maybe EntitySubType
type' :: Prelude.Maybe EntitySubType
}
deriving (Attribute -> Attribute -> Bool
(Attribute -> Attribute -> Bool)
-> (Attribute -> Attribute -> Bool) -> Eq Attribute
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Attribute -> Attribute -> Bool
$c/= :: Attribute -> Attribute -> Bool
== :: Attribute -> Attribute -> Bool
$c== :: Attribute -> Attribute -> Bool
Prelude.Eq, ReadPrec [Attribute]
ReadPrec Attribute
Int -> ReadS Attribute
ReadS [Attribute]
(Int -> ReadS Attribute)
-> ReadS [Attribute]
-> ReadPrec Attribute
-> ReadPrec [Attribute]
-> Read Attribute
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Attribute]
$creadListPrec :: ReadPrec [Attribute]
readPrec :: ReadPrec Attribute
$creadPrec :: ReadPrec Attribute
readList :: ReadS [Attribute]
$creadList :: ReadS [Attribute]
readsPrec :: Int -> ReadS Attribute
$creadsPrec :: Int -> ReadS Attribute
Prelude.Read, Int -> Attribute -> ShowS
[Attribute] -> ShowS
Attribute -> String
(Int -> Attribute -> ShowS)
-> (Attribute -> String)
-> ([Attribute] -> ShowS)
-> Show Attribute
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Attribute] -> ShowS
$cshowList :: [Attribute] -> ShowS
show :: Attribute -> String
$cshow :: Attribute -> String
showsPrec :: Int -> Attribute -> ShowS
$cshowsPrec :: Int -> Attribute -> ShowS
Prelude.Show, (forall x. Attribute -> Rep Attribute x)
-> (forall x. Rep Attribute x -> Attribute) -> Generic Attribute
forall x. Rep Attribute x -> Attribute
forall x. Attribute -> Rep Attribute x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Attribute x -> Attribute
$cfrom :: forall x. Attribute -> Rep Attribute x
Prelude.Generic)
newAttribute ::
Attribute
newAttribute :: Attribute
newAttribute =
Attribute' :: Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute
Attribute'
{ $sel:relationshipScore:Attribute' :: Maybe Double
relationshipScore = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:beginOffset:Attribute' :: Maybe Int
beginOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:text:Attribute' :: Maybe Text
text = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:category:Attribute' :: Maybe EntityType
category = Maybe EntityType
forall a. Maybe a
Prelude.Nothing,
$sel:score:Attribute' :: Maybe Double
score = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:traits:Attribute' :: Maybe [Trait]
traits = Maybe [Trait]
forall a. Maybe a
Prelude.Nothing,
$sel:relationshipType:Attribute' :: Maybe RelationshipType
relationshipType = Maybe RelationshipType
forall a. Maybe a
Prelude.Nothing,
$sel:endOffset:Attribute' :: Maybe Int
endOffset = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:id:Attribute' :: Maybe Int
id = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:type':Attribute' :: Maybe EntitySubType
type' = Maybe EntitySubType
forall a. Maybe a
Prelude.Nothing
}
attribute_relationshipScore :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_relationshipScore :: (Maybe Double -> f (Maybe Double)) -> Attribute -> f Attribute
attribute_relationshipScore = (Attribute -> Maybe Double)
-> (Attribute -> Maybe Double -> Attribute)
-> Lens Attribute Attribute (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
relationshipScore :: Maybe Double
$sel:relationshipScore:Attribute' :: Attribute -> Maybe Double
relationshipScore} -> Maybe Double
relationshipScore) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:relationshipScore:Attribute' :: Maybe Double
relationshipScore = Maybe Double
a} :: Attribute)
attribute_beginOffset :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_beginOffset :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_beginOffset = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
beginOffset :: Maybe Int
$sel:beginOffset:Attribute' :: Attribute -> Maybe Int
beginOffset} -> Maybe Int
beginOffset) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:beginOffset:Attribute' :: Maybe Int
beginOffset = Maybe Int
a} :: Attribute)
attribute_text :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Text)
attribute_text :: (Maybe Text -> f (Maybe Text)) -> Attribute -> f Attribute
attribute_text = (Attribute -> Maybe Text)
-> (Attribute -> Maybe Text -> Attribute)
-> Lens Attribute Attribute (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Text
text :: Maybe Text
$sel:text:Attribute' :: Attribute -> Maybe Text
text} -> Maybe Text
text) (\s :: Attribute
s@Attribute' {} Maybe Text
a -> Attribute
s {$sel:text:Attribute' :: Maybe Text
text = Maybe Text
a} :: Attribute)
attribute_category :: Lens.Lens' Attribute (Prelude.Maybe EntityType)
attribute_category :: (Maybe EntityType -> f (Maybe EntityType))
-> Attribute -> f Attribute
attribute_category = (Attribute -> Maybe EntityType)
-> (Attribute -> Maybe EntityType -> Attribute)
-> Lens Attribute Attribute (Maybe EntityType) (Maybe EntityType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe EntityType
category :: Maybe EntityType
$sel:category:Attribute' :: Attribute -> Maybe EntityType
category} -> Maybe EntityType
category) (\s :: Attribute
s@Attribute' {} Maybe EntityType
a -> Attribute
s {$sel:category:Attribute' :: Maybe EntityType
category = Maybe EntityType
a} :: Attribute)
attribute_score :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Double)
attribute_score :: (Maybe Double -> f (Maybe Double)) -> Attribute -> f Attribute
attribute_score = (Attribute -> Maybe Double)
-> (Attribute -> Maybe Double -> Attribute)
-> Lens Attribute Attribute (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Double
score :: Maybe Double
$sel:score:Attribute' :: Attribute -> Maybe Double
score} -> Maybe Double
score) (\s :: Attribute
s@Attribute' {} Maybe Double
a -> Attribute
s {$sel:score:Attribute' :: Maybe Double
score = Maybe Double
a} :: Attribute)
attribute_traits :: Lens.Lens' Attribute (Prelude.Maybe [Trait])
attribute_traits :: (Maybe [Trait] -> f (Maybe [Trait])) -> Attribute -> f Attribute
attribute_traits = (Attribute -> Maybe [Trait])
-> (Attribute -> Maybe [Trait] -> Attribute)
-> Lens Attribute Attribute (Maybe [Trait]) (Maybe [Trait])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe [Trait]
traits :: Maybe [Trait]
$sel:traits:Attribute' :: Attribute -> Maybe [Trait]
traits} -> Maybe [Trait]
traits) (\s :: Attribute
s@Attribute' {} Maybe [Trait]
a -> Attribute
s {$sel:traits:Attribute' :: Maybe [Trait]
traits = Maybe [Trait]
a} :: Attribute) ((Maybe [Trait] -> f (Maybe [Trait])) -> Attribute -> f Attribute)
-> ((Maybe [Trait] -> f (Maybe [Trait]))
-> Maybe [Trait] -> f (Maybe [Trait]))
-> (Maybe [Trait] -> f (Maybe [Trait]))
-> Attribute
-> f Attribute
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Trait] [Trait] [Trait] [Trait]
-> Iso
(Maybe [Trait]) (Maybe [Trait]) (Maybe [Trait]) (Maybe [Trait])
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 [Trait] [Trait] [Trait] [Trait]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
attribute_relationshipType :: Lens.Lens' Attribute (Prelude.Maybe RelationshipType)
attribute_relationshipType :: (Maybe RelationshipType -> f (Maybe RelationshipType))
-> Attribute -> f Attribute
attribute_relationshipType = (Attribute -> Maybe RelationshipType)
-> (Attribute -> Maybe RelationshipType -> Attribute)
-> Lens
Attribute
Attribute
(Maybe RelationshipType)
(Maybe RelationshipType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe RelationshipType
relationshipType :: Maybe RelationshipType
$sel:relationshipType:Attribute' :: Attribute -> Maybe RelationshipType
relationshipType} -> Maybe RelationshipType
relationshipType) (\s :: Attribute
s@Attribute' {} Maybe RelationshipType
a -> Attribute
s {$sel:relationshipType:Attribute' :: Maybe RelationshipType
relationshipType = Maybe RelationshipType
a} :: Attribute)
attribute_endOffset :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_endOffset :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_endOffset = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
endOffset :: Maybe Int
$sel:endOffset:Attribute' :: Attribute -> Maybe Int
endOffset} -> Maybe Int
endOffset) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:endOffset:Attribute' :: Maybe Int
endOffset = Maybe Int
a} :: Attribute)
attribute_id :: Lens.Lens' Attribute (Prelude.Maybe Prelude.Int)
attribute_id :: (Maybe Int -> f (Maybe Int)) -> Attribute -> f Attribute
attribute_id = (Attribute -> Maybe Int)
-> (Attribute -> Maybe Int -> Attribute)
-> Lens Attribute Attribute (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe Int
id :: Maybe Int
$sel:id:Attribute' :: Attribute -> Maybe Int
id} -> Maybe Int
id) (\s :: Attribute
s@Attribute' {} Maybe Int
a -> Attribute
s {$sel:id:Attribute' :: Maybe Int
id = Maybe Int
a} :: Attribute)
attribute_type :: Lens.Lens' Attribute (Prelude.Maybe EntitySubType)
attribute_type :: (Maybe EntitySubType -> f (Maybe EntitySubType))
-> Attribute -> f Attribute
attribute_type = (Attribute -> Maybe EntitySubType)
-> (Attribute -> Maybe EntitySubType -> Attribute)
-> Lens
Attribute Attribute (Maybe EntitySubType) (Maybe EntitySubType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Attribute' {Maybe EntitySubType
type' :: Maybe EntitySubType
$sel:type':Attribute' :: Attribute -> Maybe EntitySubType
type'} -> Maybe EntitySubType
type') (\s :: Attribute
s@Attribute' {} Maybe EntitySubType
a -> Attribute
s {$sel:type':Attribute' :: Maybe EntitySubType
type' = Maybe EntitySubType
a} :: Attribute)
instance Core.FromJSON Attribute where
parseJSON :: Value -> Parser Attribute
parseJSON =
String -> (Object -> Parser Attribute) -> Value -> Parser Attribute
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Attribute"
( \Object
x ->
Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute
Attribute'
(Maybe Double
-> Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe Double)
-> Parser
(Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
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
"RelationshipScore")
Parser
(Maybe Int
-> Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe Int)
-> Parser
(Maybe Text
-> Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
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 EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe Text)
-> Parser
(Maybe EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
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 EntityType
-> Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe EntityType)
-> Parser
(Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntityType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Category")
Parser
(Maybe Double
-> Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe Double)
-> Parser
(Maybe [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
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 [Trait]
-> Maybe RelationshipType
-> Maybe Int
-> Maybe Int
-> Maybe EntitySubType
-> Attribute)
-> Parser (Maybe [Trait])
-> Parser
(Maybe RelationshipType
-> Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Trait]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Traits" Parser (Maybe (Maybe [Trait]))
-> Maybe [Trait] -> Parser (Maybe [Trait])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Trait]
forall a. Monoid a => a
Prelude.mempty)
Parser
(Maybe RelationshipType
-> Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
-> Parser (Maybe RelationshipType)
-> Parser
(Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe RelationshipType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RelationshipType")
Parser (Maybe Int -> Maybe Int -> Maybe EntitySubType -> Attribute)
-> Parser (Maybe Int)
-> Parser (Maybe Int -> Maybe EntitySubType -> Attribute)
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 EntitySubType -> Attribute)
-> Parser (Maybe Int) -> Parser (Maybe EntitySubType -> Attribute)
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 EntitySubType -> Attribute)
-> Parser (Maybe EntitySubType) -> Parser Attribute
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe EntitySubType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Type")
)
instance Prelude.Hashable Attribute
instance Prelude.NFData Attribute