Clean up: remove dead Telnyx statuses, doula references, personal info, fix README
- Remove legacy Telnyx status strings (delivered, sent, queued, sending) - Remove duplicate save_log/generate_report calls in main() - Remove hardcoded personal fax number from GUI placeholder - Replace "doula coverage claim" with generic "claim" in HTML reports - Fix README: "7 days" → "3 successful deliveries", remove unnecessary number purchase step Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c66bd57bdc
commit
d72a0c13c5
3 changed files with 19 additions and 24 deletions
|
|
@ -27,10 +27,9 @@ This produces `dist/AutoFax.exe` -- a single self-contained file you can copy to
|
||||||
## Sinch Account Setup
|
## Sinch Account Setup
|
||||||
|
|
||||||
1. Sign up at [dashboard.sinch.com](https://dashboard.sinch.com/)
|
1. Sign up at [dashboard.sinch.com](https://dashboard.sinch.com/)
|
||||||
2. Go to **Numbers** and purchase a fax-enabled number
|
2. Go to **Settings > Access Keys** and create a key pair
|
||||||
3. Go to **Settings > Access Keys** and create a key pair
|
3. Note your **Project ID** (shown at the top of the dashboard)
|
||||||
4. Note your **Project ID** (shown at the top of the dashboard)
|
4. Configure:
|
||||||
5. Configure:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
|
|
@ -60,7 +59,7 @@ This will:
|
||||||
- Create a Python virtual environment
|
- Create a Python virtual environment
|
||||||
- Install dependencies
|
- Install dependencies
|
||||||
- Set up an hourly cron job
|
- Set up an hourly cron job
|
||||||
- Auto-remove the cron after 7 days
|
- Stop automatically after 3 successful deliveries
|
||||||
|
|
||||||
### 3. Manual Test
|
### 3. Manual Test
|
||||||
|
|
||||||
|
|
|
||||||
24
autofax.py
24
autofax.py
|
|
@ -119,20 +119,20 @@ def generate_report(entries: list[dict]):
|
||||||
config.REPORTS_DIR.mkdir(parents=True, exist_ok=True)
|
config.REPORTS_DIR.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
total = len(entries)
|
total = len(entries)
|
||||||
success_statuses = {"QUEUED", "IN_PROGRESS", "COMPLETED", "delivered", "sent", "queued", "sending"}
|
success_statuses = {"QUEUED", "IN_PROGRESS", "COMPLETED"}
|
||||||
failed = sum(1 for e in entries if e["status"] not in success_statuses)
|
failed = sum(1 for e in entries if e["status"] not in success_statuses)
|
||||||
succeeded = sum(1 for e in entries if e["status"] in ("COMPLETED", "delivered"))
|
succeeded = sum(1 for e in entries if e["status"] == "COMPLETED")
|
||||||
pending = total - failed - succeeded
|
pending = total - failed - succeeded
|
||||||
|
|
||||||
rows = ""
|
rows = ""
|
||||||
for i, e in enumerate(entries, 1):
|
for i, e in enumerate(entries, 1):
|
||||||
status = e["status"]
|
status = e["status"]
|
||||||
if status in ("COMPLETED", "delivered", "sent"):
|
if status == "COMPLETED":
|
||||||
status_class = "success"
|
status_class = "success"
|
||||||
status_display = "DELIVERED" if status == "COMPLETED" else status.upper()
|
status_display = "DELIVERED"
|
||||||
elif status in ("QUEUED", "IN_PROGRESS", "queued", "sending"):
|
elif status in ("QUEUED", "IN_PROGRESS"):
|
||||||
status_class = "pending"
|
status_class = "pending"
|
||||||
status_display = status.upper()
|
status_display = status
|
||||||
else:
|
else:
|
||||||
status_class = "failed"
|
status_class = "failed"
|
||||||
status_display = "FAILED"
|
status_display = "FAILED"
|
||||||
|
|
@ -181,7 +181,7 @@ def generate_report(entries: list[dict]):
|
||||||
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<p>This report documents automated fax transmission attempts to the insurance
|
<p>This report documents automated fax transmission attempts to the insurance
|
||||||
company for doula coverage claim processing.</p>
|
company for claim processing.</p>
|
||||||
<p>
|
<p>
|
||||||
Total attempts: <span>{total}</span> |
|
Total attempts: <span>{total}</span> |
|
||||||
Delivered: <span class="success">{succeeded}</span> |
|
Delivered: <span class="success">{succeeded}</span> |
|
||||||
|
|
@ -210,9 +210,8 @@ def generate_report(entries: list[dict]):
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
<p>Generated by AutoFax automated fax system. Each row represents one
|
<p>Generated by AutoFax automated fax system. Each row represents one
|
||||||
transmission attempt of the doula coverage claim (5 pages). Faxes are sent
|
transmission attempt. Faxes are sent once per hour. A status of FAILED
|
||||||
once per hour. A status of FAILED indicates the receiving fax machine did
|
indicates the receiving fax machine did not accept the transmission.</p>
|
||||||
not accept the transmission.</p>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>"""
|
</html>"""
|
||||||
|
|
@ -224,7 +223,7 @@ def generate_report(entries: list[dict]):
|
||||||
|
|
||||||
def update_previous_statuses(entries: list[dict]) -> list[dict]:
|
def update_previous_statuses(entries: list[dict]) -> list[dict]:
|
||||||
for entry in entries:
|
for entry in entries:
|
||||||
if entry["status"] in ("QUEUED", "IN_PROGRESS", "queued", "sending"):
|
if entry["status"] in ("QUEUED", "IN_PROGRESS"):
|
||||||
status_data = check_fax_status(entry.get("fax_id"))
|
status_data = check_fax_status(entry.get("fax_id"))
|
||||||
if status_data:
|
if status_data:
|
||||||
new_status = status_data.get("status", entry["status"])
|
new_status = status_data.get("status", entry["status"])
|
||||||
|
|
@ -285,7 +284,6 @@ def main():
|
||||||
break
|
break
|
||||||
print()
|
print()
|
||||||
|
|
||||||
save_log(entries)
|
|
||||||
report_path = generate_report(entries)
|
report_path = generate_report(entries)
|
||||||
|
|
||||||
# Notify via ntfy
|
# Notify via ntfy
|
||||||
|
|
@ -308,8 +306,6 @@ def main():
|
||||||
print(f"Report: {report_path}")
|
print(f"Report: {report_path}")
|
||||||
|
|
||||||
# Check if this delivery hit the target
|
# Check if this delivery hit the target
|
||||||
save_log(entries)
|
|
||||||
generate_report(entries)
|
|
||||||
check_done(entries)
|
check_done(entries)
|
||||||
|
|
||||||
if result["status"] == "send_failed":
|
if result["status"] == "send_failed":
|
||||||
|
|
|
||||||
10
gui.py
10
gui.py
|
|
@ -106,7 +106,7 @@ class AutoFaxApp:
|
||||||
self.to_var = tk.StringVar()
|
self.to_var = tk.StringVar()
|
||||||
self.pdf_var = tk.StringVar()
|
self.pdf_var = tk.StringVar()
|
||||||
|
|
||||||
self._add_field(lf_fax, "To Number:", self.to_var, placeholder="+18019382102")
|
self._add_field(lf_fax, "To Number:", self.to_var, placeholder="+1XXXXXXXXXX")
|
||||||
|
|
||||||
pdf_frame = tk.Frame(lf_fax)
|
pdf_frame = tk.Frame(lf_fax)
|
||||||
pdf_frame.pack(fill="x", pady=2)
|
pdf_frame.pack(fill="x", pady=2)
|
||||||
|
|
@ -208,7 +208,7 @@ class AutoFaxApp:
|
||||||
if not self.key_secret_var.get().strip():
|
if not self.key_secret_var.get().strip():
|
||||||
problems.append("Key Secret is required")
|
problems.append("Key Secret is required")
|
||||||
to_num = self.to_var.get().strip()
|
to_num = self.to_var.get().strip()
|
||||||
if not to_num or to_num == "+18019382102":
|
if not to_num or to_num == "+1XXXXXXXXXX":
|
||||||
problems.append("To Number is required")
|
problems.append("To Number is required")
|
||||||
pdf = self.pdf_var.get().strip()
|
pdf = self.pdf_var.get().strip()
|
||||||
if not pdf or not Path(pdf).is_file():
|
if not pdf or not Path(pdf).is_file():
|
||||||
|
|
@ -447,7 +447,7 @@ tr:nth-child(even){{background:#f9f9f9}}
|
||||||
<h1>Fax Transmission Report</h1>
|
<h1>Fax Transmission Report</h1>
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
<p>This report documents automated fax transmission attempts to the insurance
|
<p>This report documents automated fax transmission attempts to the insurance
|
||||||
company for doula coverage claim processing.</p>
|
company for claim processing.</p>
|
||||||
<p>Total attempts: <span>{total}</span> |
|
<p>Total attempts: <span>{total}</span> |
|
||||||
Delivered: <span class="success">{succeeded}</span> |
|
Delivered: <span class="success">{succeeded}</span> |
|
||||||
Failed: <span class="failed">{failed}</span> |
|
Failed: <span class="failed">{failed}</span> |
|
||||||
|
|
@ -462,8 +462,8 @@ Pending: <span>{pending}</span></p>
|
||||||
{rows}
|
{rows}
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
<div class="footer"><p>Generated by AutoFax. Each row represents one
|
<div class="footer"><p>Generated by AutoFax. Each row represents one
|
||||||
transmission attempt of the doula coverage claim (5 pages). Faxes are sent
|
transmission attempt. Faxes are sent once per hour.
|
||||||
once per hour. FAILED = the receiving fax machine did not accept.</p></div>
|
FAILED = the receiving fax machine did not accept.</p></div>
|
||||||
</body></html>"""
|
</body></html>"""
|
||||||
|
|
||||||
(REPORTS_DIR / "fax_report.html").write_text(html)
|
(REPORTS_DIR / "fax_report.html").write_text(html)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue