Priority Lab sync: state/address must display correctly (e.g. TX not Te)
Objective
- Priority Lab / Breeze appointments created or updated from Attik must show correct address fields in the Priority Lab app, with US state shown as the two-letter value users expect (e.g. TX), not truncated garbage (e.g. Te from Texas).
- Coordinators should be able to rely on sync without fixing addresses manually in Priority Lab after every job.
Background
- Product feedback: some jobs show Te instead of TX in Priority Lab after Attik integration sync went live.
- Outbound sync maps the inspection to a vendor form payload in
buildPriorityLabPayload. State today is built frominspection.property.stateby trimming, taking only the first two characters, then uppercasing—so a stored full name Texas becomes Te. - Two-letter values already stored (TX, CO) behave as intended in the same line of code.
property.stateon inspections is a plain string ininspectionSchema(viaPropertySchema); other parts of the product do not enforce abbreviation at write time, so full names can land in Mongo from booking, imports, or edits.- Decision needed: whether to normalize only in the Priority Lab payload, introduce shared normalization used elsewhere, or enforce two-letter state at entry—Product should align with Legal/ops on territories and edge cases.
- Reports from SE of RIA, CHI and NHI jobs having no state entered at all.
Scope
Backend
buildPriorityLabPayloadinattik-backend/src/util/functions/priorityLab/buildPriorityLabPayload.tsis wherestate(andaddress,city,zipcode) are assembled forCreateUpdateAppointmentPayloadbefore the Priority Lab API call.syncPriorityLabAppointmentinattik-backend/src/util/functions/priorityLab/syncPriorityLabAppointment.tsinvokes that builder during upserts;inspectionStream.tsandsrc/routes/inspection.ts(after save) enqueue work throughqueuePriorityLabJobinattik-backend/src/events/bullmq/priorityLabQueues.ts; manual sync usesPOST /priority-lab/inspection/:id/syncinattik-backend/src/routes/priorityLab.ts.priorityLabApi.tsdefines the payload shape sent to the vendor—confirm any vendor constraints on state length or format if documentation exists.
Frontend
- The inspection tools card
PriorityLab.tsx(attik-frontend/src/app/tools/inspections/[id]/components/integrations/PriorityLab.tsx) surfaces sync status and manual resync; it does not build the address payload today. Changes are primarily backend unless UX copy should mention how state should be entered until normalization exists.
Tests
attik-backend/tests/unit/priorityLab.computeAndPayload.test.tsalready coversbuildPriorityLabPayloadwith two-letter states; extend with cases that reproduce the customer issue (full state name, mixed case) once behavior is defined.
References
attik-backend/src/util/functions/priorityLab/buildPriorityLabPayload.tsattik-backend/src/util/functions/priorityLab/syncPriorityLabAppointment.tsattik-backend/src/util/functions/priorityLab/priorityLabApi.tsattik-backend/src/events/streamHandlers/inspectionStream.ts(Priority Lab enqueue)attik-backend/src/routes/priorityLab.tsattik-backend/tests/unit/priorityLab.computeAndPayload.test.tsattik-frontend/src/app/tools/inspections/[id]/components/integrations/PriorityLab.tsx
Status: Completed
Log in to comment and vote
No comments yet
Be the first to share your thoughts.