struct
type t = {
pmid : int ;
doi : string option ;
pubdate : string option ;
source : string option ;
title : string ;
}
let parse_article_ids x =
map_echildren
~tag:"ArticleId"
(fun x -> sleaf_exn "IdType" x, sleaf_exn "Value" x)
x
let parse_document_summary x =
let article_ids = parse_article_ids (echild_exn "ArticleIds" x) in
{ pmid = int_of_string (List.Assoc.find_exn article_ids "pubmed") ;
doi = List.Assoc.find article_ids "doi" ;
pubdate = sleaf "PubDate" x ;
source = sleaf "Source" x ;
title = sleaf_exn "Title" x }
let parse_eSummaryResult x =
map_echildren
~tag:"DocumentSummary"
parse_document_summary
(echild_exn "DocumentSummarySet" x)
let search = search_and_summary `pubmed parse_eSummaryResult
end