1 """Database definitions for retrieval of Medline information.
2 """
3 from Bio.config.DBRegistry import DBGroup, EUtilsDB
4 from _support import *
5
6 from Martel import *
7
8 proxy_error_expr = has_expr(Alt(Str("500"), Str("502")) + Str(" Proxy Error"))
9 diagnostic_error_expr = has_str("WWW Error 500 Diagnostic")
10 error_expr = Str("ERROR")
11
12 ncbi_failures=[
13 (proxy_error_expr, "proxy error"),
14 (diagnostic_error_expr, "diagnostic error"),
15 (error_expr, "ERROR"),
16 (html_expr, "I got HTML and shouldn't have"),
17 (Str("Please try again later"), "Please try again later"),
18 (Str("The sequence has been intentionally withdrawn"),
19 "Sequence withdrawn"),
20 (blank_expr, "No data returned")
21 ]
22
23 medline_eutils = EUtilsDB(
24 name = "medline-eutils",
25 doc = "Retrieve Medline data from NCBI using EUtils",
26 delay = 5.0,
27 db = "pubmed",
28 rettype = "medline",
29 failure_cases = ncbi_failures
30 )
31
32 medline = DBGroup(
33 name = "medline",
34 behavior = "serial")
35 medline.add(medline_eutils)
36