Atris

List questions no help article answers.
Done by an agent. Checked twice.

A month of tickets becomes a ranked list of the questions your help centre does not answer yet.

Have Atris do this for you›

1

Real files in

  • help_articles.md
    Thirteen help articles for a booking product, two of which disagree on the refund window. 104 lines, 6 KB.
  • tickets.csv
    Sixty customer questions from one month, about half on subjects no article covers, asked in different words, with one repeat and three messages that ask nothing. 61 lines, 6 KB.

Sample data written by Atris. Not a real company.

2

Three steps

  1. 1.Read the articles and the tickets
  2. 2.File every ticket
  3. 3.Write the ticket map and gap list

Claude Sonnet 5.5, 42 seconds. No web. It never saw the check.

3

Checked twice

  • ✓Passed: 60 of 60 tickets appear once in ticket_map.csv
  • ✓Passed: 60 of 60 statuses equal a keyword match of the question against the article titles: 24 answered, 32 gaps, 3 not questions and 1 repeat
  • ✓Passed: 24 of 24 answered tickets cite the article whose title covers the subject
  • ✓Passed: 32 of 32 gap tickets are listed once in gaps.csv and 10 of 10 counts equal the number of tickets listed
  • ✓Passed: 10 of 10 missing subjects found by keyword have at least 8 in 10 of their tickets on one row, across 10 different rows
  • ✓Passed: gaps.csv lists the most asked question first with 7 tickets, against 7 by keyword match
  • ✓Passed: 10 of 10 nearest_article entries are a real article id or none
  • ✓Passed: 32 of 32 gap tickets carry the same question in ticket_map.csv as the row that lists them in gaps.csv and 0 tickets carry a question or an article id they should not

Second review by Claude Opus 5.5: pass.

Then we broke a copy of the output 6 ways on purpose. The check caught 5.

What it wrote. Lines 1 to 11 of gaps.csv, copied from the file.
gap_question,ticket_count,ticket_ids,nearest_article
Can I sync my bookings with an Outlook or Microsoft 365 calendar?,7,H-7024;H-7027;H-7035;H-7040;H-7044;H-7051;H-7052,HA-02
Can I import a client list from a file or another system into Fernwick?,6,H-7014;H-7020;H-7022;H-7033;H-7036;H-7050,HA-08
Can I turn on two-step verification (2FA) for logins?,4,H-7004;H-7008;H-7011;H-7047,HA-01
Can I sell gift vouchers or gift cards that clients buy online?,4,H-7018;H-7034;H-7041;H-7054,HA-09
"Can clients join a waiting list when a day or class is fully booked, and how is it set up?",3,H-7001;H-7030;H-7059,none
What is the card processing fee for cards issued outside the United States?,3,H-7002;H-7010;H-7026,HA-03
Can I put my logo and brand colours on my booking page?,2,H-7021;H-7032,none
"Can reminder texts be sent in languages other than English, such as Spanish?",1,H-7037,HA-05
Can I send a newsletter or marketing email to my clients from Fernwick?,1,H-7039,none
Is there an Android app for tablets?,1,H-7057,none

How this was run

An AI agent on Claude Sonnet 5.5 was given a folder with the files below and a three-step flow, and nothing else. It had no web access and never saw the check. The check was written before the run and made stricter after it. It works the answer out again from the input files. Then Claude Opus 5.5 reviewed the result against the inputs. The input files are sample data written by Atris, with the problems a real week has planted in them.

Run 1 of 1 on 1 December 2026. The agent took 42 seconds.

What the second review verified

  • All 60 tickets appear once in ticket_map.csv, in file order: 24 answered, 32 gap, 3 not_a_question and 1 repeat. H-7060 repeats H-7051, which was sent earlier by quinn4 with the identical 'Can I sync my bookings to Outlook?'
  • H-7016 (refund window on an annual plan) cites HA-11, updated 2026-08-21, which gives 60 days. That is correct over the older HA-04 (2025-09-15, 30 days). H-7031 (downgrade timing) also correctly cites HA-11
  • H-7022 asks two things. Export is answered by HA-08 but import has no article, so it is correctly marked a gap and grouped with the other 5 import tickets (H-7014, 7020, 7033, 7036, 7050)
  • gaps.csv: each ticket_count matches the number of ids on its row (7, 6, 4, 4, 3, 3, 2, 1, 1, 1 = 32). Every gap ticket appears once, rows are sorted most-asked first, and all 7 Outlook/Office 365/Microsoft tickets share one gap question

