Generating Candidate Reports
Build the report from a ticket using this pipeline:
- Pull ticket text + attached photos from the ticketing system
- Parse the text into structured fields (name, source, date, notes, etc.)
- Fill the Word template: text sections, tables, photos
- QA against the ticket, then export
Minimal automation with python-docx and docxtpl (template placeholders like {{ candidate_name }}):
Pythonfrom docxtpl import DocxTemplate, InlineImage from docx.shared import Mm doc = DocxTemplate("report_template.docx") context = { "ticket_id": "T-1042", "candidate_name": "Jane Doe", "sources": [ {"platform": "Instagram", "url": "https://instagram.com/janedoe", "date_captured": "2024-05-02"}, ], "photos": [InlineImage(doc, "photos/janedoe_1.jpg", width=Mm(80))], "summary": "Short factual summary here.", } doc.render(context) doc.save("output/T-1042_report.docx")
Progress:
- [ ] Step 1: Collect ticket data (text fields + photos + source URLs)
- [ ] Step 2: Normalize and structure the data
- [ ] Step 3: Verify source data against its origin
- [ ] Step 4: Fill the Word template
- [ ] Step 5: QA the document
- [ ] Step 6: Export, name, and attach back to the ticket
Step 1: Collect ticket data
- Export the ticket text (copy, CSV, or API) and download all attached photos into one folder named after the ticket ID:
T-1042/photos/. - Capture for each data point: value, source URL, and date captured. Reports lose credibility without these.
Step 2: Normalize the data
Structure into fixed fields so the template always fills the same way:
| Field | Notes |
|---|---|
| Ticket ID | Used in filename and header |
| Candidate name | Exactly as in the ticket; flag variants/aliases |
| Source platform + URL | One row per source |
| Date captured | ISO format (YYYY-MM-DD) |
| Key facts | Short, factual, attributed |
| Photos | Filename + caption + source |
Rename photos to a consistent pattern: {ticketid}_{candidate}_{nn}.jpg.
Step 3: Verify
- Open each source URL and confirm the ticket data still matches (profiles change or get deleted).
- Mark each fact as Confirmed (seen at the source), Reported (from the ticket only), or Unverified.
- If a source is gone, note "no longer available as of [date]" and keep the screenshot.
Step 4: Fill the template
- Keep the template's styles, header/footer, and layout; only replace content.
- Tables: one row per source or data point, with consistent column order.
- Photos: resize to a uniform width (about 80 mm for side-by-side, 150 mm for full width); add a caption with source and date under each.
- Write the summary last, using only facts that appear in the tables.
Step 5: QA checklist
- [ ] Name spelled the same everywhere (title, headers, tables, summary)
- [ ] Every photo has a caption and source
- [ ] Every table row has a source + date
- [ ] No leftover placeholders ({{ }}, "TODO", "XXX")
- [ ] Page breaks don't split tables or separate photos from captions
- [ ] Ticket ID in header and filename
- [ ] Sensitive/personal data limited to what the report purpose requires
Step 6: Export
- Save as
{ticketid}_{candidate}_report_v1.docx; increment the version on revisions. - Export PDF if the recipient shouldn't edit it.
- Attach the final file back to the ticket and note it in the ticket comments.
Example 1: Input: Ticket T-2210 text: "Candidate: Marco Silva. Found on Instagram @marcosilva_dev, bio says 'Frontend dev, Lisbon'. 3 screenshots attached. Also LinkedIn profile." Output:
- Table row 1: Instagram | @marcosilva_dev | URL | 2024-06-11 | "Bio: Frontend dev, Lisbon" | Confirmed
- Table row 2: LinkedIn | profile URL | 2024-06-11 | (details from ticket) | Reported
- 3 photos inserted at 80 mm, captioned "Instagram profile screenshot, captured 2024-06-11"
- File:
T-2210_marco-silva_report_v1.docx
Example 2: Input: Ticket has 12 photos but the template has room for 6. Output: Put the 6 most relevant in the main body; move the rest to an "Appendix A: Additional Photos" section using the same caption format.
Example 3: Input: Ticket data says "lives in Berlin" but the Instagram bio now says "Madrid". Output: Table row: Location | "Berlin (ticket), Madrid (Instagram bio, checked 2024-06-12)" | Discrepancy; mention it in the summary instead of picking one.
- Build the template once, reuse it. Placeholders plus
docxtplbeat manual copy-paste and cut errors. - Screenshot at capture time. Social profiles change; the screenshot is your evidence.
- Separate fact from inference. Use labels (Confirmed / Reported / Unverified) rather than blending them in prose.
- Keep photos organized per ticket in one folder so reports are reproducible.
- Batch similar tickets. If you do many, loop the script over a CSV export instead of filling each by hand.
- Keep the summary short. 3-5 sentences; the tables carry the detail.
- Missing source or date on a fact; the report can't be defended later.
- Pasting oversized photos that blow up file size and break layout. Resize first.
- Editing the template's styles per report; it drifts and looks inconsistent. Change the template itself, not individual reports.
- Trusting the ticket blindly without checking that the source still says the same thing.
- Inconsistent naming of files and candidates, which makes tickets and reports hard to match later.
- Including unnecessary personal data. Only include what the report's purpose requires, and follow your organization's privacy and data-handling rules, especially for data gathered from social media.
- Leaving template placeholders in the final document. Always run the QA checklist.