Back to Projects

The dashboard is one committee at a time. These counts are Appropriation's bills in Postgres: 14 referred, 17 on an agenda, and 13 reported. The search box is the OpenSearch query. Activity is the audit log, including brief requests and discards.

Session Desk

Full Stack Developer

Committee deskSearchAI briefingAudit

Session Desk is a live committee desk for a fictional legislative session. Staff sign in as a clerk, analyst, or viewer, work the bills referred to their committee, and search the rest of the session. PostgreSQL holds the agenda, notes, and audit log. OpenSearch answers number, text, and statute-citation queries. A language model can draft a staff brief, and that draft becomes a note only after a person accepts it. The app is ASP.NET Core and Angular, running on my Kubernetes cluster at session-desk.apps.onpoint.host. The bills are fictional. The split between the record, the search index, and the model is the point.

Bills

This is the list the signed-in clerk can act on. The filters are the statuses stored on the bill: referred, on an agenda, reported favorably, and reported unfavorably. Record action is the write, and committee membership still decides who can use it.

Calendar

Calendar is the hearing schedule. SB 1204, School bus inspection cycle, is set for Friday, February 12 at 9:00 AM in Room 412. Schedule hearing is how a clerk moves a referred bill onto an agenda.

Audit

Audit is what a person did, in order. Requesting a brief, discarding it, and adding a staff note are separate rows. A draft does not change the bill. Discard leaves the bill alone. A staff note is written only when someone accepts the draft.

305 bills
Session

Five hand-written bills plus 300 generated from a fixed seed

6
Committees

Demo users sit on Appropriations and Rules. Search still finds the other four

OpenSearch
Search

Number fragments, body text, and citation keywords, with highlights

Human accept
Brief

The model returns text. The note is written only when a person accepts it

The Problem

A committee desk and a session search box are different jobs. The desk has to know who can place a bill on an agenda or add a note. The search box has to find a bill by a number fragment, a word in the text, or a statute citation, including bills the reader cannot act on. A staff brief is useful only if a person still decides what goes into the record.

The Solution

Kept PostgreSQL as the source of truth for bills, hearings, notes, and audit events. Added an internal OpenSearch node that the API bulk-indexes after seed, and routed the header search to that index. Committee membership still gates every write. The briefing call is a fixed HTTP request that returns text. A citation check in C# withholds a draft that names a bill the committee does not have. Accept writes the human note and an audit row. Discard leaves the bill alone.

Where each request goes

Search reads the index. Notes and the audit log stay in PostgreSQL. The model never writes either one.

Technical Decisions

Key architecture decisions and their outcomes

PostgreSQL stays the record

Context

Hearings, notes, and the audit log have to stay consistent with who is allowed to write them. A search index is a copy, and copies drift.

Decision

Bills, hearings, notes, and audit events live in PostgreSQL through EF Core. OpenSearch is rebuilt from that table. A missing or empty search cluster returns 503 and does not change the desk.

Outcome

The committee list, the agenda, and the audit row remain queryable when search is down. Search can be reindexed from the same rows.

OpenSearch for the session, not LIKE for the committee

Context

The first header box filtered the current committee with a case-insensitive contains check. That is fine for five bills. It cannot use a normal index for a leading wildcard, and it cannot highlight a statute citation inside a bill body.

Decision

Submitting the header opens a search page. The API queries OpenSearch across number, title, sponsor, body, and citation. A term that looks like a number or an SB/HB token also wildcard-matches the bill number, so 12 hits SB 1200 and SB 1204. Citation is a keyword field.

Outcome

The bills list and the dashboard show the selected committee only. Search is the one place a number, a word, and a citation mean the same thing.

The search cluster is not on the public internet

Context

OpenSearch with the security plugin off is convenient for a single node and unsafe if anything outside the cluster can reach port 9200.

Decision

One OpenSearch pod, single-node discovery, security plugin disabled, 512MB heap, ClusterIP on 9200. No NodePort and no Caddy route. The API is the only client, and it requires a signed-in committee member.

Outcome

Staff search the session through the app. The index is not a second public API.

A few hundred fictional bills, not a copy of the Senate site

Context

Five bills in an index does not show what search is for. Copying live bill text from flsenate.gov would put someone else's publication in a demo.

Decision

Kept the original five bills, their hearing, and their actions. Added 300 more from a fixed random seed, spread across Appropriations, Rules, and four committees the demo users are not on. Each one has a number, a sponsor, a status, a citation such as 120.54, and a short body that includes that citation.

Outcome

A committee list is dozens of bills. Search can return a bill the user can read and cannot record.

The model drafts text. People write the record

Context

A committee brief is useful. An autonomous agent that files notes, schedules hearings, or calls tools would put model output on the record without a person.

Decision

One fixed pipeline. The API sends the bill and the committee's other bill numbers to MiniMax and asks for text. There is no tools array. A C# check looks for SB and HB numbers. A number the committee does not have withholds the draft, returns 422, and writes an audit event. Accept stores the person's note. Discard stores nothing on the bill.

Outcome

Viewers cannot draft. Clerks and analysts can. The audit log shows the request, a withheld draft, a discard, or the accepted note, tied together by one trace id.

Same repository, two ORMs

Context

The live desk is Entity Framework Core. A posting that also asks for NHibernate is about the mapping and session model, not a second production database.

Decision

Left the deployed API on EF Core. Added a public companion, github.com/launchthatbrand/session-desk-orm, with one IBillRepository implemented by NHibernate 5.5 mapping-by-code and by EF Core 8. The same four cases run against both on Postgres: load a bill with its actions, list one committee, add a note, and record an action with a note inside a transaction that rolls back together.

Outcome

The live app still has one ORM. The comparison shows ISession versus DbContext, an inverse bag versus Include, and a shared transaction boundary.

HttpClient for the model call

Context

Microsoft.Extensions.AI is the usual .NET chat abstraction. This call also sets reasoning effort, forbids tools, and has to drop the model's reasoning text so it is never stored.

Decision

Posted the MiniMax chat-completions body with HttpClient. The completion's visible text is the draft. The reasoning content is discarded. Tests use a fake client and never call the provider.

Outcome

The request shape stays exact, and the test suite does not depend on a live model or a live OpenSearch node.

Engineering Details

  • Every API call except health and login requires a signed-in user and an X-Committee-Id header for a committee they belong to
  • Bill writes look up the bill inside that committee. A bill on another committee is readable from search and returns 404 on record
  • The Angular header submits to /search. Highlight tags from OpenSearch are split into marked text and never bound as HTML
  • Startup migrates PostgreSQL, seeds the corpus if it is missing, then a background service creates the session-bills index and bulk-loads every bill
  • OpenTelemetry spans cover retrieve, prompt, generate, and citation. Export to Langfuse runs only when the public key, secret key, and base URL are all set
  • Images are built on the cluster node and imported into k3s. OpenSearch is not exposed through the ingress

Key Highlights

  • Live on Kubernetes at session-desk.apps.onpoint.host
  • Clerk, analyst, and viewer roles, scoped to a committee
  • 305 fictional bills across six committees, generated from a fixed seed
  • Header search by number fragment, body text, and statute citation
  • OpenSearch is ClusterIP-only. The API is the only caller
  • A draft that cites an unknown bill is withheld before anyone sees it
  • Accepting a brief writes a staff note and an audit row with one trace id
  • Langfuse tracing is wired and stays off until a project key is set
  • Companion repo compares the same bill repository on NHibernate and EF Core: github.com/launchthatbrand/session-desk-orm

Tech Stack

Skills & Technologies

Related Articles

Related Projects