Files
dailygrubs_console_build/build/static/js/7162.47992bf7.chunk.js

1 line
14 KiB
JavaScript

"use strict";(self.webpackChunkmantis_material_react=self.webpackChunkmantis_material_react||[]).push([[7162],{27162:function(e,u,t){t.d(u,{DI:function(){return w},GO:function(){return x},JB:function(){return d},JU:function(){return M},oz:function(){return B},rC:function(){return A}});var r=t(1413),n=t(93433),i=330,a=function(e){return Boolean(e&&String(e.orderid||"").trim())},o=function(e){return Array.isArray(e)?e.filter(a):[]},s=function(e){if(null===e||void 0===e)return null;var u=/(\d{1,2}):(\d{2})(?::(\d{2}))?/.exec(String(e));if(!u)return null;var t=Number(u[1]),r=Number(u[2]);return t>23||r>59?null:60*t+r+Number(u[3]||0)/60},c=function(e){var u=s(e);return null===u?null:Math.round(60*u)},d=function(e){if(null===e||void 0===e||Number.isNaN(e))return"\u2014";var u=Math.round(e),t=Math.floor(u/60)%24,r=u%60;return"".concat(String(t).padStart(2,"0"),":").concat(String(r).padStart(2,"0"))},l=function(e){var u=e.filter((function(e){return"number"===typeof e&&!Number.isNaN(e)})).sort((function(e,u){return e-u}));if(!u.length)return null;var t=Math.floor(u.length/2);return u.length%2?u[t]:(u[t-1]+u[t])/2},D=function(e){for(var u=e;u>720;)u-=1440;for(;u<=-720;)u+=1440;return u},F=["assigntime","starttime","arrivaltime","pickuptime","deliverytime"],f={assigntime:"assign",starttime:"start",arrivaltime:"arrival",pickuptime:"pickup",deliverytime:"delivery"},m=function(e){return null!==e&&void 0!==e&&""!==String(e).trim()},h={rider:["ridername","rider"],charge:["deliverycharges","deliverycharge"],distance:["kms","actualkms"],zone:["deliverysuburb","locationsuburb"],locality:["deliverylocation","deliverysuburb"]},g=function(e,u){for(var t=h[u]||[u],r=0;r<t.length;r+=1)if(m(e&&e[t[r]]))return e[t[r]];return""},p=function(e){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=u.toleranceMin,r=void 0===t?45:t,n=u.minOrders,a=void 0===n?5:n,c=[];o(e).forEach((function(e){var u=s(e.deliverydate),t=s(e.assigntime);null!==u&&null!==t&&c.push(D(t-u))}));var d=l(c);if(null===d||c.length<a)return{suspected:!1,sampleSize:c.length,medianDeltaMin:d,spreadMin:null,suggestedShiftMin:0};var F=l(c.map((function(e){return Math.abs(e-d)}))),f=Math.abs(d-i)<=r&&F<=r;return{suspected:f,sampleSize:c.length,medianDeltaMin:Math.round(d),spreadMin:Math.round(F),suggestedShiftMin:f?i:0}},C=function(e){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=u.maxGapSeconds,r=void 0===t?25:t,n=u.minClusterSize,i=void 0===n?4:n,a=o(e).map((function(e){return{orderid:String(e.orderid),seconds:c(e.deliverytime),raw:e.deliverytime}})).filter((function(e){return null!==e.seconds})).sort((function(e,u){return e.seconds-u.seconds})),s=[],d=[],D=function(){if(d.length>=i){var e=d.slice(1).map((function(e,u){return e.seconds-d[u].seconds})),u=d.map((function(e){return e.orderid})),t=u.every((function(e,t){return 0===t||u[t-1]>=e})),r=u.every((function(e,t){return 0===t||u[t-1]<=e}));s.push({count:d.length,orderIds:u,firstStamp:d[0].raw,lastStamp:d[d.length-1].raw,spanSeconds:d[d.length-1].seconds-d[0].seconds,medianGapSeconds:l(e),monotonicByOrderId:t||r})}d=[]};return a.forEach((function(e,u){0===u||e.seconds-a[u-1].seconds<=r?d.push(e):(D(),d=[e])})),D(),s},v=function(e){var u=o(e),t={};F.forEach((function(e){t[e]=u.filter((function(u){return m(u[e])})).length}));var r=F.reduce((function(e,u){return e+t[u]}),0),n=u.length*F.length;return{stages:t,captured:r,expected:n,ratio:n?r/n:0,orderCount:u.length}},E=function(e){var u=[];return o(e).forEach((function(e){for(var t=F.map((function(u){return{stage:u,seconds:m(e[u])?c(e[u]):null}})).filter((function(e){return null!==e.seconds})),r=1;r<t.length;r+=1)t[r].seconds<t[r-1].seconds&&u.push({orderid:String(e.orderid),earlier:f[t[r].stage],later:f[t[r-1].stage],earlierValue:e[t[r].stage],laterValue:e[t[r-1].stage]})})),u},A=function(e){return/(?:[\0-\x08\x0E-\x1F\u0250-\u037D\u037F-\u0386\u0388-\u0559\u0560-\u0588\u058B-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7-\u05F2\u05F5-\u0608\u060B\u060E-\u061A\u061C\u0620-\u0669\u066E-\u06D3\u06D5-\u06FF\u070E-\u07F6\u07FA-\u082F\u083F-\u085D\u085F-\u0963\u0966-\u096F\u0971-\u09FC\u09FE-\u0A75\u0A77-\u0AEF\u0AF1-\u0C76\u0C78-\u0C83\u0C85-\u0DF3\u0DF5-\u0E4E\u0E50-\u0E59\u0E5C-\u0F03\u0F13\u0F15-\u0F39\u0F3E-\u0F84\u0F86-\u0FCF\u0FD5-\u0FD8\u0FDB-\u1049\u1050-\u10FA\u10FC-\u135F\u1369-\u13FF\u1401-\u166D\u166F-\u167F\u1681-\u169A\u169D-\u16EA\u16EE-\u1734\u1737-\u17D3\u17D7\u17DB-\u17FF\u180B-\u1943\u1946-\u1A1D\u1A20-\u1A9F\u1AA7\u1AAE-\u1B59\u1B61-\u1B7C\u1B7F-\u1BFB\u1C00-\u1C3A\u1C40-\u1C7D\u1C80-\u1CBF\u1CC8-\u1CD2\u1CD4-\u1FFF\u200B-\u200F\u202A-\u202E\u2044\u2052\u2060-\u207C\u207F-\u208C\u208F-\u2307\u230C-\u2328\u232B-\u2767\u2776-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2CF8\u2CFD\u2D00-\u2D6F\u2D71-\u2DFF\u2E2F\u2E50\u2E51\u2E5E-\u2FFF\u3004-\u3007\u3012\u3013\u3020-\u302F\u3031-\u303C\u303E-\u309F\u30A1-\u30FA\u30FC-\uA4FD\uA500-\uA60C\uA610-\uA672\uA674-\uA67D\uA67F-\uA6F1\uA6F8-\uA873\uA878-\uA8CD\uA8D0-\uA8F7\uA8FB\uA8FD-\uA92D\uA930-\uA95E\uA960-\uA9C0\uA9CE-\uA9DD\uA9E0-\uAA5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\uDC00-\uDFF0\uDFF3-\uDFFF]|\uD81A[\uDC00-\uDE6D\uDE70-\uDEF4\uDEF6-\uDF36\uDF3C-\uDF43\uDF45-\uDFFF]|\uD81B[\uDC00-\uDE96\uDE9B-\uDFE1\uDFE3-\uDFFF]|\uD82F[\uDC00-\uDC9E\uDCA0-\uDFFF]|\uD836[\uDC00-\uDE86\uDE8C-\uDFFF]|\uD83A[\uDC00-\uDD5D\uDD60-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/.test(String(e||""))},y=A,S=function(e){return(e.match(/[([{]/g)||[]).length!==(e.match(/[)\]}]/g)||[]).length},b=function(e){var u=Number(e);return Number.isFinite(u)?u:0},w=function(e){var u={};return o(e).forEach((function(e){var t=String(g(e,"zone")||"Unassigned").trim()||"Unassigned";u[t]=u[t]||{zone:t,orders:0,km:0,charge:0},u[t].orders+=1,u[t].km+=b(g(e,"distance")),u[t].charge+=b(g(e,"charge"))})),Object.values(u).map((function(e){return(0,r.Z)((0,r.Z)({},e),{},{kmPerDrop:e.orders?e.km/e.orders:0,chargePerDrop:e.orders?e.charge/e.orders:0})})).sort((function(e,u){return u.orders-e.orders}))},B=function(e){var u=o(e),t=p(e),r=C(e),i=v(e),a=E(e),c=new Set;r.forEach((function(e){return e.orderIds.forEach((function(e){return c.add(e)}))})),a.forEach((function(e){return c.add(e.orderid)}));var d=u.filter((function(e){return m(e.deliverytime)})),F=u.map((function(e){var u=function(e){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=s(e&&e.deliverydate);return null===t?null:(t+u+1440)%1440}(e,t.suggestedShiftMin),r=s(e.assigntime);return null===u||null===r?null:D(r-u)})).filter((function(e){return null!==e}));return{orderCount:u.length,trustworthyDeliveryTimes:d.filter((function(e){return!c.has(String(e.orderid))})).length,deliveryStampCount:d.length,lifecycleRatio:i.ratio,lifecycleCaptured:i.captured,lifecycleExpected:i.expected,medianAssignDelayMin:F.length?Math.round(l(F)):null,totalKm:u.reduce((function(e,u){return e+b(g(u,"distance"))}),0),totalCharge:u.reduce((function(e,u){return e+b(g(u,"charge"))}),0),riders:(0,n.Z)(new Set(u.map((function(e){return String(g(e,"rider")).trim()})).filter(Boolean))),skew:t}},k={blocking:0,high:1,medium:2,low:3},M=function(e){var u=o(e),t=[];if(!u.length)return t;var r=Array.isArray(e)?e.length:0;C(e).forEach((function(e,u){t.push({id:"bulk-close-".concat(u),severity:"blocking",title:"Delivery timestamps were written in bulk, not observed",detail:"".concat(e.count," orders were stamped delivered inside ").concat(e.spanSeconds," seconds")+(null!==e.medianGapSeconds?", a median of ".concat(Math.round(e.medianGapSeconds),"s apart"):"")+(e.monotonicByOrderId?", running in order-ID sequence":"")+". That is a list being cleared, not deliveries happening. No SLA, ETA accuracy or rider productivity figure can be derived from this column.",evidence:["".concat(e.firstStamp," \u2192 ").concat(e.lastStamp),"".concat(e.count," orders, span ").concat(e.spanSeconds,"s")],orderIds:e.orderIds,fix:"Stamp delivery server-side from the rider action, and rate-limit closes per rider per minute."})}));var a=p(e);a.suspected&&t.push({id:"offset-skew",severity:"blocking",title:"Promised slots read exactly one IST offset early",detail:"Across ".concat(a.sampleSize," orders the median gap from promised slot to assignment is ").concat(a.medianDeltaMin," minutes ")+"(spread \xb1".concat(a.spreadMin,"), which is the +05:30 offset itself. The likeliest cause is a UTC clock serialised with an ")+"IST label, so every slot in the console reads five and a half hours early. Confirm against the API before trusting either reading.",evidence:["median assign \u2212 slot = ".concat(a.medianDeltaMin," min"),"IST offset = ".concat(i," min"),"spread \xb1".concat(a.spreadMin," min")],orderIds:u.map((function(e){return String(e.orderid)})),fix:"Serialise as true UTC with Z, or true IST with +05:30 \u2014 and normalise on ingest, before anything reads it."});var s=v(e);if(s.ratio<.9){var c=F.filter((function(e){return s.stages[e]<s.orderCount}));t.push({id:"lifecycle-gaps",severity:"high",title:"The rider app records ".concat(Math.round(100*s.ratio),"% of lifecycle events"),detail:"".concat(s.captured," of ").concat(s.expected," expected stamps are present. ")+"Weakest stages: ".concat(c.map((function(e){return f[e]})).join(", "),". Cycle-time analysis is not available from this feed at any sample size."),evidence:F.map((function(e){return"".concat(f[e].padEnd(9)," ").concat(s.stages[e],"/").concat(s.orderCount)})),orderIds:u.filter((function(e){return F.some((function(u){return!m(e[u])}))})).map((function(e){return String(e.orderid)})),fix:"Instrument the intermediate transitions, then reject writes that arrive out of order."})}var d=E(e);d.length&&t.push({id:"event-order",severity:"high",title:"Lifecycle stamps run backwards within an order",detail:"".concat(d.length," order(s) record a stage before the stage that must precede it. Even where stamps exist, they cannot be ")+"used to measure duration.",evidence:d.slice(0,4).map((function(e){return"".concat(e.orderid,": ").concat(e.earlier," ").concat(e.earlierValue," precedes ").concat(e.later," ").concat(e.laterValue)})),orderIds:d.map((function(e){return e.orderid})),fix:"Add a monotonic-ordering check at write time so an impossible sequence is rejected, not stored."}),r>u.length&&t.push({id:"export-artifact",severity:"medium",title:"The row set contains non-order rows",detail:"".concat(r-u.length," row(s) carry no orderid \u2014 the TOTAL row the CSV export appends. Any pipeline reading the file as ")+"records gains phantom orders, with the column sums as their values.",evidence:["".concat(r," rows in, ").concat(u.length," actual orders")],orderIds:[],fix:"Move totals to a footer sheet, or drop rows with no orderid on ingest."});var l=function(e){var u=o(e).map((function(e){return String(g(e,"locality")).trim()})).filter(Boolean),t={};return u.forEach((function(e){var u=e.toLowerCase();t[u]=t[u]||new Set,t[u].add(e)})),{nonLatin:(0,n.Z)(new Set(u.filter(y))),unbalanced:(0,n.Z)(new Set(u.filter(S))),caseVariants:Object.values(t).filter((function(e){return e.size>1})).map((function(e){return(0,n.Z)(e)})),distinct:Object.keys(t).length,total:u.length}}(e),D=[].concat((0,n.Z)(l.nonLatin),(0,n.Z)(l.unbalanced),(0,n.Z)(l.caseVariants.map((function(e){return e.join(" / ")}))));return D.length&&t.push({id:"locality-hygiene",severity:"medium",title:"Locality is free text and does not normalise",detail:"".concat(l.distinct," distinct spellings across ").concat(l.total," orders. Mixed scripts, unbalanced brackets and case variants all appear. ")+"Dispatch buckets zones on this family of fields, so the noise reaches the plan.",evidence:D.slice(0,5),orderIds:o(e).filter((function(e){return D.some((function(u){return u.includes(String(g(e,"locality")).trim())}))})).map((function(e){return String(e.orderid)})),fix:"Resolve localities against a gazetteer at order creation; keep the typed string as a display alias."}),t.sort((function(e,u){return k[e.severity]-k[u.severity]}))},x=function(e){var u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=B(e);return{meta:(0,r.Z)({generatedAt:(new Date).toISOString()},u),summary:{orders:t.orderCount,riders:t.riders,trustworthyDeliveryTimes:t.trustworthyDeliveryTimes,lifecycleCaptureRatio:Number(t.lifecycleRatio.toFixed(3)),medianAssignDelayMin:t.medianAssignDelayMin,totalKm:t.totalKm,totalCharge:t.totalCharge,timestampsTrustworthy:!t.skew.suspected&&t.trustworthyDeliveryTimes===t.deliveryStampCount},zones:w(e),findings:M(e).map((function(e){return{id:e.id,severity:e.severity,title:e.title,detail:e.detail,evidence:e.evidence,orderCount:e.orderIds.length}})),caveats:["Delivery timestamps flagged by a bulk-close finding must not be used for duration or SLA claims.","Where an offset-skew finding is present, promised slots are ambiguous; state the assumption used.","Rollups over a single day and a single tenant are descriptive, not evidence of a trend."]}}}}]);