Thai Legal Reference Tool

CDA 2558 App

An interactive, searchable reader for Thailand's Communicable Disease Act B.E. 2558 (2015) — fixing the Thai-numeral readability and broken PDF text-search that make the official scanned version hard to actually use. It now has a dated record of every related announcement, a Q&A assistant that answers from the law and cites it, and, since October 2026, a full English version.

Live App Legal Reference Public Health AI Assistant Thai / English Unofficial / Educational
What This Is

CDA 2558 refers to the Thai Communicable Disease Act, B.E. 2558 (พระราชบัญญัติโรคติดต่อ พ.ศ. ๒๕๕๘) — Thailand's core public-health law governing disease surveillance, outbreak control, and enforcement powers, originally enacted in 2015. This app is an unofficial, educational interactive reader for the Act — clearly labeled as such, not a government product.

Problem

The Act's only public source is a scanned, formatted PDF from the government site. The official text uses Thai numerals (๐–๙) for section numbers, which are slow to scan, and the PDF's stacked Thai vowel and tone marks routinely break copy-paste and text search — pasted or searched text often comes out garbled or simply doesn't match, making it hard to quickly cross-reference a specific article.

Approach

Rather than trying to parse the PDF programmatically, the Act was manually transcribed once into clean, structured data — chapters, articles, and content kept separate from stable internal IDs. From that clean base, digits can be displayed as Thai or Arabic numerals interchangeably (toggleable, saved as a preference), while lookups and cross-references are normalized under the hood so an article reference resolves correctly regardless of which numeral system it's typed or displayed in — directly fixing the "search doesn't match" problem at its root, instead of fighting the original PDF.

Legal terms and article references throughout the text are auto-linked with hover previews, so reading one section and following a cross-reference to another no longer means losing your place and re-scanning the whole document.

Around the Act sit the documents that give it force: the ministerial announcements naming dangerous and surveillance diseases, infected zones, ports of entry, reporting and investigation rules. Each is kept as a record with its Gazette reference, signing, publication and effective dates, and whether it has been amended or repealed, and the side panel shows those alongside a link to the official copy. Effective dates are filled in only where the commencement clause states them; the rest are marked unverified rather than guessed. Drafts approved but not yet in the Gazette get a separate “pending” notice so they are never read as law.

Search covers the sections, legal terms and related laws at once. There are indexes of the Section 4 definitions and of the dangerous and surveillance diseases, with a study aid that groups the dangerous diseases by type, plus dark mode, deep links to any section or term, and a bottom-sheet panel on phones.

English Version

Added in October 2026 at /en/, from the Department of Disease Control’s English compilation of the Act (3rd printing, August 2025): all 60 sections and 53 subordinate documents, extracted by script into the same structured data the Thai reader uses and proofread against the book’s pages, its wording kept verbatim. Each document is labelled as DDC’s unofficial translation, with the Thai text prevailing; documents that have no translation are shown in Thai with a notice rather than machine-translated. A TH/EN button switches language at the same section or term.

Every section, legal term and notification also has its own search page in both languages (230 pages), with a title, description, canonical URL, Thai/English alternates and schema.org Legislation data, so a search for a specific section lands on it and opens the full reader there.

Law Q&A Assistant

A chat assistant answers questions about the Act in the language of the page, Thai or English, and every answer must cite the sections or announcements it drew on; a citation opens that source in the side panel. English answers draw only on the English text and Thai answers only on the Thai, so a translated document is never paraphrased across languages; an English answer that relies on a Thai-only document carries a fixed notice saying so. It runs on a Cloudflare Worker adapted from this site’s own portfolio guide: hybrid keyword and embedding retrieval (bge-m3) over a knowledge index built from the app’s data, with Thai word segmentation added because keyword search otherwise indexed each Thai sentence as a single token.

Legal questions need guards a portfolio chatbot doesn’t. Every chunk carries its document’s dates and legal basis, “what is in force now” questions pin a current-state record, and any date in an answer that isn’t in the cited sources triggers one regeneration and then a safe failure. Retrieval takes at most three chunks from any one announcement, so a long one can’t crowd out the rest. The index also covers the Pathogens and Animal Toxins Act B.E. 2558 and its 24 announcements, as assistant knowledge only.

It is checked against a hand-written set of test questions (dates, status, section content, cross-references, multi-turn follow-ups, and questions in English and Chinese) plus a prompt-injection red-team suite.

Outcome

A live, public tool used as a personal and educational reference for a law the author works with directly in disease-surveillance and public-health practice.

Unofficial and educational — always defer to the official government-published text for legal purposes. Not an OCR tool; the Thai legal text was manually transcribed once into clean data, and the English text was extracted from DDC’s book and proofread against its pages. The assistant can be wrong and is not legal advice; check its cited source.
Tech Stack
React 19 + TypeScript Vite Tailwind CSS React Router Tippy.js Vercel Cloudflare Workers + D1 Workers AI (bge-m3) Turnstile Vitest