This repository was archived by the owner on May 13, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAdvancedSearch.py
More file actions
executable file
·97 lines (89 loc) · 3.45 KB
/
AdvancedSearch.py
File metadata and controls
executable file
·97 lines (89 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python
"""Main menu for advanced search forms.
"""
from cdrcgi import Controller, HTMLPage
class Control(Controller):
"""Override the base class with menu-generation logic."""
SUBTITLE = "Advanced Search"
SUBMIT = None
B = HTMLPage.B
INSTRUCTIONS = (
B.P(
"""\
This module allows you to search for documents of a specific type
using filtering criteria appropriate to that type. For example, the
search page for """,
B.CODE("Term"),
""" documents has fields for the term's primary name, other names
used for the term, the type of the term (for example, Drug Combination),
and/or its semantic type (for example, Disease/Diagnosis)."""
),
B.P(
"""\
For some of the more comples document types (such as """,
B.CODE("Summary"),
"""), creating the search form may take a few seconds, because
the page must assemble all of the valid values for the picklists."""
),
B.P(
"""\
The search forms for some of the document types have extra buttons
specific to those document types. For example, the """,
B.CODE("Term"),
""" search form has a button which opens a new browser tab
for searching the NCI Thesaurus.
If the user account has sufficient permissions, the """,
B.CODE("Citation"),
""" form includes fields for importing or updating citations
from PubMed. There is an alternate form for """,
B.CODE("Person"),
""" documents, which includes location information about the
people matching the search criteria, to make it easier to distinguish
between individuals with the same name."""
),
B.P(
"""\
For all document types, the display of the search results includes a
link to each matching document's QC report.
""")
)
DOCTYPES = (
("Citation", "CiteSearch.py"),
("Country", "CountrySearch.py"),
("Documentation", "HelpSearch.py"),
("Drug Information Summary", "DISSearch.py"),
("Glossary Term Concept", "GlossaryTermConceptSearch.py"),
("Glossary Term Name", "GlossaryTermNameSearch.py"),
("Media", "MediaSearch.py"),
("Miscellaneous", "MiscSearch.py"),
("Organization", "OrgSearch2.py"),
("Person", "PersonSearch.py"),
("Person (Locations in Result Display)", "PersonLocSearch.py"),
("Political SubUnit", "PoliticalSubUnitSearch.py"),
("Summary", "SummarySearch.py"),
("Term", "TermSearch.py"),
)
CSS = """
.menu-links { list-style: none; }
.usa-form .menu-links a { text-decoration: none; }
.usa-form .menu-links a:visited { color: #005ea2 }
.usa-form .menu-links li { margin-bottom: .5rem; }
#primary-form .usa-accordion { margin-bottom: 2rem; }
code { color: brown; }
"""
def populate_form(self, page):
# page.body.set("class", "admin-menu")
accordion = page.accordion("Instructions")
for paragraph in self.INSTRUCTIONS:
accordion.payload.append(paragraph)
page.form.append(accordion.wrapper)
fieldset = page.fieldset("Select a Document Type")
ul = page.B.UL(page.B.CLASS("menu-links"))
fieldset.append(ul)
for display, script in (self.DOCTYPES):
link = page.menu_link(script, display)
link.set("target", "_blank")
ul.append(page.B.LI(link))
page.form.append(fieldset)
page.add_css(self.CSS)
Control().run()