What this run does not show

  • Which tickets are gaps and which belong together is tested by keyword. The nearest article is only checked to be a real article id, so a poor choice there passes.
  • Before the run I reworded four sample tickets so each belonged to one clear group. A real month of tickets is messier.
  • On this run the second review worked in a folder where it could see the check file. It was not fully independent of the check.

Would the check catch a wrong answer?

A check that cannot fail proves nothing. After the run we took a copy of the output, broke it one small way at a time and ran the check again. It caught 5 of 6. The check was made stricter after the first try at this, and the same untouched output was graded again. It let these through, so on this job they rest on the second review alone:

  • Changed nearest_article on row 3 of gaps.csv from HA-08 to HA-01

Open every file

flow.md · the three steps the agent followed
# List questions no help article answers

function: support
for: the person who owns the help centre and decides what to write next
goal: Every question from the month's tickets is matched to an article or named as a gap, with the gaps counted so the most asked comes first.

## 1. Read the articles and the tickets
Read input/help_articles.md and input/tickets.csv. An article answers a question only when it
states the fact the customer needs. An article about a nearby subject does not count. When two
articles disagree, the one with the later Updated date is the one to use.

## 2. File every ticket
Give each ticket one status:
- `repeat` when the same customer_email sent the very same question earlier. Repeats are not counted again.
- `not_a_question` when the message asks nothing, such as thanks or a note to ignore an earlier message.
- `gap` when the ticket asks something no article answers. A ticket with two questions is a `gap` if either question has no article.
- `answered` when an article states the answer. The answer may be "no, you cannot".

For a `gap`, write the question in your own plain words. Customers ask the same thing in different
words and with different product names. Tickets that want the same missing article must get exactly
the same gap question. Tickets that would need different articles must not be merged.

## 3. Write the ticket map and gap list
Write output/ticket_map.csv with columns ticket_id,status,article_id,gap_question. One row per
ticket, in the order of the tickets file. article_id is filled only for `answered`. gap_question is
filled only for `gap`.

Write output/gaps.csv with columns gap_question,ticket_count,ticket_ids,nearest_article. One row
per gap question, most tickets first.
- ticket_ids lists the gap tickets for that question, separated by `;`.
- ticket_count is the number of ids listed.
- nearest_article is the id of the article that comes closest and could be extended, or `none`.

## Done looks like
- Every ticket appears once in ticket_map.csv with one of the four statuses.
- Every gap ticket is listed under exactly one question in gaps.csv.
- Each ticket_count equals the number of ticket ids on its row.
input/help_articles.md · 104 lines, 6 KB
# Fernwick Bookings help centre

All published help articles as of 30 November 2026.

## HA-01: Reset your password
Updated: 2026-03-04

On the sign-in page choose "Forgot password" and enter your login email. We send a reset link within 5 minutes. The link works for 60 minutes and can be used once.

If the email does not arrive, check your spam folder first. You can ask for a new link up to 3 times an hour. A new password must be at least 12 characters long.

If you no longer have access to your login email, the account owner can change it for you under Settings > Staff.

## HA-02: Sync bookings with Google Calendar
Updated: 2026-05-19

Go to Settings > Calendar sync and choose "Connect Google". New and changed bookings appear in your Google Calendar within 10 minutes.

Sync is one way on the starter plan: bookings go from Fernwick to Google. Two way sync, where events you add in Google block time in Fernwick, is included on the team and premier plans.

Each staff member connects their own Google Calendar. Disconnecting removes the synced copies from Google but never deletes a booking in Fernwick.

## HA-03: Take a deposit when a client books
Updated: 2026-06-02

Go to Settings > Payments > Deposits. You can ask for a fixed amount or a share of the price, from 10% to 100%. The deposit is taken by card at the moment of booking.

Deposits are available on every plan. For cards issued in the United States the card processing fee is 2.9% plus 30 cents per payment. Payouts reach your bank within 2 business days.

If you cancel a booking yourself, the deposit goes back to the client in full.

## HA-04: Refunds on Fernwick plans
Updated: 2025-09-15

A charge for a monthly plan can be refunded within 14 days of the charge. A charge for an annual plan can be refunded within 30 days. Write to support from your login email to ask for a refund.

## HA-05: Send reminder texts and emails
Updated: 2026-04-11

