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
9d9c15ec
Commit
9d9c15ec
authored
Feb 25, 2022
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[parser] add pubmed_id
parent
6495eb7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
Parser.hs
src/PUBMED/Parser.hs
+12
-5
No files found.
src/PUBMED/Parser.hs
View file @
9d9c15ec
...
...
@@ -36,9 +36,10 @@ parseDocCount :: TL.Text -> Maybe Integer
parseDocCount
txt
=
TR
.
readMaybe
$
T
.
unpack
$
txt
^.
TTL
.
html
.
TTL
.
allNamed
(
only
"eSearchResult"
)
.
namedEl
"Count"
.
TTL
.
contents
data
PubMed
=
PubMed
{
pubmed_article
::
PubMedArticle
,
pubmed_date
::
PubMedDate
}
deriving
Show
PubMed
{
pubmed_id
::
Int
,
pubmed_article
::
PubMedArticle
,
pubmed_date
::
PubMedDate
}
deriving
Show
data
PubMedArticle
=
PubMedArticle
{
pubmed_title
::
Maybe
T
.
Text
...
...
@@ -71,11 +72,17 @@ parsePubMed :: TL.Text -> [PubMed]
parsePubMed
txt
=
catMaybes
$
txt
^..
pubmedArticle
.
to
pubMed
where
pubmedArticle
=
TTL
.
html
.
TTL
.
allNamed
(
only
"PubmedArticleSet"
)
.
TTL
.
allNamed
(
only
"PubmedArticle"
)
pubMed
el
=
PubMed
<$>
el
^?
article
.
to
pubMedArticle
pubMed
el
=
PubMed
<$>
el
^?
articleId
.
to
pubMedId
<*>
el
^?
article
.
to
pubMedArticle
<*>
el
^?
pubDate
.
to
pubMedDate
where
article
=
namedEl
"MedlineCitation"
.
namedEl
"Article"
medline
=
namedEl
"MedlineCitation"
article
=
medline
.
namedEl
"Article"
articleId
=
medline
.
namedEl
"PMID"
pubDate
=
namedEl
"PubmedData"
.
namedEl
"History"
.
namedEl
"PubMedPubDate"
.
TTL
.
attributed
(
ix
"PubStatus"
.
only
"pubmed"
)
pubMedId
el
=
case
(
TR
.
readMaybe
$
T
.
unpack
$
el
^.
TTL
.
contents
)
of
Nothing
->
panic
$
"Cannot parse id: "
<>
(
T
.
unpack
$
el
^.
TTL
.
contents
)
Just
id
->
id
pubMedDate
el
=
PubMedDate
{
pubmedDate_date
=
jour
y
m
d
,
pubmedDate_year
=
y
,
pubmedDate_month
=
m
...
...
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