Hospital Operations Dashboard: Building with AI and No Handwritten Code

    A practical account of using AI coding tools to build a hospital operations dashboard inside an existing internal system. The article covers requirements definition, metric consistency, incremental validation, read-only data access, caching, permissions, and the limits of this approach. The key shift is from writing implementation code to defining business rules and verifying safe, accurate results.

    1. The Request: A Dashboard That Previously Required a Vendor Quote

    Hospital leadership wanted a straightforward way to track outpatient visits, inpatient activity, bed occupancy, and revenue breakdowns, with monthly trends.

    Under the usual IT request process, the response would have been: contact a vendor for custom development and obtain a quote. The obstacle was not a lack of willingness to help, but a long delivery chain. Requirements had to become procurement specifications, procurement needed approval, development had to be scheduled, and acceptance testing required coordination. Delivery often took months.

    This time, the delivery approach changed. The result was a web page embedded in the hospital’s existing administrative system, accessible with existing user accounts. Displaying it in a full-screen browser on a meeting-room screen turned it into an operations dashboard.

    An important cost distinction: this was not an expensive LED video-wall installation. It was a responsive web page. For most hospitals, that format is sufficient—the metrics need to be readable by people, not built into a wall. The budget saved can be better directed toward data governance, interface improvements, or workstation upgrades.

    2. Four Technical Barriers That Previously Blocked Delivery

    Breaking down the request reveals four implementation barriers. Any one of them can be difficult for someone without professional development experience:

    1. Backend APIs: Business tables must be converted into structured data the frontend can consume, with connection management, parameter validation, and error handling.
    2. Frontend development: Layout, chart rendering, responsive scaling, and theme design each require their own expertise.
    3. Charting libraries: Mainstream libraries have extensive, nested configuration options for axes, legends, tooltips, and data transformations. Learning the documentation alone takes time.
    4. Deployment and permissions: Runtime dependencies, static asset hosting, session integration, and access control all need to work together. Failures can be difficult to trace.

    Traditionally, these barriers pushed the entire implementation toward outsourcing. AI coding tools change that structure by compressing the implementation work and allowing people to focus more closely on defining what the system should do.

    3. The Role Shift: From Writing Code to Defining Requirements

    The central lesson is that using an AI coding tool is not about asking it to guess what you want. It is about making implicit knowledge explicit. Vague requirements produce vague results; structured requirements make iteration possible.

    The following four-step approach guided the build.

    Step 1: Describe the Business Need, Not the Implementation

    The initial request covered only three things: which charts were needed, where the data came from, and where the page would live. In essence:

    We have an internal hospital administrative system and need an operations dashboard showing monthly outpatient visits, inpatient activity, bed occupancy, and revenue breakdowns in four charts. The data comes from the hospital’s operational database. Please propose a design first; do not write code yet.

    No framework, library, or directory structure was specified. Without expertise in those areas, imposing arbitrary choices could introduce unnecessary constraints. Allowing the tool to propose standard technical choices was more useful than prescribing an unfamiliar implementation.

    The instruction to design before coding also avoided generating large amounts of code before the direction was agreed upon.

    Step 2: Define the Metrics Before Refining the Code

    The biggest risk in operational reporting is often not the technology but the definition of each metric. “Outpatient volume,” for example, can mean registrations or completed visits, and totals may differ depending on whether canceled registrations are deducted.

    During design review, four constraints were added:

    • Use calendar months consistently, assigning records to months by their occurrence date.
    • Show admissions and discharges as two separate series for inpatient activity.
    • Calculate bed occupancy as occupied bed-days divided by available bed-days, aggregated across the hospital.
    • Group revenue using the hospital’s existing revenue classifications rather than introducing new categories.

    Fixing these definitions early substantially reduces later rework.

    Step 3: Specify Integration Instead of Creating Another System

    The integration requirement was explicit: do not create a standalone site. Add a route to the existing administrative application and reuse its login session and menu permissions.

    That single constraint avoided a separate single sign-on integration, another account system, and additional domain and certificate management.

    Step 4: Validate Incrementally, One Chart at a Time

    Rather than generating all four charts at once, the first iteration produced only the outpatient trend chart. Its data and appearance were checked before extending the approach to the other three.

    Each iteration addressed one issue, keeping the scope of any failure small enough to diagnose.

    4. Implementation Details That Require Human Review

    An AI tool can write code, but it cannot take responsibility for production data security. The following areas required explicit human review.

    Read-Only Access Is Nonnegotiable

    A dashboard that only reads data should never receive write permissions. Use a dedicated read-only database account and, where possible, have the tool query views rather than raw operational tables.

    The intended view structure was illustrated as follows:

    1. CREATE VIEW v_ops_monthly_outpatient AS
    2. SELECT dept_code,
    3. DATE_FORMAT(visit_date, '%Y-%m') AS ym,
    4. COUNT(DISTINCT visit_id) AS visit_cnt
    5. FROM outpatient_visit
    6. WHERE visit_date >= :start_month
    7. GROUP BY dept_code, ym;

    Aggregate in the Database, Not in Application Memory

    The dashboard displays aggregates. Detailed records should stay in the database, while the API returns monthly summaries.

    An illustrative response structure:

    1. {
    2. "metric": "outpatient",
    3. "unit": "visits",
    4. "series": [
    5. { "ym": "2026-01", "value": 48210 },
    6. { "ym": "2026-02", "value": 39870 }
    7. ]
    8. }

    Add Caching

    Operational metrics may update the next day or even on a monthly cycle. There is no reason to query the database on every page refresh.

    A server-side cache with an expiration time is sufficient for this use case and reduces database load.

    Make Threshold Reference Lines Configurable

    The bed occupancy chart automatically displayed a red reference line when occupancy exceeded 85%. This was the feature leadership cared about most: a number that previously occupied one spreadsheet column now made threshold-crossing months immediately visible.

    The threshold should not be hardcoded. Keeping it in configuration allows it to change with the hospital’s management requirements.

    Preserve Permissions and Compliance Controls

    Revenue breakdowns are sensitive. The dashboard must reuse the hospital’s existing role-based permission model and control metric visibility by role.

    The page should not persist detailed records to disk. Exports should either be disabled or recorded in an audit log. Fields containing patient identifiers must never appear in API responses.

    5. Common Pitfalls

    • Time zones and month boundaries: Records near midnight or a month boundary can be assigned incorrectly. Handle these rules consistently on the server rather than leaving them to the frontend.
    • Division by zero and empty data: Zero available bed-days or a department with no records for a month can break calculations or charts. Provide fallback values and handling.
    • Responsive layouts: Meeting-room displays and office monitors can have very different resolutions. Use relative layouts and container-responsive charts instead of fixed pixel dimensions.
    • Changing too much at once: Asking the tool to modify the backend, frontend, and styling together makes failures difficult to isolate. Keep changes focused.
    • Missing acceptance criteria: Every iteration should state how correctness will be judged. A criterion such as “the value for this month must match the existing report” can greatly reduce back-and-forth.

    6. Where This Approach Fits—and Where It Does Not

    This method suits internal reporting requirements with clear boundaries, predominantly read-only access, and a manageable number of metrics. It is not a substitute for modifying core operational systems, nor is it appropriate for workloads requiring strict real-time behavior or strong consistency.

    The main benefit is not simply lower cost. It is a change in the IT department’s role: from passing requests to vendors to defining requirements directly.

    That ability still depends on understanding business metric definitions and data security. AI coding tools can reduce implementation work, but they cannot replace that judgment.