Go to Settings > Reminders. Every plan sends an email reminder 24 hours before the appointment by default. You can set up to 3 reminders for each booking.

Text reminders are included on the team and premier plans only. The team plan includes 500 texts a month and the premier plan includes 2,000 texts a month. Extra texts cost 3 cents each.

Reminder times follow the time zone set under Settings > Business details.

## HA-06: Add staff and set their hours
Updated: 2026-02-27

Go to Settings > Staff and choose "Add staff member". The starter plan includes 1 staff calendar, the team plan includes up to 10 and the premier plan has no limit.

Each staff member has their own working hours and their own sign-in. The invite email is valid for 7 days. There are three roles: owner, manager and staff. Only the owner can change the plan.

## HA-07: Block time off and holidays
Updated: 2026-07-08

Open the calendar and choose "Block time". You can block a single slot, a whole day or a range of dates up to 60 days long. Blocked days show as unavailable on your booking page.

Bookings that already sit inside a blocked range are not cancelled. You need to move or cancel them yourself. To block the same time every week, such as a lunch break, tick "Repeat weekly".

## HA-08: Export your client list and bookings
Updated: 2026-06-30

Go to Clients > Export to download your client list as a spreadsheet file. It includes each client's name, email, phone number, notes and last visit.

Exports of up to 5,000 clients are ready straight away. Larger exports are emailed to you within 1 hour. To export bookings go to Reports > Bookings, where you can export up to 12 months at a time.

Exports are open to the owner and manager roles.

## HA-09: Set up class passes and packages
Updated: 2026-09-10

Go to Services > Passes and choose "New pass". Set the number of visits, from 2 to 50, the price and how long the pass lasts, from 1 to 12 months after purchase.

Passes are included on the team and premier plans. Clients buy a pass on your booking page and each booking takes one visit off the pass. Visits left on a pass when it runs out are lost and are not refunded automatically.

## HA-10: Find and download your invoices
Updated: 2026-01-20

Go to Settings > Plan > Invoices. Every invoice from the last 24 months is listed there as a PDF. We also email each invoice to the owner's login email on the day of the charge.

To add a tax number or change the business address, go to Settings > Plan > Billing details. Changes apply to future invoices only.

## HA-11: Plan changes, cancelling and refunds
Updated: 2026-08-21

To cancel, go to Settings > Plan and choose "Cancel plan". Your plan stays active until the end of the period you have paid for and you will not be charged again.

A charge for a monthly plan can be refunded within 30 days of the charge. A charge for an annual plan can be refunded within 60 days. We do not refund part of a month.

A move to a lower plan takes effect on your next billing date. A move to a higher plan takes effect at once.

## HA-12: Add a second location
Updated: 2026-10-05

Go to Settings > Locations and choose "Add location". The starter plan has 1 location, the team plan includes 2 locations and the premier plan includes up to 10.

Each location has its own address, opening hours and booking page link. A staff member can work at more than one location.

## HA-13: Late cancellation and no-show fees
Updated: 2026-05-05

Go to Settings > Booking rules > Cancellation. Set a cut-off from 1 to 72 hours before the appointment. A client who cancels after the cut-off can be charged a late fee of up to 100% of the price.

A no-show fee can only be charged when the client saved a card at booking. Fees are charged to that card and appear in your next payout.
input/tickets.csv · 61 lines, 6 KB
ticket_id,received_on,customer_email,question
H-7001,2026-11-02,amber1@clientmail.example,Is there a waiting list for fully booked days?
H-7002,2026-11-02,farah4@clientmail.example,Is the card fee different for foreign cards?
H-7003,2026-11-02,keiko7@clientmail.example,When a client pays a deposit how long until the money is in my bank?
H-7004,2026-11-03,pavel3@clientmail.example,"Can I get a code by text when I sign in, for extra security?"
H-7005,2026-11-03,umar6@clientmail.example,How many staff calendars do I get on the starter plan?
H-7006,2026-11-04,zofia2@clientmail.example,What is the longest cancellation cut-off I can set?
H-7007,2026-11-04,emre5@clientmail.example,What happens to visits left on a class pass when it runs out?
H-7008,2026-11-05,jun1@clientmail.example,Can I turn on two-step verification for my login?
H-7009,2026-11-05,olga4@clientmail.example,Do reminders use my time zone or the client's?
H-7010,2026-11-05,talia7@clientmail.example,What do you charge for cards from overseas?
H-7011,2026-11-06,yann3@clientmail.example,Do you support two factor login?
H-7012,2026-11-06,dolores6@clientmail.example,Can I take a 20% deposit at booking?
H-7013,2026-11-07,isak2@clientmail.example,I used block time for next Friday but the bookings that were already there are still showing. Is that right?
H-7014,2026-11-07,nadim5@clientmail.example,Is there a client import? I can only find the export.
H-7015,2026-11-08,soren1@clientmail.example,How do I export a year of bookings for my accountant?
H-7016,2026-11-08,xiomara4@clientmail.example,How many days do I have to ask for a refund on an annual plan?
H-7017,2026-11-09,chidi7@clientmail.example,Can I add my tax number to the invoice?
H-7018,2026-11-09,hattie3@clientmail.example,Is there a way to sell a gift voucher for a set amount?
H-7019,2026-11-09,maeve6@clientmail.example,If I disconnect Google Calendar will my bookings be deleted?
H-7020,2026-11-10,rhea2@clientmail.example,Can you import clients from a file my old system gave me?
H-7021,2026-11-10,wes5@clientmail.example,How do I change the look of my booking page? I want our colours and logo on it.
H-7022,2026-11-11,baxter1@clientmail.example,"How do I export my clients, and is there an import for bringing a client list in?"
H-7023,2026-11-11,gideon4@clientmail.example,Can I charge a no-show fee if the client did not save a card?
H-7024,2026-11-12,lorenzo7@clientmail.example,My receptionist lives in Outlook. Is there any way to see bookings there?
H-7025,2026-11-12,quinn3@clientmail.example,"Your last update is great, the calendar loads much faster now."
H-7026,2026-11-13,vera6@clientmail.example,What is the processing fee for a card issued outside the United States?
H-7027,2026-11-13,amber2@clientmail.example,Does Fernwick work with an Office 365 calendar?
H-7028,2026-11-13,farah5@clientmail.example,"Thanks for the quick help yesterday, all sorted."
H-7029,2026-11-14,keiko1@clientmail.example,"Please ignore my last message, I found the setting."
H-7030,2026-11-14,pavel4@clientmail.example,How do I set up a waiting list?
H-7031,2026-11-15,umar7@clientmail.example,If I downgrade when does the change take effect?
H-7032,2026-11-15,zofia3@clientmail.example,Can I add my logo to the booking page and match it to my brand colours?
H-7033,2026-11-16,emre6@clientmail.example,Can I upload a file of clients instead of typing them in one by one?
H-7034,2026-11-16,jun2@clientmail.example,Do you support gift cards that clients can buy online?
H-7035,2026-11-16,olga5@clientmail.example,We use Outlook at the clinic. Is there a calendar sync for it?
H-7036,2026-11-17,talia1@clientmail.example,How do I import my client list from a spreadsheet?
H-7037,2026-11-17,yann4@clientmail.example,Can the reminder texts go out in Spanish?
H-7038,2026-11-18,dolores7@clientmail.example,How do I block out a whole week for a holiday?
H-7039,2026-11-18,isak3@clientmail.example,Can I send a newsletter to all my clients from Fernwick?
H-7040,2026-11-19,nadim6@clientmail.example,Can staff connect an Outlook calendar instead of a Google one?
H-7041,2026-11-19,soren2@clientmail.example,A client wants to buy a gift certificate for her sister. How do I set that up?
H-7042,2026-11-20,xiomara5@clientmail.example,How many texts are included on the team plan each month?
H-7043,2026-11-20,chidi1@clientmail.example,The reset link says it has expired. How long is a password reset link valid for?
H-7044,2026-11-20,hattie4@clientmail.example,How do I connect my Outlook calendar?
H-7045,2026-11-21,maeve7@clientmail.example,Who is allowed to export the client list?
H-7046,2026-11-21,rhea3@clientmail.example,What is the largest number of visits I can put on a class pass?
H-7047,2026-11-22,wes6@clientmail.example,How do I set up 2FA for everyone on my team?
H-7048,2026-11-22,baxter2@clientmail.example,Where can I download last month's invoice?
H-7049,2026-11-23,gideon5@clientmail.example,Is two way sync with Google Calendar included on the starter plan?
H-7050,2026-11-23,lorenzo1@clientmail.example,I am moving over from another booking system. Can you import my 800 clients?
H-7051,2026-11-24,quinn4@clientmail.example,Can I sync my bookings to Outlook?
H-7052,2026-11-24,vera7@clientmail.example,Any plans for Microsoft calendar sync? I can only see Google in the settings.
H-7053,2026-11-24,amber3@clientmail.example,Does each location get its own booking page link?
H-7054,2026-11-25,farah6@clientmail.example,Can I sell gift vouchers?
H-7055,2026-11-25,keiko2@clientmail.example,How long does my new password need to be?
H-7056,2026-11-26,pavel5@clientmail.example,The invite I sent my new staff member has stopped working. How long does it last?
H-7057,2026-11-26,umar1@clientmail.example,Is there an Android app for tablets?
H-7058,2026-11-27,zofia4@clientmail.example,How many locations can I have on the premier plan?
H-7059,2026-11-27,emre7@clientmail.example,Can clients join a waitlist when a class is full?
H-7060,2026-11-28,quinn4@clientmail.example,Can I sync my bookings to Outlook?
output/gaps.csv · written by the agent, 11 lines
gap_question,ticket_count,ticket_ids,nearest_article
Can I sync my bookings with an Outlook or Microsoft 365 calendar?,7,H-7024;H-7027;H-7035;H-7040;H-7044;H-7051;H-7052,HA-02
Can I import a client list from a file or another system into Fernwick?,6,H-7014;H-7020;H-7022;H-7033;H-7036;H-7050,HA-08
Can I turn on two-step verification (2FA) for logins?,4,H-7004;H-7008;H-7011;H-7047,HA-01
Can I sell gift vouchers or gift cards that clients buy online?,4,H-7018;H-7034;H-7041;H-7054,HA-09
"Can clients join a waiting list when a day or class is fully booked, and how is it set up?",3,H-7001;H-7030;H-7059,none
What is the card processing fee for cards issued outside the United States?,3,H-7002;H-7010;H-7026,HA-03
Can I put my logo and brand colours on my booking page?,2,H-7021;H-7032,none
"Can reminder texts be sent in languages other than English, such as Spanish?",1,H-7037,HA-05
Can I send a newsletter or marketing email to my clients from Fernwick?,1,H-7039,none
Is there an Android app for tablets?,1,H-7057,none
output/ticket_map.csv · written by the agent, 61 lines
ticket_id,status,article_id,gap_question
H-7001,gap,,"Can clients join a waiting list when a day or class is fully booked, and how is it set up?"
H-7002,gap,,What is the card processing fee for cards issued outside the United States?
H-7003,answered,HA-03,
H-7004,gap,,Can I turn on two-step verification (2FA) for logins?
H-7005,answered,HA-06,
H-7006,answered,HA-13,
H-7007,answered,HA-09,
H-7008,gap,,Can I turn on two-step verification (2FA) for logins?
H-7009,answered,HA-05,
H-7010,gap,,What is the card processing fee for cards issued outside the United States?
H-7011,gap,,Can I turn on two-step verification (2FA) for logins?
H-7012,answered,HA-03,
H-7013,answered,HA-07,
H-7014,gap,,Can I import a client list from a file or another system into Fernwick?
H-7015,answered,HA-08,
H-7016,answered,HA-11,
H-7017,answered,HA-10,
H-7018,gap,,Can I sell gift vouchers or gift cards that clients buy online?
H-7019,answered,HA-02,
H-7020,gap,,Can I import a client list from a file or another system into Fernwick?
H-7021,gap,,Can I put my logo and brand colours on my booking page?
H-7022,gap,,Can I import a client list from a file or another system into Fernwick?
H-7023,answered,HA-13,
H-7024,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7025,not_a_question,,
H-7026,gap,,What is the card processing fee for cards issued outside the United States?
H-7027,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7028,not_a_question,,
H-7029,not_a_question,,
H-7030,gap,,"Can clients join a waiting list when a day or class is fully booked, and how is it set up?"
H-7031,answered,HA-11,
H-7032,gap,,Can I put my logo and brand colours on my booking page?
H-7033,gap,,Can I import a client list from a file or another system into Fernwick?
H-7034,gap,,Can I sell gift vouchers or gift cards that clients buy online?
H-7035,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7036,gap,,Can I import a client list from a file or another system into Fernwick?
H-7037,gap,,"Can reminder texts be sent in languages other than English, such as Spanish?"
H-7038,answered,HA-07,
H-7039,gap,,Can I send a newsletter or marketing email to my clients from Fernwick?
H-7040,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7041,gap,,Can I sell gift vouchers or gift cards that clients buy online?
H-7042,answered,HA-05,
H-7043,answered,HA-01,
H-7044,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7045,answered,HA-08,
H-7046,answered,HA-09,
H-7047,gap,,Can I turn on two-step verification (2FA) for logins?
H-7048,answered,HA-10,
H-7049,answered,HA-02,
H-7050,gap,,Can I import a client list from a file or another system into Fernwick?
H-7051,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7052,gap,,Can I sync my bookings with an Outlook or Microsoft 365 calendar?
H-7053,answered,HA-12,
H-7054,gap,,Can I sell gift vouchers or gift cards that clients buy online?
H-7055,answered,HA-01,
H-7056,answered,HA-06,
H-7057,gap,,Is there an Android app for tablets?
H-7058,answered,HA-12,
H-7059,gap,,"Can clients join a waiting list when a day or class is fully booked, and how is it set up?"
H-7060,repeat,,
check.py · the check, written before the run
"""Checks the ticket map and the gap list against the help articles and the tickets.

Each subject below has words to look for in a customer's question and words to look for in the
article titles. A subject whose words match no article title is a gap. This gives, from the input
files alone, which tickets are answered, which are gaps and which gap tickets belong together.
"""
import csv, re, sys
from collections import Counter
from pathlib import Path
root = Path(sys.argv[1]); ok = True
def say(passed, text):
    global ok; ok = ok and passed; print(("PASS " if passed else "FAIL ") + text)

SUBJECTS = [  # (name, words in the question, words in an article title)
    ("password", r"password", r"password"), ("deposit", r"deposit", r"deposit"),
    ("staff", r"staff calendar|staff member", r"staff"), ("time off", r"\bblock\b", r"block time"),
    ("invoices", r"invoice", r"invoice"), ("refunds", r"refund|downgrade", r"refunds"),
    ("passes", r"class pass", r"passes"), ("reminders", r"reminder|texts are included", r"reminder"),
    ("export", r"export", r"export"), ("locations", r"location", r"location"),
    ("late fees", r"no-show|cut-off", r"no-show"), ("google calendar", r"google calendar", r"google calendar"),
    ("another calendar", r"outlook|office 365|microsoft", r"outlook|microsoft"),
    ("client import", r"import|upload a file of clients", r"import"),
    ("gift vouchers", r"gift", r"gift|voucher"),
    ("cards from abroad", r"overseas|foreign|outside the united states", r"overseas|foreign|international"),
    ("two-step sign-in", r"two-step|two factor|2fa|code by text", r"two-step|two factor|verification"),
    ("waiting list", r"waiting list|waitlist", r"waiting|waitlist"),
    ("booking page look", r"logo|colours", r"logo|colour|brand"),
    ("tablet app", r"android", r"android"), ("newsletters", r"newsletter", r"newsletter|marketing"),
    ("other languages", r"spanish", r"spanish|language"),
]
text = (root/"input/help_articles.md").read_text()
arts = {m.group(1): (m.group(2).strip().lower(), m.group(3)) for m in re.finditer(r"^## (HA-\d+): ([^\n]+)\nUpdated: (\S+)", text, re.M)}
tickets = list(csv.DictReader((root/"input/tickets.csv").open()))
want, seen = {}, set()
for t in sorted(tickets, key=lambda r: (r["received_on"], r["ticket_id"])):
    q = re.sub(r"\s+", " ", t["question"]).strip().lower()
    who = (t["customer_email"].strip().lower(), q)
    if who in seen:
        want[t["ticket_id"]] = ("repeat", ""); continue
    seen.add(who)
    gaps, covered = [], []
    for name, q_words, title_words in SUBJECTS:
        if re.search(q_words, q):
            match = [a for a, (title, _) in arts.items() if re.search(title_words, title)]
            if match: covered.append(max(match, key=lambda a: arts[a][1]))
            else: gaps.append(name)
    want[t["ticket_id"]] = ("gap", gaps[0]) if gaps else ("answered", covered[0]) if covered else ("not_a_question", "")

if not (root/"output/ticket_map.csv").exists() or not (root/"output/gaps.csv").exists():
    say(False, "output/ticket_map.csv and output/gaps.csv were not both written"); sys.exit(1)
rows = list(csv.DictReader((root/"output/ticket_map.csv").open()))
got = {(r.get("ticket_id") or "").strip(): r for r in rows}
def cell(k, col):
    return (got.get(k, {}).get(col) or "").strip()
n = len(want)
once = sum(1 for k in want if sum(1 for r in rows if (r.get("ticket_id") or "").strip() == k) == 1)
say(once == n and len(rows) == n, f"{once} of {n} tickets appear once in ticket_map.csv")
tally = Counter(w[0] for w in want.values())
right = sum(1 for k, w in want.items() if cell(k, "status").lower() == w[0])
say(right == n, f"{right} of {n} statuses equal a keyword match of the question against the article titles: {tally['answered']} answered, {tally['gap']} gaps, {tally['not_a_question']} not questions and {tally['repeat']} repeat")
ans = {k: w[1] for k, w in want.items() if w[0] == "answered"}
right = sum(1 for k, a in ans.items() if cell(k, "article_id").upper() == a)
say(right == len(ans), f"{right} of {len(ans)} answered tickets cite the article whose title covers the subject")

