Commit ba743a17 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[CLEAN] removing unused code

parent 12cb16c3
......@@ -111,108 +111,6 @@ parsePubMed txt = catMaybes $ txt ^.. pubmedArticle . to pubMed
lastName = namedEl "LastName" . TTL.contents
affiliation = namedEl "AffiliationInfo" . namedEl "Affiliation" . TTL.contents
--identity :: a -> a
--identity x = x
--
--manyTagsUntil :: MonadThrow m =>
-- Name
-- -> ConduitT Event o m b
-- -> ConduitT Event o m (Maybe b)
--manyTagsUntil name f = do
-- _ <- manyTagsUntil_ name
-- tagIgnoreAttrs (matching (== name)) f
--
---- | Utility function that matches everything but the tag given
--tagUntil :: Name -> NameMatcher Name
--tagUntil name = matching (/= name)
--
---- | Utility function that consumes everything but the tag given
---- usefull because we have to consume every data.
--manyTagsUntil_ :: MonadThrow m => Name -> ConduitT Event o m ()
--manyTagsUntil_ n = many_ ( ignoreTree (tagUntil n) ignoreAttrs)
--
--manyTagsUntil_' :: MonadThrow m => Name -> ConduitT Event o m ()
--manyTagsUntil_' = many_ . ignoreEmptyTag . tagUntil
--parseDocId :: C.Cursor -> [Integer]
--parseDocId cursor = fst <$>
-- rights (T.decimal
-- <$> filter notNullOrEOL (rawElement cursor)
-- )
-- where rawElement = C.element "eSearchResult" C.&/ C.element "IdList" C.&// C.content
-- notNullOrEOL t = not (T.null t) && t /= "\n"
--readPubMedFile :: FilePath -> IO [PubMed]
--readPubMedFile fp = do
-- input <- DBL.readFile fp
-- pubMedParser input
--pubMedParser :: DBL.ByteString -> IO [PubMed]
--pubMedParser bstring = runConduit $ parseLBS def bstring
-- .| parseArticleSet
-- .| CL.consume
--
--parseArticleSet :: MonadThrow m => ConduitT Event PubMed m ()
--parseArticleSet =
-- force "PubmedArticleSet required" $ manyTagsUntil "PubmedArticleSet" $ manyYield parsePubMedArticle
--
--parsePubMedArticle :: MonadThrow m => ConduitT Event o m (Maybe PubMed)
--parsePubMedArticle =
-- manyTagsUntil "PubmedArticle" parsePubMedArticle'
--
--parsePubMedArticle' :: MonadThrow m => ConduitT Event o m PubMed
--parsePubMedArticle' = do
-- article <- force "MedlineCitation" $ tagIgnoreAttrs "MedlineCitation" parseMedlineCitation
-- dates <- tagIgnoreAttrs "PubmedData" $ do
-- dates' <- tagIgnoreAttrs "History" $ many $ tagIgnoreAttrs "PubMedPubDate" $ do
-- y' <- force "Year" $ tagIgnoreAttrs "Year" content
-- m' <- force "Month" $ tagIgnoreAttrs "Month" content
-- d' <- force "Day" $ tagIgnoreAttrs "Day" content
-- _ <- many ignoreAnyTreeContent
-- return (read $ unpack y', read $ unpack m', read $ unpack d')
-- _ <- many ignoreAnyTreeContent
-- return dates'
-- _ <- many ignoreAnyTreeContent
-- let (y,m,d) = maybe (1,1,1) (fromJust . head) (reverse <$> join dates)
-- return $ PubMed article (PubMedDate (jour y m d) y m d)
--
--parseMedlineCitation :: MonadThrow m => ConduitT Event o m PubMedArticle
--parseMedlineCitation = do
-- a <- force "article" $ manyTagsUntil "Article" parseArticle
-- _ <- many ignoreAnyTreeContent
-- return a
--
--parseArticle :: MonadThrow m => ConduitT Event o m PubMedArticle
--parseArticle = do
-- journal <- force "journal" $
-- manyTagsUntil "Journal" $ do
-- j <- manyTagsUntil "Title" content
-- _ <- many ignoreAnyTreeContent
-- return j
--
-- title <- manyTagsUntil "ArticleTitle" content
--
-- abstracts <- manyTagsUntil "Abstract" . many $ do
-- txt <- tagIgnoreAttrs "AbstractText" content
-- _ <- many ignoreAnyTreeContent
-- return txt
-- -- TODO add authos
--
-- authors <- manyTagsUntil "AuthorList" . many $
-- tagIgnoreAttrs "Author" $ do
-- ln <- manyTagsUntil "LastName" content
-- fn <- manyTagsUntil "ForeName" content
-- affi <- manyTagsUntil "AffiliationInfo" $ do
-- aff <- manyTagsUntil "Affiliation" content
-- _ <- many ignoreAnyTreeContent
-- return aff
-- _ <- many ignoreAnyTreeContent
-- return Author {lastName=ln, foreName=fn, affiliation=fromMaybe Nothing affi}
--
--
-- _ <- many ignoreAnyTreeContent
-- return $ PubMedArticle title journal abstracts authors
pubMedData :: DBL.ByteString
pubMedData = mconcat
......
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