Purpose
Retrieve the complete set of California Title 22 pharmaceutical-service sections hosted by Cornell Law, preserving each section's citation, heading, and regulatory text so it can be converted into a readiness checklist.
When to Use
Use for requests involving California Title 22 pharmaceutical services, pharmacy operations, medication handling, or related facility-readiness requirements. The default scope is the pharmaceutical-services article under Division 5, Chapter 3; use the article's linked sections rather than assuming a fixed section range.
Workflow
- Navigate directly to
https://www.law.cornell.edu/regulations/california/title-22/division-5/chapter-3/article-3. - On the loaded article page, run this single evaluator. It discovers the linked
22-CCR-{section}pages, fetches each page from the same Cornell Law origin, and extracts the text after itsh1until Cornell's metadata sections begin:
(async () => {
const base = location.origin;
const links = [...document.querySelectorAll("a[href]")]
.map((a) => ({
url: new URL(a.href, location.href).href,
text: (a.innerText || "").trim(),
}))
.filter((x) => x.url.startsWith(base + "/regulations/california/22-CCR-"));
const unique = [...new Map(links.map((x) => [x.url, x])).values()].sort((a, b) =>
a.url.localeCompare(b.url, undefined, { numeric: true }),
);
const stop =
/^(Notes|Source|Statutory Authority|History|Read this|Credits|Compare)/i;
const rows = [];
for (const link of unique) {
const response = await fetch(link.url, { credentials: "same-origin" });
if (!response.ok) {
rows.push({ url: link.url, status: response.status, error: "fetch failed" });
continue;
}
const html = await response.text();
const doc = new DOMParser().parseFromString(html, "text/html");
const heading = doc.querySelector("h1");
let text = "";
for (
let node = heading?.nextElementSibling;
node;
node = node.nextElementSibling
) {
const value = (node.innerText || node.textContent || "").trim();
if (stop.test(value)) break;
if (value) text += (text ? "\\n" : "") + value;
}
rows.push({
citation: (link.url.match(/22-CCR-([^/?#]+)/i) || [])[1] || null,
url: link.url,
heading: (heading?.innerText || "").trim(),
text,
});
}
return JSON.stringify({ source: location.href, sections: rows }, null, 2);
})();- Turn the returned
sectionsarray into a readiness checklist by grouping requirements by topic and retaining the citation and source URL for every checklist item. Do not infer compliance conclusions beyond the retrieved regulatory text.
Site-Specific Gotchas
- Cornell uses the compact California section URL pattern
/regulations/california/22-CCR-{section-number}, while the article index uses the hierarchical/regulations/california/title-22/division-5/chapter-3/article-3path. - The article page is the reliable discovery point for the current section set; do not hardcode only the sections seen in one run. The evaluator includes all linked California Title 22 CCR pages and sorts them numerically.
- Cornell places section content in sibling elements following
h1; stop beforeNotes,Source,Statutory Authority, orHistoryso citation metadata is not mistaken for operative requirements. - Keep California Title 22 pages separate from similarly structured Texas TAC pages; jurisdiction and URL path are authoritative.
- Treat the output as regulatory research and preserve section citations when authoring the operational checklist; verify current law before implementation.
Expected Output
A JSON object containing source and an ordered sections array. Each section has citation, url, heading, and extracted text. Use those records to produce a cited California pharmaceutical-services readiness checklist.