GodsDevProject commited on
Commit
4c139a8
·
verified ·
1 Parent(s): 30bce81

Create ingest/citations.py

Browse files
Files changed (1) hide show
  1. ingest/citations.py +10 -15
ingest/citations.py CHANGED
@@ -1,16 +1,11 @@
1
- from reportlab.platypus import SimpleDocTemplate, Paragraph
2
- from reportlab.lib.styles import getSampleStyleSheet
3
- import tempfile
 
 
 
 
 
 
4
 
5
- def bluebook_pdf(results):
6
- styles = getSampleStyleSheet()
7
- tmp = tempfile.NamedTemporaryFile(delete=False, suffix=".pdf")
8
- doc = SimpleDocTemplate(tmp.name)
9
-
10
- content = []
11
- for r in results:
12
- citation = f"{r['agency']}, {r['title']}, {r['url']}."
13
- content.append(Paragraph(citation, styles["Normal"]))
14
-
15
- doc.build(content)
16
- return tmp.name
 
1
+ def bluebook_citation(result):
2
+ """
3
+ Formats a public FOIA document reference.
4
+ This is citation formatting ONLY, not legal advice.
5
+ """
6
+ title = result.get("title", "Untitled Document")
7
+ agency = result.get("agency", "U.S. Government")
8
+ date = result.get("date", "n.d.")
9
+ url = result.get("url", "")
10
 
11
+ return f"{title}, {agency} (released {date}), {url}"