module Web.View.OutcomeCorrelations.Index where
import Web.View.Prelude
data IndexView = IndexView
{ correlations :: ![OutcomeCorrelation]
, hubs :: ![Hub]
, mHubFilter :: !(Maybe (Id Hub))
}
instance View IndexView where
html IndexView { .. } = [hsx|
Outcome Correlations
| Category |
Type |
Score |
Samples |
Computed |
{forM_ correlations renderRow}
|]
where
renderRow c = [hsx|
| {c.annotationCategory} |
{c.correlationType} |
{show (round (c.correlationScore * 100) :: Int)}%
|
{show c.sampleCount} |
{show c.computedAt} |
|]
scoreClass s
| s >= 0.7 = "inline-block px-2 py-1 text-xs font-semibold bg-green-100 text-green-800 rounded" :: Text
| s >= 0.4 = "inline-block px-2 py-1 text-xs font-semibold bg-yellow-100 text-yellow-800 rounded"
| otherwise = "inline-block px-2 py-1 text-xs font-semibold bg-red-100 text-red-800 rounded"
renderHubFilterOption :: Maybe (Id Hub) -> Hub -> Html
renderHubFilterOption mFilter h = [hsx|
|]