Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pubmed
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
crawlers
pubmed
Commits
bdf6b2de
Commit
bdf6b2de
authored
Jul 11, 2019
by
Mael NICOLAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correct the date problem
parent
7cd5fed6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
Parser.hs
src/PUBMED/Parser.hs
+3
-3
No files found.
src/PUBMED/Parser.hs
View file @
bdf6b2de
...
...
@@ -7,7 +7,7 @@ import qualified Text.XML.Cursor as C -- ((&/), (&//), Cursor, content, element)
import
Text.XML
(
Name
)
import
Data.Either
(
rights
)
import
Data.Maybe
(
Maybe
,
fromMaybe
)
import
Data.Maybe
(
Maybe
,
from
Just
,
from
Maybe
)
import
Data.Monoid
(
mconcat
)
import
Data.Conduit
(
runConduit
,
(
.|
),
ConduitT
)
import
Data.Text
(
Text
,
unpack
)
...
...
@@ -107,7 +107,7 @@ parsePubMedArticle =
parsePubMedArticle'
::
MonadThrow
m
=>
ConduitT
Event
o
m
PubMed
parsePubMedArticle'
=
do
article
<-
force
"MedlineCitation"
$
tagIgnoreAttrs
"MedlineCitation"
parseMedlineCitation
dates
<-
tagIgnoreAttrs
"PubmedDat
e
"
$
do
dates
<-
tagIgnoreAttrs
"PubmedDat
a
"
$
do
dates'
<-
tagIgnoreAttrs
"History"
$
many
$
tagIgnoreAttrs
"PubMedPubDate"
$
do
y'
<-
force
"Year"
$
tagIgnoreAttrs
"Year"
content
m'
<-
force
"Month"
$
tagIgnoreAttrs
"Month"
content
...
...
@@ -117,7 +117,7 @@ parsePubMedArticle' = do
_
<-
many
ignoreAnyTreeContent
return
dates'
_
<-
many
ignoreAnyTreeContent
let
(
y
,
m
,
d
)
=
maybe
(
1
,
1
,
1
)
identity
$
join
$
fmap
head
$
reverse
<$>
join
dates
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment