Trenta rifiuti a settimana per foto non lavorabili. Una telefonata di assistenza ogni tre. Un utente frustrato per il resto. Il sistema vecchio decideva sul server: la decisione arrivava dopo l'attesa, senza spiegazioni.
Thirty rejections a week from unprocessable photos. One support call out of three. A frustrated user for the rest. The old system decided on the server: the verdict came after the wait, without explanations.
La ricetta SSN è un documento ufficiale. L'utente non può modificarla. Non può rifarla. Non può sapere, dal proprio smartphone, se la foto che ha appena scattato è leggibile o no. Quando l'utente non può sbagliare, il sistema deve sbagliare al posto suo. Questo è il principio. Tutto il resto è ingegneria.
An SSN prescription is an official document. The user can't modify it. Can't redo it. Can't know, from their phone, whether the photo they just took is readable or not. When the user cannot fail, the system must fail on their behalf. That's the principle. Everything else is engineering.
Tre modalità di input
Three input modes
Per accomodare l'eterogeneità degli utenti — chi ha la ricetta cartacea sotto mano, chi l'ha ricevuta come PDF via email, chi ha solo il codice NRE annotato — ho previsto tre vie di input distinte. Tutte e tre convergono nello stesso pipeline di validazione.
To accommodate user heterogeneity — those holding the paper prescription, those who received a PDF via email, those who only have the NRE code jotted down — I designed three distinct input paths. All three converge into the same validation pipeline.
Quattro controlli, una soglia
Four checks, one threshold
Il scoring lavora su quattro segnali estratti dall'immagine — o, nel caso del codice diretto, dal solo NRE. Quattro segnali eterogenei, valutati insieme, che producono un punteggio. Sopra una soglia tarata empiricamente: passa al server. Sotto: rifiuto immediato in app, con la spiegazione del perché.
Scoring works on four signals extracted from the image — or, in the direct-code case, from the NRE alone. Four heterogeneous signals, evaluated together, producing a score. Above an empirically tuned threshold: passes to the server. Below: instant in-app rejection, with the reason.
↓
Una ricetta normalizzata
A normalized prescription
Check · 01
Check · 01
Termini ricorrenti
Recurring terms
I termini sempre presenti su una ricetta SSN sono nella foto?
Are the terms always present on an SSN prescription in the photo?
Check · 02
Check · 02
Verifica leggibilità
Legibility check
Il testo è leggibile su tutta la superficie, o solo in alto?
Is text readable across the whole surface, or only at the top?
Check · 03
Check · 03
Lettura codice NRE
NRE code reading
Necessario e non sufficiente. Senza, niente passa.
Necessary and not sufficient. Without it, nothing passes.
Check · 04
Check · 04
Rapporto testo / area
Text-to-area ratio
La foto contiene solo la ricetta, o anche la scrivania intorno?
Is the photo only the prescription, or also the desk around it?
↓
Scoring · soglia tarata empiricamente
Scoring · empirically tuned threshold
Sotto soglia
Below threshold
Rifiuto immediato, in app
Instant in-app rejection
Spiegazione del perché. Nessuna richiesta al server.
Reason explained. No request to the server.
Sopra soglia
Above threshold
Invio al server
Sent to server
Il sistema può fidarsi. Passa al secondo livello di controllo.
The system can trust. Passes to the second control level.
↓
Secondo livello
Second level
Controllo server
Server check
Validazione complessa, accesso a dati di anagrafica, verifica del codice NRE contro fonte autoritativa.
Complex validation, registry data access, NRE verification against authoritative source.
↓
✓ Ricetta accettata, prenotazione confermata
✓ Prescription accepted, booking confirmed
La soglia, e il peso del NRE
The threshold, and the weight of the NRE
Lo scoring client è calibrato su una soglia alta, tarata empiricamente sui dati di lettura: sotto questo livello il rischio di interpretazione inaffidabile diventa significativo, sopra il sistema può fidarsi e passare il documento al server per il secondo controllo. Non tutti i check pesano allo stesso modo: la lettura del codice NRE è il più diagnostico — una sua mancata lettura non è compensabile da nessuno degli altri. Gli altri tre si compensano fra loro; l'NRE no.
Client-side scoring is calibrated on a high threshold, empirically tuned to reading data: below this level the risk of unreliable interpretation becomes significant, above the system can trust and pass the document to the server for the second check. Not all checks weigh equally: NRE code reading is the most diagnostic — its failure is not compensable by any of the others. The other three compensate among themselves; the NRE does not.
Attribuzione: l'enhancement
Attribution: the enhancement
La libreria di correzione prospettica e enhancement è stata sviluppata e affinata dal team dev. Io ho contribuito alla calibrazione e alla verifica degli output sui pattern individuati in fase di research. Il design del flusso, lo scoring, la soglia e i check sono il mio perimetro; la pipeline tecnica di pre-processing è del team dev.
The perspective correction and enhancement library was developed and refined by the dev team. I contributed to calibration and to verifying outputs against the patterns identified during research. Flow design, scoring, threshold and checks are my scope; the technical pre-processing pipeline is the dev team's.
Perché funziona: due livelli, due logiche
Why it works: two levels, two logics
Il controllo client non sostituisce il server, lo precede. Il client serve a dare feedback immediato all'utente — niente attesa, niente errori opachi — e a ridurre il traffico di documenti illeggibili che bloccavano la coda lato server. Il server fa quello che il client non può fare: validazione complessa, verifica contro fonte autoritativa, integrazione con i flussi di prenotazione. Due livelli, due logiche, una stessa promessa all'utente: se sei arrivato a vedere "in elaborazione", la tua ricetta è valida.
The client check doesn't replace the server, it precedes it. The client gives instant feedback to the user — no wait, no opaque errors — and reduces the flow of unreadable documents clogging the server-side queue. The server does what the client can't: complex validation, verification against authoritative source, integration with booking flows. Two levels, two logics, one promise to the user: if you've made it to "processing", your prescription is valid.