{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
module Claims.Types
(
Claim(..)
, ClaimType(..)
, ValidationResult(..)
, Rule(..)
, greaterThan
, lessThan
, between
, hasDx
, hasPx
, isType
, pos
, reject
, approve
, needsReview
) where
import Data.Text (Text)
import Data.Time (Day)
import Data.Decimal (Decimal)
data Claim = Claim
{ Claim -> Text
claimId :: Text
, Claim -> Text
patientId :: Text
, Claim -> Text
providerId :: Text
, Claim -> Day
serviceDate :: Day
, Claim -> Decimal
totalAmount :: Decimal
, Claim -> [Text]
diagnosisCodes :: [Text]
, Claim -> [Text]
procedureCodes :: [Text]
, Claim -> Text
placeOfService :: Text
, Claim -> ClaimType
claimType :: ClaimType
} deriving (Int -> Claim -> ShowS
[Claim] -> ShowS
Claim -> String
(Int -> Claim -> ShowS)
-> (Claim -> String) -> ([Claim] -> ShowS) -> Show Claim
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Claim -> ShowS
showsPrec :: Int -> Claim -> ShowS
$cshow :: Claim -> String
show :: Claim -> String
$cshowList :: [Claim] -> ShowS
showList :: [Claim] -> ShowS
Show, Claim -> Claim -> Bool
(Claim -> Claim -> Bool) -> (Claim -> Claim -> Bool) -> Eq Claim
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Claim -> Claim -> Bool
== :: Claim -> Claim -> Bool
$c/= :: Claim -> Claim -> Bool
/= :: Claim -> Claim -> Bool
Eq)
data ClaimType
= Inpatient
| Outpatient
| Professional
deriving (Int -> ClaimType -> ShowS
[ClaimType] -> ShowS
ClaimType -> String
(Int -> ClaimType -> ShowS)
-> (ClaimType -> String)
-> ([ClaimType] -> ShowS)
-> Show ClaimType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ClaimType -> ShowS
showsPrec :: Int -> ClaimType -> ShowS
$cshow :: ClaimType -> String
show :: ClaimType -> String
$cshowList :: [ClaimType] -> ShowS
showList :: [ClaimType] -> ShowS
Show, ClaimType -> ClaimType -> Bool
(ClaimType -> ClaimType -> Bool)
-> (ClaimType -> ClaimType -> Bool) -> Eq ClaimType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ClaimType -> ClaimType -> Bool
== :: ClaimType -> ClaimType -> Bool
$c/= :: ClaimType -> ClaimType -> Bool
/= :: ClaimType -> ClaimType -> Bool
Eq)
data ValidationResult
= Valid
| Invalid Text
deriving (Int -> ValidationResult -> ShowS
[ValidationResult] -> ShowS
ValidationResult -> String
(Int -> ValidationResult -> ShowS)
-> (ValidationResult -> String)
-> ([ValidationResult] -> ShowS)
-> Show ValidationResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ValidationResult -> ShowS
showsPrec :: Int -> ValidationResult -> ShowS
$cshow :: ValidationResult -> String
show :: ValidationResult -> String
$cshowList :: [ValidationResult] -> ShowS
showList :: [ValidationResult] -> ShowS
Show, ValidationResult -> ValidationResult -> Bool
(ValidationResult -> ValidationResult -> Bool)
-> (ValidationResult -> ValidationResult -> Bool)
-> Eq ValidationResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ValidationResult -> ValidationResult -> Bool
== :: ValidationResult -> ValidationResult -> Bool
$c/= :: ValidationResult -> ValidationResult -> Bool
/= :: ValidationResult -> ValidationResult -> Bool
Eq)
data Rule a where
AmountGreaterThan :: Decimal -> Rule Bool
AmountLessThan :: Decimal -> Rule Bool
AmountBetween :: Decimal -> Decimal -> Rule Bool
HasDiagnosisCode :: Text -> Rule Bool
HasProcedureCode :: Text -> Rule Bool
IsClaimType :: ClaimType -> Rule Bool
PlaceOfServiceIs :: Text -> Rule Bool
And :: Rule Bool -> Rule Bool -> Rule Bool
Or :: Rule Bool -> Rule Bool -> Rule Bool
Not :: Rule Bool -> Rule Bool
Reject :: Text -> Rule ValidationResult
Approve :: Rule ValidationResult
RequireReview :: Text -> Rule ValidationResult
If :: Rule Bool -> Rule ValidationResult -> Rule ValidationResult -> Rule ValidationResult
greaterThan :: Decimal -> Rule Bool
greaterThan :: Decimal -> Rule Bool
greaterThan = Decimal -> Rule Bool
AmountGreaterThan
lessThan :: Decimal -> Rule Bool
lessThan :: Decimal -> Rule Bool
lessThan = Decimal -> Rule Bool
AmountLessThan
between :: Decimal -> Decimal -> Rule Bool
between :: Decimal -> Decimal -> Rule Bool
between = Decimal -> Decimal -> Rule Bool
AmountBetween
hasDx :: Text -> Rule Bool
hasDx :: Text -> Rule Bool
hasDx = Text -> Rule Bool
HasDiagnosisCode
hasPx :: Text -> Rule Bool
hasPx :: Text -> Rule Bool
hasPx = Text -> Rule Bool
HasProcedureCode
isType :: ClaimType -> Rule Bool
isType :: ClaimType -> Rule Bool
isType = ClaimType -> Rule Bool
IsClaimType
pos :: Text -> Rule Bool
pos :: Text -> Rule Bool
pos = Text -> Rule Bool
PlaceOfServiceIs
reject :: Text -> Rule ValidationResult
reject :: Text -> Rule ValidationResult
reject = Text -> Rule ValidationResult
Reject
approve :: Rule ValidationResult
approve :: Rule ValidationResult
approve = Rule ValidationResult
Approve
needsReview :: Text -> Rule ValidationResult
needsReview :: Text -> Rule ValidationResult
needsReview = Text -> Rule ValidationResult
RequireReview