table = list(csv.DictReader((root/"output/gaps.csv").open()))
row_of, counts_ok = {}, 0
for i, g in enumerate(table):
    ids = [x.strip() for x in re.split(r"[;,\s]+", g.get("ticket_ids") or "") if x.strip()]
    for x in ids: row_of.setdefault(x, []).append(i)
    try: counts_ok += int((g.get("ticket_count") or "").strip()) == len(ids) == len(set(ids))
    except ValueError: pass
gap_ids = [k for k, w in want.items() if w[0] == "gap"]
listed = sum(1 for k in gap_ids if len(row_of.get(k, [])) == 1)
extra = sum(1 for k in row_of if k not in gap_ids)
say(listed == len(gap_ids) and extra == 0 and counts_ok == len(table), f"{listed} of {len(gap_ids)} gap tickets are listed once in gaps.csv and {counts_ok} of {len(table)} counts equal the number of tickets listed")
names = sorted({w[1] for w in want.values() if w[0] == "gap"})
homes, kept = {}, 0
for name in names:
    ids = [k for k, w in want.items() if w == ("gap", name)]
    top, size = Counter(row_of.get(k, [-1])[0] for k in ids).most_common(1)[0]
    if top != -1 and size >= 0.8 * len(ids):
        kept += 1; homes[name] = top
own = len(set(homes.values()))
say(kept == len(names) and own == len(names), f"{kept} of {len(names)} missing subjects found by keyword have at least 8 in 10 of their tickets on one row, across {own} different rows")
sizes = Counter(w[1] for w in want.values() if w[0] == "gap")
biggest = sizes.most_common(1)[0][1]
order = [len([x for x in re.split(r"[;,\s]+", g.get("ticket_ids") or "") if x.strip()]) for g in table]
say(bool(order) and order == sorted(order, reverse=True) and order[0] == biggest, f"gaps.csv lists the most asked question first with {order[0] if order else 0} tickets, against {biggest} by keyword match")
near = [(g.get("nearest_article") or "").strip() for g in table]
real = sum(1 for x in near if x.lower() == "none" or x.upper() in arts)
say(real == len(table) and len(table) > 0, f"{real} of {len(table)} nearest_article entries are a real article id or none")
def tidy(x):
    return re.sub(r"\s+", " ", x or "").strip()
same = sum(1 for k in gap_ids if cell(k, "gap_question") and len(row_of.get(k, [])) == 1
           and tidy(cell(k, "gap_question")) == tidy(table[row_of[k][0]].get("gap_question")))
stray = sum(1 for k, w in want.items() if (w[0] != "gap" and cell(k, "gap_question")) or (w[0] != "answered" and cell(k, "article_id")))
say(same == len(gap_ids) and stray == 0, f"{same} of {len(gap_ids)} gap tickets carry the same question in ticket_map.csv as the row that lists them in gaps.csv and {stray} tickets carry a question or an article id they should not")
sys.exit(0 if ok else 1)

help_articles.md: sample data written by Atris. Fingerprint 244c022dfde1.

tickets.csv: sample data written by Atris. Fingerprint 4be040c08492.

gaps.csv: written by the agent. Fingerprint 34daed0ede42.

ticket_map.csv: written by the agent. Fingerprint 6524a7c64dba.


More customer support work, and every other desk job

For agentsGitHub
What is AtrisBlogApp StorePricingPrivacyTerms