PageSourceSearch

https://snf-insights.ai/assets/FTagLibraryPage-oRpLWMkP.js

js snf-insights.ai collected 2026-10-05 15:07:18 UTC 17,341 bytes, 3 lines download raw bytes

1import{a8 as T,j as e,L as S,a9 as z,b as C,c6 as F,W as M,I as w,ag as $,ae as B,w as _,f as D,r as N,F as P,c7 as R,c8 as A}from"./index-Df108JlE.js";import{Q as L}from"./QueryError-Csi7m0zt.js";import{C as U}from"./chevron-left-BG1_bPN5.js";function O(){const[r,i]=z(),n=r.get("ftag"),l=c=>{const o=new URLSearchParams(r);o.set("ftag",c),i(o,{replace:!1}),window.scrollTo({top:0,behavior:"smooth"})},p=()=>{const c=new URLSearchParams(r);c.delete("ftag"),i(c,{replace:!1}),window.scrollTo({top:0,behavior:"smooth"})};return n?e.jsx(E,{tag:n.toUpperCase(),onBack:p,onSelectTag:l}):e.jsx(q,{onSelectTag:l})}function K(){const r=T(),n=window.location.pathname.match(/\/ftags\/(F?\d+)/i),l=n?n[1]:null,p=l?`/deficiencies?tab=library&ftag=${l.toUpperCase().replace(/^F?/,"F")}`:"/deficiencies?tab=library";return setTimeout(()=>r(p,{replace:!0}),0),e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(S,{className:"animate-spin text-sky-500",size:24})})}function q({onSelectTag:r}){const[i,n]=N.useState(""),[l,p]=N.useState("citations"),[c,o]=N.useState(null),{data:f,isLoading:a,isError:u,error:m,refetch:j}=C({queryKey:["ftags"],queryFn:()=>R(),staleTime:300*1e3}),h=f?.tags||[],y=N.useMemo(()=>{let s=h;if(i.trim()){const x=i.trim().toLowerCase();s=s.filter(g=>g.tag.toLowerCase().includes(x)||(g.title||"").toLowerCase().includes(x))}c&&(s=s.filter(x=>x.category===c));const d=[...s];return l==="tag"?d.sort((x,g)=>x.tag.localeCompare(g.tag)):l==="citations"?d.sort((x,g)=>g.citations_12mo-x.citations_12mo):l==="facilities"&&d.sort((x,g)=>g.facilities_12mo-x.facilities_12mo),d},[h,i,l,c]),t=N.useMemo(()=>{const s=new Map;for(const d of h)s.set(d.category,(s.get(d.category)||0)+1);return[...s.entries()].sort((d,x)=>x[1]-d[1])},[h]);return a?e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(S,{className:"animate-spin text-sky-500",size:32})}):u?e.jsx(L,{error:m,onRetry:j}):e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold text-slate-800 flex items-center gap-2",children:[e.jsx(F,{size:22,className:"text-sky-500"}),"F-Tag Library",e.jsx(w,{text:"Regulatory guidance for every F-tag used in CMS nursing home surveys, sourced directly from CMS State Operations Manual Appendix PP. Includes recent citation activity from CMS Health Inspection data. Use this as a learning tool to understand what each tag means, how surveyors evaluate it, and what recent citation patterns look like.",size:14,portal:!0})]}),e.jsxs("p",{className:"text-sm text-slate-500 mt-1",children:[h.length," F-tags with CMS regulatory guidance and 12-month citation activity"]})]}),e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(P,{size:15,className:"absolute left-3 top-1/2 -translate-y-1/2 text-slate-400"}),e.jsx("input",{value:i,onChange:s=>n(s.target.value),placeholder:"Search by tag number (e.g. F689) or description...",className:"w-full pl-9 pr-3 py-2 border border-slate-300 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-sky-500"})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx("span",{className:"text-slate-500",children:"Sort:"}),[{key:"citations",label:"Most Cited"},{key:"facilities",label:"Most Facilities"},{key:"tag",label:"Tag Number"}].map(s=>e.jsx("button",{onClick:()=>p(s.key),className:`px-2.5 py-1 rounded transition-colors ${l===s.key?"bg-sky-500 text-white":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:s.label},s.key))]})]}),e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsxs("button",{onClick:()=>o(null),className:`text-[11px] px-2 py-1 rounded-full transition-colors ${c?"bg-slate-100 text-slate-600 hover:bg-slate-200":"bg-sky-500 text-white"}`,children:["All (",h.length,")"]}),t.map(([s,d])=>e.jsxs("button",{onClick:()=>o(s===c?null:s),className:`text-[11px] px-2 py-1 rounded-full transition-colors ${c===s?"bg-sky-500 text-white":"bg-slate-100 text-slate-600 hover:bg-slate-200"}`,children:[s," (",d,")"]},s))]})]}),e.jsx("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-slate-50 border-b border-slate-200",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"text-left px-4 py-2.5 text-[11px] font-semibold text-slate-500 uppercase tracking-wide",children:"Tag"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2.5 text-[11px] font-semibold text-slate-500 uppercase tracking-wide",children:"Description"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2.5 text-[11px] font-semibold text-slate-500 uppercase tracking-wide",children:"Category"}),e.jsx("th",{scope:"col",className:"text-right px-4 py-2.5 text-[11px] font-semibold text-slate-500 uppercase tracking-wide",children:"Citations (12mo)"}),e.jsx("th",{scope:"col",className:"text-right px-4 py-2.5 text-[11px] font-semibold text-slate-500 uppercase tracking-wide",children:"Facilities (12mo)"})]})}),e.jsxs("tbody",{children:[y.map(s=>e.jsxs("tr",{onClick:()=>r(s.tag),className:"border-b border-slate-50 last:border-0 cursor-pointer hover:bg-sky-50 transition-colors",children:[e.jsx("td",{className:"px-4 py-3 font-mono font-semibold text-slate-800",children:s.tag}),e.jsx("td",{className:"px-4 py-3 text-slate-600",children:e.jsx("span",{className:"line-clamp-2 max-w-2xl",children:s.title||e.jsx("span",{className:"italic text-slate-400",children:"(no description)"})})}),e.jsx("td",{className:"px-4 py-3 text-xs text-slate-500",children:s.category}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums font-medium text-slate-700",children:s.citations_12mo?.toLocaleStr
1ing()||"—"}),e.jsx("td",{className:"px-4 py-3 text-right tabular-nums text-slate-500",children:s.facilities_12mo?.toLocaleString()||"—"})]},s.tag)),y.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"py-12 text-center text-sm text-slate-400",children:"No tags match your search"})})]})]})})]})}function E({tag:r,onBack:i,onSelectTag:n}){const{data:l,isLoading:p,isError:c,error:o,refetch:f}=C({queryKey:["ftag-detail",r],queryFn:()=>A(r),enabled:!!r,staleTime:3e5});if(p)return e.jsx("div",{className:"flex justify-center py-16",children:e.jsx(S,{className:"animate-spin text-sky-500",size:32})});if(c)return e.jsx(L,{error:o,onRetry:f});if(!l)return null;const{guidance:a,stats:u,severity_distribution:m,top_states:j,top_chains:h,recent_citations:y}=l;return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("button",{onClick:()=>i&&i(),className:"flex items-center gap-1 text-sm text-slate-500 hover:text-slate-800 mb-2",children:[e.jsx(U,{size:16})," Back to all tags"]}),e.jsx("div",{className:"flex items-start justify-between gap-4",children:e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-3",children:[e.jsx("h1",{className:"text-3xl font-bold text-slate-800 font-mono",children:a.tag}),e.jsx("span",{className:"text-sm text-slate-400 font-mono",children:a.regulation_cite})]}),a.title&&e.jsx("p",{className:"text-base text-slate-600 mt-1 max-w-4xl",children:a.title}),a.revision_info&&e.jsx("p",{className:"text-[10px] text-slate-400 mt-1 italic",children:a.revision_info})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[e.jsx(v,{label:"Total Citations",value:u.total_citations?.toLocaleString()||"0",tip:"All-time citations for this tag across all SNFs"}),e.jsx(v,{label:"Unique Facilities",value:u.unique_facilities?.toLocaleString()||"0",tip:"Distinct facilities cited for this tag at least once"}),e.jsx(v,{label:"12-Month Citations",value:u.citations_12mo?.toLocaleString()||"0",tip:"Citations in the last 12 months",accent:"text-sky-600"}),e.jsx(v,{label:"12-Month Facilities",value:u.facilities_12mo?.toLocaleString()||"0",tip:"Distinct facilities cited in the last 12 months"}),e.jsx(v,{label:"3-Month Citations",value:u.citations_3mo?.toLocaleString()||"0",tip:"Citations in the last 3 months — leading indicator",accent:"text-amber-600"})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden",children:[e.jsxs("div",{className:"bg-slate-50 border-b border-slate-200 px-5 py-3 flex items-center gap-2",children:[e.jsx(F,{size:16,className:"text-sky-500"}),e.jsx("h2",{className:"text-sm font-semibold text-slate-800",children:"CMS Regulatory Guidance"}),e.jsxs("span",{className:"text-[10px] text-slate-400 ml-auto",children:["Source: ",a.source]})]}),e.jsxs("div",{className:"p-5 space-y-5 text-sm text-slate-700",children:[a.regulation_text&&e.jsx(b,{title:"Regulation",text:a.regulation_text}),a.intent&&e.jsx(b,{title:"Intent",text:a.intent}),a.definitions&&e.jsx(b,{title:"Definitions",text:a.definitions,collapsed:!0}),a.guidance&&e.jsx(b,{title:"Guidance",text:a.guidance,collapsed:!0}),a.procedures&&e.jsx(b,{title:"Surveyor Procedures",text:a.procedures,collapsed:!0}),a.examples_noncompliance&&e.jsx(b,{title:"Examples of Noncompliance",text:a.examples_noncompliance})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(M,{size:14,className:"text-amber-500"}),"Severity (12 months)",e.jsx(w,{text:"Scope/Severity code grid. Scope: isolated (1), pattern (2), widespread (3). Severity: potential for minimal harm (A-C), actual harm (D-F), immediate jeopardy (G-L). Higher letters = more severe.",size:11,portal:!0})]}),m.length>0?e.jsx("div",{className:"space-y-1",children:m.map(t=>e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:`font-mono font-semibold ${k(t.code)}`,children:t.code}),e.jsx("span",{className:"text-slate-500",children:t.count.toLocaleStr
1ing()})]},t.code))}):e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No citations in last 12 months"})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx($,{size:14,className:"text-sky-500"}),"Top States (% cited)",e.jsx(w,{text:"States ranked by the percentage of their SNFs cited for this tag in the last 12 months. Normalized so small states with high citation rates surface above large states with many facilities. States with fewer than 10 SNFs are excluded.",size:11,portal:!0})]}),j.length>0?e.jsx("div",{className:"space-y-0.5",children:j.map(t=>e.jsxs("div",{className:"grid grid-cols-[1fr_auto_auto] items-baseline gap-3 text-xs py-0.5",children:[e.jsx("span",{className:"font-medium text-slate-700",children:t.state}),e.jsx("span",{className:"text-slate-700 tabular-nums text-right min-w-[3.5rem]",children:t.pct_cited!=null?`${t.pct_cited.toFixed(1)}%`:"—"}),e.jsxs("span",{className:"text-[10px] text-slate-400 tabular-nums text-right min-w-[4.5rem]",children:[t.facility_count,"/",t.total_facilities]})]},t.state))}):e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No data"})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(B,{size:14,className:"text-slate-400"}),"Top Chains (% cited)",e.jsx(w,{text:"Chains ranked by the percentage of their facilities cited for this tag in the last 12 months. Normalized so small chains with systemic issues surface above large chains with individual incidents. Chains with fewer than 5 facilities are excluded.",size:11,portal:!0})]}),h.length>0?e.jsx("div",{className:"space-y-0.5",children:h.map(t=>e.jsxs(_,{to:`/chain/${t.chain_id}`,className:"grid grid-cols-[1fr_auto_auto] items-baseline gap-3 text-xs py-0.5 hover:bg-slate-50 rounded px-1 -mx-1",children:[e.jsx("span",{className:"font-medium text-slate-700 truncate",title:t.chain_name,children:t.chain_name}),e.jsx("span",{className:"text-slate-700 tabular-nums text-right min-w-[3.5rem]",children:t.pct_cited!=null?`${t.pct_cited.toFixed(1)}%`:"—"}),e.jsxs("span",{className:"text-[10px] text-slate-400 tabular-nums text-right min-w-[4.5rem]",children:[t.facility_count,"/",t.total_facilities]})]},t.chain_id))}):e.jsx("p",{className:"text-xs text-slate-400 italic",children:"No chain citations in 12 months"})]})]}),a.related_tags&&a.related_tags.length>0&&e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-5",children:[e.jsxs("h3",{className:"text-sm font-semibold text-slate-800 mb-3 flex items-center gap-2",children:[e.jsx(D,{size:14,className:"text-sky-500"}),"Related Tags",e.jsx("span",{className:"text-[10px] text-slate-400 font-normal",children:"(referenced in the guidance text)"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.related_tags.map(t=>e.jsx("button",{onClick:()=>n&&n(t),className:"text-[11px] font-mono px-2 py-1 bg-slate-100 text-slate-700 rounded hover:bg-sky-100 hover:text-sky-700 transition-colors",children:t},t))})]}),e.jsxs("section",{className:"bg-white rounded-xl border border-slate-200 shadow-sm overflow-hidden",children:[e.jsx("div",{className:"bg-slate-50 border-b border-slate-200 px-5 py-3",children:e.jsx("h2",{className:"text-sm font-semibold text-slate-800",children:"Recent Citations (most recent 20)"})}),y.length>0?e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"text-[11px] text-slate-500 uppercase tracking-wide",children:e.jsxs("tr",{className:"border-b border-slate-100",children:[e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"Facility"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"Location"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"Survey Date"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"S/S"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"Source"}),e.jsx("th",{scope:"col",className:"text-left px-4 py-2",children:"Corrected?"})]})}),e.jsx("tbody",{children:y.map((t,s)=>e.jsxs("tr",{className:"border-b border-slate-50 hover:bg-slate-50",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx(_,{to:`/facility/${t.ccn}
1?tab=Deficiencies`,className:"text-sky-600 hover:underline font-medium",children:t.provider_name}),e.jsx("p",{className:"text-[10px] text-slate-400 font-mono",children:t.ccn})]}),e.jsxs("td",{className:"px-4 py-2 text-xs text-slate-600",children:[t.citytown,", ",t.state]}),e.jsx("td",{className:"px-4 py-2 text-xs text-slate-600",children:t.survey_date}),e.jsx("td",{className:"px-4 py-2",children:e.jsx("span",{className:`text-xs font-mono font-semibold ${k(t.scope_severity_code)}`,children:t.scope_severity_code||"—"})}),e.jsx("td",{className:"px-4 py-2 text-xs text-slate-500",children:t.complaint_deficiency==="Y"?"Complaint":"Standard"}),e.jsx("td",{className:"px-4 py-2 text-xs",children:t.deficiency_corrected==="Y"?e.jsx("span",{className:"text-emerald-600",children:"Yes"}):e.jsx("span",{className:"text-slate-400",children:"—"})})]},s))})]}):e.jsx("p",{className:"text-xs text-slate-400 italic p-5",children:"No citations found"})]})]})}function b({title:r,text:i,collapsed:n=!1}){const[l,p]=N.useState(!n),c=(i||"").split(/\n\n+/).map(o=>o.trim()).filter(Boolean);return e.jsxs("div",{className:"border-t border-slate-100 pt-4 first:border-t-0 first:pt-0",children:[e.jsxs("button",{onClick:()=>p(!l),className:"flex items-center justify-between w-full text-left",children:[e.jsx("h3",{className:"text-xs font-semibold text-slate-500 uppercase tracking-wide",children:r}),e.jsx("span",{className:"text-[10px] text-slate-400",children:l?"Hide":"Show"})]}),l&&e.jsx("div",{className:"mt-3 space-y-3 text-sm text-slate-700 leading-relaxed max-w-4xl",children:c.map((o,f)=>{const a=o.split(`
2`).map(m=>m.trim()).filter(Boolean);return a.length>1&&a.every(m=>/^(•|-|·|\u2022|[0-9]+\.|[a-z]\.|\([a-z0-9]+\))/i.test(m))?e.jsx("ul",{className:"list-disc list-outside ml-5 space-y-1",children:a.map((m,j)=>e.jsx("li",{children:m.replace(/^(•|-|·|\u2022|[0-9]+\.|[a-z]\.|\([a-z0-9]+\))\s*/i,"")},j))},f):/^[A-Z][A-Z\s&/§]{4,}$/.test(o.trim())?e.jsx("p",{className:"text-xs font-semibold text-slate-600 uppercase tracking-wide mt-4",children:o},f):e.jsx("p",{children:o.split(`
3`).join(" ")},f)})})]})}function v({label:r,value:i,tip:n,accent:l}){return e.jsxs("div",{className:"bg-white rounded-xl border border-slate-200 shadow-sm p-4",children:[e.jsxs("p",{className:"text-[10px] text-slate-400 uppercase tracking-wide flex items-center gap-1",children:[r,n&&e.jsx(w,{text:n,size:10,portal:!0})]}),e.jsx("p",{className:`text-xl font-bold mt-1 ${l||"text-slate-800"}`,children:i})]})}function k(r){if(!r)return"text-slate-400";const i=r.charAt(0).toUpperCase();return"JKL".includes(i)?"text-red-600":"GHI".includes(i)?"text-red-500":"DEF".includes(i)?"text-amber-500":"ABC".includes(i)?"text-slate-600":"text-slate-500"}export{E as FTagDetailView,O as FTagLibraryTab,K 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.