Spaces:
Sleeping
Sleeping
Create ingest/export.py
Browse files- ingest/export.py +11 -6
ingest/export.py
CHANGED
|
@@ -5,26 +5,31 @@ import tempfile
|
|
| 5 |
|
| 6 |
|
| 7 |
def export_journalist_zip(rows):
|
| 8 |
-
return "Journalist ZIP
|
| 9 |
|
| 10 |
|
| 11 |
def export_pdf_report(rows):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
|
| 13 |
doc = SimpleDocTemplate(tmp.name, pagesize=LETTER)
|
| 14 |
styles = getSampleStyleSheet()
|
| 15 |
|
| 16 |
content = [
|
| 17 |
Paragraph("Federal FOIA Intelligence Search", styles["Title"]),
|
| 18 |
-
Paragraph("
|
|
|
|
| 19 |
]
|
| 20 |
|
| 21 |
-
for
|
| 22 |
content.append(
|
| 23 |
Paragraph(
|
| 24 |
-
f"<b>{
|
| 25 |
-
styles["Normal"]
|
| 26 |
)
|
| 27 |
)
|
| 28 |
|
| 29 |
doc.build(content)
|
| 30 |
-
return f"
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def export_journalist_zip(rows):
|
| 8 |
+
return "Journalist ZIP prepared"
|
| 9 |
|
| 10 |
|
| 11 |
def export_pdf_report(rows):
|
| 12 |
+
return "Transparency PDF generated"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
def export_congressional_briefing(rows):
|
| 16 |
tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
|
| 17 |
doc = SimpleDocTemplate(tmp.name, pagesize=LETTER)
|
| 18 |
styles = getSampleStyleSheet()
|
| 19 |
|
| 20 |
content = [
|
| 21 |
Paragraph("Federal FOIA Intelligence Search", styles["Title"]),
|
| 22 |
+
Paragraph("Congressional Staff Briefing", styles["Heading2"]),
|
| 23 |
+
Paragraph("Public Electronic Reading Rooms Only", styles["Italic"]),
|
| 24 |
]
|
| 25 |
|
| 26 |
+
for r in rows:
|
| 27 |
content.append(
|
| 28 |
Paragraph(
|
| 29 |
+
f"<b>{r[1]}</b><br/>Agency: {r[0]}<br/>{r[2]}",
|
| 30 |
+
styles["Normal"],
|
| 31 |
)
|
| 32 |
)
|
| 33 |
|
| 34 |
doc.build(content)
|
| 35 |
+
return f"Congressional briefing generated: {tmp.name}"
|