Add TODO comments near undefined/panic calls

parent d0a57d8c
...@@ -258,9 +258,9 @@ server env = do ...@@ -258,9 +258,9 @@ server env = do
:<|> nodeAPI conn :<|> nodeAPI conn
:<|> nodeAPI conn :<|> nodeAPI conn
:<|> nodesAPI conn :<|> nodesAPI conn
:<|> count :<|> count -- TODO: undefined
:<|> search conn :<|> search conn
:<|> graphAPI conn :<|> graphAPI conn -- TODO: mock
:<|> treeAPI conn :<|> treeAPI conn
-- :<|> orchestrator -- :<|> orchestrator
where where
......
...@@ -57,9 +57,9 @@ import Gargantext.Text.Terms (TermType(..)) ...@@ -57,9 +57,9 @@ import Gargantext.Text.Terms (TermType(..))
------------------------------------------------------------------- -------------------------------------------------------------------
-- | Node API Types management -- | Node API Types management
type Roots = Get '[JSON] [Node Value] type Roots = Get '[JSON] [Node Value]
:<|> Post '[JSON] Int :<|> Post '[JSON] Int -- TODO
:<|> Put '[JSON] Int :<|> Put '[JSON] Int -- TODO
:<|> Delete '[JSON] Int :<|> Delete '[JSON] Int -- TODO
type NodesAPI = Delete '[JSON] Int type NodesAPI = Delete '[JSON] Int
...@@ -106,15 +106,16 @@ type FacetDocAPI = "table" ...@@ -106,15 +106,16 @@ type FacetDocAPI = "table"
-- | Node API functions -- | Node API functions
roots :: Connection -> Server Roots roots :: Connection -> Server Roots
roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId conn 0 Nothing) roots conn = liftIO (putStrLn ( "/user" :: Text) >> getNodesWithParentId 0 Nothing conn)
:<|> pure (panic "not implemented yet") :<|> pure (panic "not implemented yet") -- TODO
:<|> pure (panic "not implemented yet") :<|> pure (panic "not implemented yet") -- TODO
:<|> pure (panic "not implemented yet") :<|> pure (panic "not implemented yet") -- TODO
type GraphAPI = Get '[JSON] Graph type GraphAPI = Get '[JSON] Graph
graphAPI :: Connection -> NodeId -> Server GraphAPI graphAPI :: Connection -> NodeId -> Server GraphAPI
graphAPI _ _ = liftIO $ textFlow (Mono EN) (Contexts contextText) graphAPI _ _ = liftIO $ textFlow (Mono EN) (Contexts contextText)
-- TODO what do we get about the node? to replace contextText
-- TODO(orphan): There should be a proper APIError data type with a case TreeError. -- TODO(orphan): There should be a proper APIError data type with a case TreeError.
instance HasTreeError ServantErr where instance HasTreeError ServantErr where
...@@ -143,10 +144,10 @@ nodesAPI :: Connection -> [NodeId] -> Server NodesAPI ...@@ -143,10 +144,10 @@ nodesAPI :: Connection -> [NodeId] -> Server NodesAPI
nodesAPI conn ids = deleteNodes' conn ids nodesAPI conn ids = deleteNodes' conn ids
postNode :: Connection -> NodeId -> Handler Int postNode :: Connection -> NodeId -> Handler Int
postNode = undefined postNode = undefined -- TODO
putNode :: Connection -> NodeId -> Handler Int putNode :: Connection -> NodeId -> Handler Int
putNode = undefined putNode = undefined -- TODO
deleteNodes' :: Connection -> [NodeId] -> Handler Int deleteNodes' :: Connection -> [NodeId] -> Handler Int
deleteNodes' conn ids = liftIO (deleteNodes conn ids) deleteNodes' conn ids = liftIO (deleteNodes conn ids)
...@@ -165,7 +166,7 @@ getFacet conn id offset limit = liftIO (putStrLn ( "/facet" :: Text)) >> liftIO ...@@ -165,7 +166,7 @@ getFacet conn id offset limit = liftIO (putStrLn ( "/facet" :: Text)) >> liftIO
getChart :: Connection -> NodeId -> Maybe UTCTime -> Maybe UTCTime getChart :: Connection -> NodeId -> Maybe UTCTime -> Maybe UTCTime
-> Handler [FacetChart] -> Handler [FacetChart]
getChart _ _ _ _ = undefined getChart _ _ _ _ = undefined -- TODO
query :: Text -> Handler Text query :: Text -> Handler Text
......
...@@ -64,7 +64,7 @@ pipeline :: FromJSON e => URL -> ClientEnv -> ScraperInput ...@@ -64,7 +64,7 @@ pipeline :: FromJSON e => URL -> ClientEnv -> ScraperInput
-> (e -> IO ()) -> IO ScraperStatus -> (e -> IO ()) -> IO ScraperStatus
pipeline scrapyurl client_env input log_status = do pipeline scrapyurl client_env input log_status = do
e <- runJobMLog client_env log_status $ callScraper scrapyurl input e <- runJobMLog client_env log_status $ callScraper scrapyurl input
either (panic . cs . show) pure e either (panic . cs . show) pure e -- TODO throwError
scrapyOrchestrator :: Env -> IO (Server (WithCallbacks ScraperAPI)) scrapyOrchestrator :: Env -> IO (Server (WithCallbacks ScraperAPI))
scrapyOrchestrator env = do scrapyOrchestrator env = do
......
...@@ -54,5 +54,5 @@ parseJSONFromString :: (Read a) => Value -> Parser a ...@@ -54,5 +54,5 @@ parseJSONFromString :: (Read a) => Value -> Parser a
parseJSONFromString v = do parseJSONFromString v = do
numString <- parseJSON v numString <- parseJSON v
case readMaybe (numString :: String) of case readMaybe (numString :: String) of
Nothing -> fail $ "Invalid number for TransactionID: " ++ show v Nothing -> fail $ "Invalid number for TransactionID: " ++ show v -- TODO error message too specific
Just n -> return n Just n -> return n
...@@ -100,6 +100,7 @@ useLabelPolicy :: Map Grouped [Text] -> Grouped -> [Text] ...@@ -100,6 +100,7 @@ useLabelPolicy :: Map Grouped [Text] -> Grouped -> [Text]
useLabelPolicy m g = case DMS.lookup g m of useLabelPolicy m g = case DMS.lookup g m of
Just label -> label Just label -> label
Nothing -> panic $ "Label of Grouped not found: " <> (pack $ show g) Nothing -> panic $ "Label of Grouped not found: " <> (pack $ show g)
-- TODO: use a non-fatal error if this can happen in practice
{- {-
labelPolicy :: Map Grouped (Map Terms Occs) -> Grouped -> Label labelPolicy :: Map Grouped (Map Terms Occs) -> Grouped -> Label
labelPolicy m g = case _terms_label <$> fst <$> maximumWith snd <$> DMS.toList <$> lookup g m of labelPolicy m g = case _terms_label <$> fst <$> maximumWith snd <$> DMS.toList <$> lookup g m of
......
...@@ -76,6 +76,7 @@ parserLang _ = panic "not implemented" ...@@ -76,6 +76,7 @@ parserLang _ = panic "not implemented"
-- currentContext lang = localContext lang <$> utcToDucklingTime <$> getCurrentTime -- currentContext lang = localContext lang <$> utcToDucklingTime <$> getCurrentTime
-- parseDate1 :: Context -> Text -> SomeErrorHandling Text -- parseDate1 :: Context -> Text -> SomeErrorHandling Text
-- TODO error handling
parseDate1 :: Lang -> Text -> IO Text parseDate1 :: Lang -> Text -> IO Text
parseDate1 lang text = do parseDate1 lang text = do
maybeJson <- map jsonValue <$> parseDateWithDuckling lang text maybeJson <- map jsonValue <$> parseDateWithDuckling lang text
......
...@@ -86,7 +86,7 @@ textFlow termType workType = do ...@@ -86,7 +86,7 @@ textFlow termType workType = do
CSV path -> readCsvOn [csv_title, csv_abstract] path CSV path -> readCsvOn [csv_title, csv_abstract] path
Contexts ctxt -> pure ctxt Contexts ctxt -> pure ctxt
DB con corpusId -> catMaybes <$> map (\n -> hyperdataDocumentV3_title (node_hyperdata n) <> hyperdataDocumentV3_abstract (node_hyperdata n))<$> getDocumentsV3WithParentId con corpusId DB con corpusId -> catMaybes <$> map (\n -> hyperdataDocumentV3_title (node_hyperdata n) <> hyperdataDocumentV3_abstract (node_hyperdata n))<$> getDocumentsV3WithParentId con corpusId
_ -> undefined _ -> undefined -- TODO Query not supported
textFlow' termType contexts textFlow' termType contexts
......
...@@ -38,7 +38,7 @@ import qualified Data.Set as S ...@@ -38,7 +38,7 @@ import qualified Data.Set as S
import Data.Map (Map) import Data.Map (Map)
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Data.Vector (Vector) -- import Data.Vector (Vector)
import Gargantext.Prelude import Gargantext.Prelude
...@@ -86,13 +86,12 @@ indexConversion index ms = M.fromList $ map (\((k1,k2),c) -> ( ((M.!) index k1, ...@@ -86,13 +86,12 @@ indexConversion index ms = M.fromList $ map (\((k1,k2),c) -> ( ((M.!) index k1,
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
-- TODO
--fromIndex' :: Ord t => Vector t -> Map (Index, Index) a -> Map (t,t) a --fromIndex' :: Ord t => Vector t -> Map (Index, Index) a -> Map (t,t) a
--fromIndex' vi ns = undefined --fromIndex' vi ns = undefined
-- TODO -- TODO: returing a Vector should be faster than a Map
createIndices' :: Ord t => Map (t, t) b -> (Map t Index, Vector t) -- createIndices' :: Ord t => Map (t, t) b -> (Map t Index, Vector t)
createIndices' = undefined -- createIndices' = undefined
createIndices :: Ord t => Map (t, t) b -> (Map t Index, Map Index t) createIndices :: Ord t => Map (t, t) b -> (Map t Index, Map Index t)
createIndices = set2indices . map2set createIndices = set2indices . map2set
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment