Update app.py
Browse files
app.py
CHANGED
@@ -34,6 +34,16 @@ def generate_prisma_flow_chart(records_db, records_other, duplicates, excluded_s
|
|
34 |
records_after_duplicates = records_db + records_other - duplicates
|
35 |
|
36 |
# Create SVG content for PRISMA flow chart
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
svg_content = f'''
|
38 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" width="700" height="700">
|
39 |
<style>
|
@@ -120,13 +130,7 @@ def generate_prisma_flow_chart(records_db, records_other, duplicates, excluded_s
|
|
120 |
<text x="400" y="490">(n = {included_studies})</text>
|
121 |
|
122 |
<!-- Optional Meta-Analysis Box -->
|
123 |
-
{
|
124 |
-
<line x1="400" y1="490" x2="400" y2="530" class="arrow" />
|
125 |
-
<rect x="250" y="530" width="300" height="60" class="box" />
|
126 |
-
<text x="400" y="550" class="box-title">Meta-Analysis</text>
|
127 |
-
<text x="400" y="575">Studies included in quantitative synthesis</text>
|
128 |
-
<text x="400" y="590">(n = {included_meta})</text>
|
129 |
-
''' if included_meta is not None else ''}
|
130 |
|
131 |
<!-- PRISMA Title -->
|
132 |
<text x="150" y="25" style="font-size: 18px; font-weight: bold; text-anchor: start;">PRISMA Flow Diagram</text>
|
@@ -163,7 +167,7 @@ def generate_systematic_review(pdf_files, review_question, prisma_numbers, inclu
|
|
163 |
|
164 |
Step 4: Define Inclusion and Exclusion Criteria
|
165 |
Clearly articulate the criteria for including or excluding studies in your review. These criteria should be directly tied to your research question and may include: publication date range, study types, population characteristics, intervention specifications, outcome measures, and language restrictions.
|
166 |
-
|
167 |
Step 5: Evaluate Relevant Literature
|
168 |
Conduct a comprehensive literature search using multiple databases (e.g., PubMed, Scopus, Web of Science, CINAHL) with clearly defined search terms and Boolean operators. Document your search strategy in detail to ensure reproducibility. Consider both published and unpublished (gray) literature to minimize publication bias.
|
169 |
|
@@ -185,11 +189,10 @@ def generate_systematic_review(pdf_files, review_question, prisma_numbers, inclu
|
|
185 |
Step 11: Concluding Statements
|
186 |
Provide clear, substantiated conclusions based on your review findings. Ensure conclusions are proportionate to the evidence presented and acknowledge uncertainty where appropriate. Offer specific recommendations for future research.
|
187 |
|
188 |
-
Step 12: References and Documentation
|
189 |
Include a comprehensive reference list following a specific citation style (APA, Vancouver, etc.). Provide links to source papers when available.
|
190 |
|
191 |
Your response should be formatted in HTML (but avoid showing these tags ```html ```) but generate the content to look like a professional academic paper. Include proper section headers, abstracts, methodology sections, etc. Number all sections like an academic paper. Follow academic journal standards with double spacing, appropriate margins, and consistent formatting throughout.
|
192 |
-
|
193 |
Make sure to include that you conducted a PRISMA flow diagram as part of the methodology section. Reference the PRISMA diagram in your methodology section and explain the numbers used in the diagram.
|
194 |
"""
|
195 |
|
@@ -452,7 +455,7 @@ def save_uploaded_files(files):
|
|
452 |
if file is not None:
|
453 |
# Create a temporary file
|
454 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp_file:
|
455 |
-
tmp_file.write(file)
|
456 |
saved_paths.append(tmp_file.name)
|
457 |
|
458 |
return saved_paths
|
@@ -658,7 +661,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
658 |
with gr.Row(elem_classes="input-container"):
|
659 |
with gr.Column():
|
660 |
gr.Markdown("### Upload Research Papers")
|
661 |
-
pdf_files = gr.File(label="Upload PDF Research Papers", file_count="multiple",
|
662 |
review_question = gr.Textbox(
|
663 |
label="Review Question or Topic",
|
664 |
value="Please generate a systematic review of the following papers.",
|
@@ -681,7 +684,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
681 |
prisma_included_studies = gr.Textbox(label="Studies included in synthesis", value="15", placeholder="e.g., 15")
|
682 |
prisma_included_meta = gr.Textbox(label="Studies in meta-analysis (optional)", value="10", placeholder="e.g., 10")
|
683 |
|
684 |
-
generate_button = gr.Button("Generate Systematic Review", elem_id="generate_button"
|
685 |
|
686 |
# Download link container
|
687 |
download_html_output = gr.HTML(label="Download Options")
|
@@ -775,4 +778,4 @@ with gr.Blocks(css=custom_css) as demo:
|
|
775 |
|
776 |
# Launch the app
|
777 |
if __name__ == "__main__":
|
778 |
-
demo.launch(
|
|
|
34 |
records_after_duplicates = records_db + records_other - duplicates
|
35 |
|
36 |
# Create SVG content for PRISMA flow chart
|
37 |
+
meta_analysis_section = ''
|
38 |
+
if included_meta is not None:
|
39 |
+
meta_analysis_section = f'''
|
40 |
+
<line x1="400" y1="490" x2="400" y2="530" class="arrow" />
|
41 |
+
<rect x="250" y="530" width="300" height="60" class="box" />
|
42 |
+
<text x="400" y="550" class="box-title">Meta-Analysis</text>
|
43 |
+
<text x="400" y="575">Studies included in quantitative synthesis</text>
|
44 |
+
<text x="400" y="590">(n = {included_meta})</text>
|
45 |
+
'''
|
46 |
+
|
47 |
svg_content = f'''
|
48 |
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" width="700" height="700">
|
49 |
<style>
|
|
|
130 |
<text x="400" y="490">(n = {included_studies})</text>
|
131 |
|
132 |
<!-- Optional Meta-Analysis Box -->
|
133 |
+
{meta_analysis_section}
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
<!-- PRISMA Title -->
|
136 |
<text x="150" y="25" style="font-size: 18px; font-weight: bold; text-anchor: start;">PRISMA Flow Diagram</text>
|
|
|
167 |
|
168 |
Step 4: Define Inclusion and Exclusion Criteria
|
169 |
Clearly articulate the criteria for including or excluding studies in your review. These criteria should be directly tied to your research question and may include: publication date range, study types, population characteristics, intervention specifications, outcome measures, and language restrictions.
|
170 |
+
neared
|
171 |
Step 5: Evaluate Relevant Literature
|
172 |
Conduct a comprehensive literature search using multiple databases (e.g., PubMed, Scopus, Web of Science, CINAHL) with clearly defined search terms and Boolean operators. Document your search strategy in detail to ensure reproducibility. Consider both published and unpublished (gray) literature to minimize publication bias.
|
173 |
|
|
|
189 |
Step 11: Concluding Statements
|
190 |
Provide clear, substantiated conclusions based on your review findings. Ensure conclusions are proportionate to the evidence presented and acknowledge uncertainty where appropriate. Offer specific recommendations for future research.
|
191 |
|
192 |
+
Step 12: References and Documentation Hawkins
|
193 |
Include a comprehensive reference list following a specific citation style (APA, Vancouver, etc.). Provide links to source papers when available.
|
194 |
|
195 |
Your response should be formatted in HTML (but avoid showing these tags ```html ```) but generate the content to look like a professional academic paper. Include proper section headers, abstracts, methodology sections, etc. Number all sections like an academic paper. Follow academic journal standards with double spacing, appropriate margins, and consistent formatting throughout.
|
|
|
196 |
Make sure to include that you conducted a PRISMA flow diagram as part of the methodology section. Reference the PRISMA diagram in your methodology section and explain the numbers used in the diagram.
|
197 |
"""
|
198 |
|
|
|
455 |
if file is not None:
|
456 |
# Create a temporary file
|
457 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".pdf") as tmp_file:
|
458 |
+
tmp_file.write(file.read()) # Changed from file to file.read()
|
459 |
saved_paths.append(tmp_file.name)
|
460 |
|
461 |
return saved_paths
|
|
|
661 |
with gr.Row(elem_classes="input-container"):
|
662 |
with gr.Column():
|
663 |
gr.Markdown("### Upload Research Papers")
|
664 |
+
pdf_files = gr.File(label="Upload PDF Research Papers", file_count="multiple", file_types=[".pdf"], elem_classes="file-upload")
|
665 |
review_question = gr.Textbox(
|
666 |
label="Review Question or Topic",
|
667 |
value="Please generate a systematic review of the following papers.",
|
|
|
684 |
prisma_included_studies = gr.Textbox(label="Studies included in synthesis", value="15", placeholder="e.g., 15")
|
685 |
prisma_included_meta = gr.Textbox(label="Studies in meta-analysis (optional)", value="10", placeholder="e.g., 10")
|
686 |
|
687 |
+
generate_button = gr.Button("Generate Systematic Review", elem_id="generate_button")
|
688 |
|
689 |
# Download link container
|
690 |
download_html_output = gr.HTML(label="Download Options")
|
|
|
778 |
|
779 |
# Launch the app
|
780 |
if __name__ == "__main__":
|
781 |
+
demo.launch()
|