PageSourceSearch

https://app.voxhealth.ai/assets/PharmacyMonitoringSettings-CBvTWUpH.js

js voxhealth.ai collected 2026-10-05 13:15:46 UTC 14,994 bytes, 4 lines download raw bytes

1import{C as ut,Ct as d,D as mt,G as g,Jt as u,T as c,U as l,_ as m,b as h,et as ct,ht as U,i as pt,j as gt,jt as yt,m as p,nt as xt,o as vt,p as ht,rt as C,st as ft,u as j,ut as bt,v as t,w as P,x as o}from"./vue.runtime.esm-bundler-DYdOdNtL.js";import{n as I,t as _t}from"./useOrgQuery-n0NxVahZ.js";import{t as kt}from"./useToast-m1WG9pkD.js";import{n as R,t as G}from"./ArrowUpIcon-KBG-0QjD.js";import{t as E}from"./PlusIcon-CWPdcCzG.js";import{t as J}from"./TrashIcon-DBO0y280.js";import{t as wt}from"./XMarkIcon-OAqSELC0.js";import{t as Ct}from"./PageTabs-PxXi5HH1.js";import{t as Pt}from"./useQueryTab-B7iuPcRb.js";import{a as B}from"./chartTheme-mhrc5nYG.js";import{c as $t,d as Q,l as Nt,n as Y,o as St,s as z,t as Ot,u as H}from"./prescriptions-Cux18gQ0.js";import{b as Mt}from"./providerIncentives-CzbIC5yC.js";gt();ft(),yt(),pt();var Tt={class:"space-y-6"},Dt={key:0,class:"text-sm text-gray-500 dark:text-gray-400"},Vt={key:1,class:"card-base p-4 text-sm text-gray-600 dark:text-gray-300 space-y-2"},At=["disabled"],Lt={key:0,class:"space-y-3 max-w-4xl"},Ft={class:"flex flex-wrap items-end gap-3"},Ut={class:"flex-1 min-w-[12rem]"},jt=["onUpdate:modelValue"],It={class:"w-32"},Rt=["value","onInput"],Gt={class:"flex gap-1"},Et=["disabled","onClick"],Jt=["disabled","onClick"],Bt=["onClick"],Qt={class:"flex flex-wrap items-start gap-x-6 gap-y-2"},Yt={class:"flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300"},zt=["onUpdate:modelValue"],Ht={class:"flex-1 min-w-[16rem]"},Kt={class:"cursor-pointer text-xs text-gray-700 dark:text-gray-300"},Zt={class:"mt-2 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-3 gap-y-1"},qt=["checked","onChange"],Wt=["title"],Xt={key:0,class:"text-xs text-gray-500 dark:text-gray-400"},te={key:0,class:"w-full text-xs"},ee={class:"py-1 pr-2 text-gray-900 dark:text-gray-100"},ae={class:"py-1 pr-2 text-gray-600 dark:text-gray-300"},se={class:"py-1 text-right"},re=["onClick"],ne={key:1,class:"text-sm text-gray-500 dark:text-gray-400"},le={class:"flex flex-wrap items-center gap-2"},oe=["onChange"],ie=["value","disabled"],de={key:1,class:"space-y-3 max-w-4xl"},ue={class:"flex flex-wrap items-end gap-3"},me={class:"flex-1 min-w-[12rem]"},ce=["onUpdate:modelValue"],pe={class:"flex gap-1"},ge=["disabled","onClick"],ye=["disabled","onClick"],xe=["onClick"],ve={class:"mt-1 flex flex-wrap gap-3"},he=["checked","onChange"],fe={key:0,class:"text-xs text-gray-500 dark:text-gray-400"},be={class:"grid grid-cols-1 md:grid-cols-2 gap-3"},_e={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},ke=["value","onChange"],we={class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},Ce=["value","onChange"],Pe={key:2,class:"space-y-3 max-w-4xl"},$e={key:0,class:"w-full text-xs"},Ne={class:"py-1 pr-2 text-gray-900 dark:text-gray-100"},Se={class:"py-1 pr-2 text-right tabular-nums text-gray-600 dark:text-gray-300"},Oe={class:"py-1 text-right"},Me={class:"text-[11px] text-gray-500 dark:text-gray-400"},Te={key:0,class:"text-[11px] font-medium text-gray-700 dark:text-gray-300"},De=["onClick"],Ve=["onClick"],Ae={key:1,class:"text-sm text-gray-500 dark:text-gray-400"},Le=mt({__name:"PharmacyMonitoringSettings",setup(Fe){const{showError:$,showSuccess:K}=kt(),Z=_t(),i=U(structuredClone(z)),y=I(Y.config,{onError:s=>$(s.message||"Failed to load pharmacy monitoring settings")}),q=m(()=>y.isLoading.value),W=m(()=>y.isError.value&&!y.data.value);ct(()=>y.data.value,s=>{s&&(i.value=Q(s))},{immediate:!0});const N=m(()=>Q(y.data.value??z)),S=m(()=>JSON.stringify(i.value.groups)!==JSON.stringify(N.value.groups)),O=m(()=>JSON.stringify(i.value.formularies)!==JSON.stringify(N.value.formularies)),X=m(()=>S.value||O.value),M=Mt(),tt=(()=>{const s=new Date(`${M}T00:00:00Z`);return s.setUTCDate(s.getUTCDate()-90),s.toISOString().slice(0,10)})(),_=I(()=>Y.setup(tt,M)),T=m(()=>(_.data.value?.top_pharmacies??[]).map(s=>({name:s.name??"",address:s.address??"",count:s.count}))),k=m(()=>_.data.value?.formulary.unmatched_drugs??[]),et=m(()=>(_.data.value?.clinics??[]).map(s=>s.name.trim()).filter(Boolean));function D(s){const e=[...et.value];for(const a of s.clinics)e.some(n=>n.toLowerCase()===a.toLowerCase())||e.push(a);return e.sort((a,n)=>a.localeCompare(n))}const V=(s,e)=>s.clinics.some(a=>a.toLowerCase()===e.toLowerCase());function at(s,e){s.clinics=V(s,e)?s.clinics.filter(a=>a.toLowerCase()!==e.toLowerCase()):[...s.clinics,e]}const A=s=>s.split(`
2`).map(e=>
2e.trim()).filter(Boolean);function st(s,e){const a=Number(e);s.target_percent=e.trim()===""||!Number.isFinite(a)?null:Math.min(100,Math.max(0,a))}function f(s,e,a){const n=e+a;n<0||n>=s.length||([s[e],s[n]]=[s[n],s[e]])}function rt(s){const[e]=i.value.groups.splice(s,1);for(const a of i.value.formularies)a.group_ids=a.group_ids.filter(n=>n!==e.id)}const L=(s,e,a)=>s.pharmacies.some(n=>H(n.name,n.address)===H(e,a));function nt(s,e){const a=e.target,n=T.value[Number(a.value)];a.value="",n&&!L(s,n.name,n.address)&&s.pharmacies.push({name:n.name,address:n.address})}function lt(s,e){s.group_ids=s.group_ids.includes(e)?s.group_ids.filter(a=>a!==e):[...s.group_ids,e]}const F=s=>i.value.formularies.filter(e=>s.formulary_ids.includes(e.id));function w(s,e){const a=e.toLowerCase();return s.drugs.some(n=>n.toLowerCase()===a)?"On list (unsaved)":s.not_formulary.some(n=>n.toLowerCase()===a)?"Off list (unsaved)":null}const ot=m(()=>k.value.filter(s=>F(s).some(e=>!w(e,s.drug_name))).length),x=Pt("tab",["groups","formularies","unmatched"],"groups"),it=m(()=>[{key:"groups",label:"Groups",count:i.value.groups.length,dirty:S.value},{key:"formularies",label:"Formularies",count:i.value.formularies.length,dirty:O.value},{key:"unmatched",label:"Unmatched drugs",count:ot.value}]),b=U(!1);async function dt(){b.value=!0;try{i.value=await St(i.value),await Z(Ot),K("Pharmacy monitoring saved")}catch(s){$(s.message||"Failed to save pharmacy monitoring")}finally{b.value=!1}}return(s,e)=>(l(),o("div",Tt,[e[20]||(e[20]=t("div",null,[t("h1",{class:"text-xl font-bold text-gray-900 dark:text-white"},"Pharmacy monitoring"),t("p",{class:"mt-1 text-sm text-gray-500 dark:text-gray-400"}," The pharmacy groups the Pharmacy page reports on, and the formulary lists prescribing is measured against. ")],-1)),q.value?(l(),o("div",Dt,"Loading…")):W.value?(l(),o("div",Vt,[e[4]||(e[4]=t("p",null,"The saved settings could not be loaded, so they can't be edited right now. Saving from here would replace them.",-1)),t("button",{type:"button",class:"btn btn-secondary btn-small",onClick:e[0]||(e[0]=a=>d(y).refetch())},"Try again")])):(l(),o("form",{key:2,class:"space-y-6",onSubmit:ht(dt,["prevent"])},[c(Ct,{modelValue:d(x),"onUpdate:modelValue":e[1]||(e[1]=a=>bt(x)?x.value=a:null),tabs:it.value,"aria-label":"Pharmacy monitoring settings"},{actions:xt(()=>[t("button",{type:"submit",class:"btn btn-primary btn-small",disabled:b.value||!X.value},u(b.value?"Saving…":"Save"),9,At)]),_:1},8,["modelValue","tabs"]),d(x)==="groups"?(l(),o("section",Lt,[e[13]||(e[13]=t("div",null,[t("h2",{class:"text-sm font-semibold text-gray-900 dark:text-white"},"Pharmacy groups"),t("p",{class:"text-sm text-gray-500 dark:text-gray-400"}," A group is a set of pharmacies you want prescriptions to reach, optionally only for some clinics (none ticked = every clinic). A pharmacy can be in more than one group; in the page's parts-of-a-whole chart a prescription counts in the first group on the chart that claims it. ")],-1)),(l(!0),o(p,null,g(i.value.groups,(a,n)=>(l(),o("div",{key:a.id,class:"card-base p-4 space-y-3"}
2,[t("div",Ft,[t("label",Ut,[e[5]||(e[5]=t("span",{class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},"Name",-1)),C(t("input",{"onUpdate:modelValue":r=>a.name=r,class:"form-input text-xs w-full"},null,8,jt),[[j,a.name]])]),t("label",It,[e[6]||(e[6]=t("span",{class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},"Target % (optional)",-1)),t("input",{value:a.target_percent??"",type:"number",min:"0",max:"100",step:"1",class:"form-input text-xs w-full text-right tabular-nums",onInput:r=>st(a,r.target.value)},null,40,Rt)]),t("div",Gt,[t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Move up",disabled:n===0,onClick:r=>f(i.value.groups,n,-1)},[c(d(G),{class:"h-4 w-4"})],8,Et),t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Move down",disabled:n===i.value.groups.length-1,onClick:r=>f(i.value.groups,n,1)},[c(d(R),{class:"h-4 w-4"})],8,Jt),t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Remove group",onClick:r=>rt(n)},[c(d(J),{class:"h-4 w-4"})],8,Bt)])]),t("div",Qt,[t("label",Yt,[C(t("input",{"onUpdate:modelValue":r=>a.show_on_chart=r,type:"checkbox",class:"form-checkbox"},null,8,zt),[[vt,a.show_on_chart]]),e[7]||(e[7]=P(" Show on the pharmacy-group chart ",-1))]),t("details",Ht,[t("summary",Kt,[e[8]||(e[8]=t("span",{class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},"Clinics:",-1)),P(" "+u(a.clinics.length?a.clinics.join(", "):"all")+" ",1),e[9]||(e[9]=t("span",{class:"text-blue-600 dark:text-blue-400"},"(change)",-1))]),t("div",Zt,[(l(!0),o(p,null,g(D(a),r=>(l(),o("label",{key:r,class:"flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 min-w-0"},[t("input",{type:"checkbox",class:"form-checkbox",checked:V(a,r),onChange:v=>at(a,r)},null,40,qt),t("span",{class:"truncate",title:r},u(r),9,Wt)]))),128)),D(a).length?h("",!0):(l(),o("span",Xt,"No clinics seen yet."))])])]),a.pharmacies.length?(l(),o("table",te,[e[10]||(e[10]=t("thead",null,[t("tr",{class:"text-[11px] uppercase tracking-wider text-gray-500 dark:text-gray-400 text-left"},[t("th",{class:"py-1 pr-2 font-semibold"},"Pharmacy"),t("th",{class:"py-1 pr-2 font-semibold"},"Street"),t("th",{class:"py-1"})])],-1)),t("tbody",null,[(l(!0),o(p,null,g(a.pharmacies,(r,v)=>(l(),o("tr",{key:`${r.name}|${r.address}`},[t("td",ee,u(r.name),1),t("td",ae,u(r.address||"—"),1),t("td",se,[t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Remove pharmacy",onClick:Ue=>a.pharmacies.splice(v,1)},[c(d(wt),{class:"h-4 w-4"})],8,re)])]))),128))])])):(l(),o("p",ne,"No pharmacies in this group yet.")),t("div",le,[t("select",{class:"form-select text-xs w-96 max-w-full","aria-label":"Add a pharmacy prescriptions were sent to",onChange:r=>nt(a,r)},[e[11]||(e[11]=t("option",{value:""},"Add a pharmacy prescriptions were sent to…",-1)),(l(!0),o(p,null,g(T.value,(r,v)=>(l(),o("option",{key:v,value:v,disabled:L(a,r.name,r.address)},u(r.name)+u(r.address?`, ${r.address}`:"")+" ("+u(d(B)(r.count))+") ",9,ie))),128))],40,oe)])]))),128)),t("button",{type:"button",class:"btn btn-secondary btn-small",onClick:e[2]||(e[2]=a=>i.value.groups.push(d(Nt)()))},[c(d(E),{class:"h-4 w-4"}),e[12]||(e[12]=t("span",null,"Add group",-1))])])):h("",!0),d(x)==="formularies"?(l(),o("section",de,[e[17]||(e[17]=ut('<div><h2 class="text-sm font-semibold text-gray-900 dark:text-white">Formularies</h2><p class="text-sm text-gray-500 dark:text-gray-400"> A prescription is judged by the first formulary covering a group its pharmacy is in. One drug per line: an entry matches any prescription whose name has all of its words, starting with the same one, so <span class="font-medium">Pimecrolimus 1% Cream</span> matches <span class="font-medium">pimecrolimus 1 % topical cream</span> and <span class="font-medium">Isotretinoin</span> matches every strength. </p></div>',1)),(l(!0),o(p,null,g(i.value.formularies,(a,n)=>(l(),o("div",{key:a.id,class:"card-base p-4 space-y-3"},[t("div",ue,[t("label",me,[e[14]||(e[14]=t("span",{class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},"Name",-1)),C(t("input",{"onUpdate:modelValue":r=>a.name=r,class:"form-input text-xs w-full"},null,8,ce),[[j,a.name]])]),t("div",pe,[t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Move up",disabled:n===0,onClick:r=>f(i.value.formularies,n,-1)},[c(d(G),{class:"h-4 w-4"})],8,ge),t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Move down",disabled:n===i.value.formularies.length-1,onClick:r=>f(i.value.formularies,n,1)},[c(d(R),{class:"h-4 w-4"})],8,ye),t("button",{type:"button",class:"btn btn-ghost btn-xs",title:"Remove formulary",onClick:r=>i.value.formularies.splice(n,1)},[c(d(J),{class:"h-4 w-4"})],8,xe)])]),t("fieldset",null,[e[15]||(e[15]=t("legend",{class:"text-[11px] font-medium text-gray-500 dark:text-gray-400"},"Judges prescriptions sent to",-1)),t("div",ve,[(l(!0),o(p,null,g(i.value.groups,r=>(l(),o("label",{key:r.id,class:"flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300"},[t("input",{type:"checkbox",class:"form-checkbox",checked:a.group_ids.includes(r.id),onChange:v=>lt(a,r.id)},null,40,he),P(" "+u(r.name),1)]))),128)),i.value.groups.length?h("",!0):(l(),o("span",fe,"Add a pharmacy group first."))])]),t("div",be,[t("label",null,[t("span",_e,"On the list ("+u(a.drugs.length)+")",1),t("textarea",{value:a.drugs.join(`
3`),rows:"10",class:"form-textarea text-xs w-full",onChange:r=>a.drugs=A(r.target.value)},null,40,ke)]),t("label",null,[t("span",we,"Ruled off the list, exact names ("+u(a.not_formulary.length)+")",1),t("textarea",{value:a.not_formulary.join(`
4`),rows:"10",class:"form-textarea text-xs w-full",onChange:r=>a.not_formulary=A(r.target.value)},null,40,Ce)])])]))),128)),t("button",{type:"button",class:"btn btn-secondary btn-small",onClick:e[3]||(e[3]=a=>i.value.formularies.push(d($t)()))},[c(d(E),{class:"h-4 w-4"}),e[16]||(e[16]=t("span",null,"Add formulary",-1))])])):h("",!0),d(x)==="unmatched"?(l(),o("section",Pe,[e[19]||(e[19]=t("div",null,[t("h2",{class:"text-sm font-semibold text-gray-900 dark:text-white"},"Drugs no list matched"),t("p",{class:"text-sm text-gray-500 dark:text-gray-400"}," Prescribed in the last 90 days and judged by a formulary, but named on neither of its lists, so they count as off formulary. Put each on its list or rule it off. Reflects saved settings. ")],-1)),k.value.length?(l(),o("table",$e,[e[18]||(e[18]=t("thead",null,[t("tr",{class:"text-[11px] uppercase tracking-wider text-gray-500 dark:text-gray-400 text-left"},[t("th",{class:"py-1 pr-2 font-semibold"},"Drug"),t("th",{class:"py-1 pr-2 font-semibold text-right"},"Prescriptions"),t("th",{class:"py-1 font-semibold text-right"},"Decide")])],-1)),t("tbody",null,[(l(!0),o(p,null,g(k.value,a=>(l(),o("tr",{key:a.drug_name,class:"border-t border-gray-100 dark:border-gray-700"},[t("td",Ne,u(a.drug_name),1),t("td",Se,u(d(B)(a.count)),1),t("td",Oe,[(l(!0),o(p,null,g(F(a),n=>(l(),o("div",{key:n.id,class:"flex justify-end items-center gap-1"},[t("span",Me,u(n.name)+":",1),w(n,a.drug_name)?(l(),o("span",Te,u(w(n,a.drug_name)),1)):(l(),o(p,{key:1},[t("button",{type:"button",class:"btn btn-ghost btn-xs",onClick:r=>n.drugs.push(a.drug_name)},"On list",8,De),t("button",{type:"button",class:"btn btn-ghost btn-xs",onClick:r=>n.not_formulary.push(a.drug_name)},"Off list",8,Ve)],64))]))),128))])]))),128))])])):(l(),o("p",Ae,"Every judged drug in the last 90 days matched a list."))])):h("",!0)],32))]))}}),Ze=Le;export{Ze as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.