Building a Hospital Operations Dashboard with an AI Coding Assistant, Without Writing the Code Yourself

    A hospital IT team used an AI coding assistant to add an online operations dashboard to an existing Python admin system. This article covers how to frame the request, lock metric definitions before coding, design four leadership-facing charts, handle auth and deployment, and avoid common rework—while the human role shifts from writing code to specifying and accepting the result.

    1. The request looked simple

    Hospital leadership asked for one thing: the ability to check outpatient volume, inpatient volume, bed occupancy, and revenue mix whenever they needed to. That short request implied several constraints:

    • Anytime means the numbers cannot depend on manually exported reports; they must be available online.
    • A look means visualization first, not dense detail tables.
    • A few metrics means definitions must be explicit, or different departments will read the same chart differently.
    • For leaders means the interface must be extremely simple: open it and understand it, with no learning curve.

    In the past, this kind of request usually meant a vendor quote, a procurement process, and a long implementation wait. For a short-staffed hospital IT team, a large budget and a multi-month timeline often killed the idea. An AI coding assistant compresses that path.

    2. Name the four hurdles before you start

    Before writing anything, split the work. Teams without dedicated front-end or back-end specialists usually hit four barriers:

    1. Back-end APIs: turn operational data in the database into JSON a web page can consume.
    2. Front-end pages: layout, interaction, responsive behavior, and resolution for a conference-room display.
    3. Charts: line charts, bar charts, ranked bars, and threshold lines each have their own parameters.
    4. Deployment and operations: environment setup, access control, and error handling.

    Any one of those used to be enough for a non-specialist to stop. The change this time was simple: hand all four to the coding assistant, and change the human role from “the person who writes the code” to “the person who states the requirement and accepts the result.” That sounds easy, but stating a requirement well is itself an engineering skill that takes practice.

    3. Describe the need first; do not ask for code yet

    The first prompt was organized roughly like this:

    Our hospital has an admin system written in Python. I want to add a data dashboard page that shows four metrics: outpatient volume trend, admissions versus discharges, lab and exam visits ranked by department, and bed occupancy (mark months above 85% with a red line), aggregated by month. The data comes from the hospital HIS database. Please design the approach first. Do not write code yet.

    The prompt deliberately stressed three things and left three things out.

    Stressed:

    • Which charts: metric, dimension, and comparison for each chart.
    • Where the data comes from: source database and monthly grain.
    • Where it lives: inside the existing system, reusing the current login, not a separate app.

    Left out:

    • Framework, chart library, and ORM—implementation choices for the assistant.
    • Exact table and column names—fine to add later once the design is sound.
    • Flashy interactions—the point of the screen is to be understood at a glance, not to pile on features.

    The benefit is that the assistant proposes an architecture first, and coding starts only after a human review, which avoids a large batch of code that does not fit the current system. In practice, “design, then code” cut rework sharply.

    4. The data layer: definitions matter more than charts

    Dashboards usually fail on metric definitions, not on the page. Working with the assistant, these definitions were confirmed first:

    • Outpatient volume: based on registration or visit records, assigned to the month of the visit date, so a visit is not counted twice across months.
    • Inpatient volume: admissions and discharges counted separately, assigned by registration or settlement date.
    • Lab and exam visits: aggregated by ordering department, with a clear rule for multiple exams for the same patient on the same day.
    • Bed occupancy: commonly calculated as actual occupied bed-days divided by staffed beds times the number of days in the month—a widely used industry definition.
    • Revenue mix: grouped by revenue category (drugs, exams, treatment, supplies, and similar), aligned with finance definitions.

    An illustrative monthly aggregate looks like this:

    1. SELECT
    2. DATE_FORMAT(visit_date, '%Y-%m') AS stat_month,
    3. COUNT(*) AS outpatient_count
    4. FROM outpatient_visit
    5. GROUP BY DATE_FORMAT(visit_date, '%Y-%m')
    6. ORDER BY stat_month;

    With clear definitions, the APIs and SQL the assistant generates are less likely to look right and be wrong. That was a real miss: the first version did not say whether ranking was by ordering department or performing department, so the chart did not match the departments’ own statistics and had to be redone.

    5. Pages and charts: turn a leadership view into visuals

    The finished screen has four charts, each answering one management question:

    1. Outpatient volume trend (line chart): is volume rising or falling?
    2. Admissions versus discharges (grouped bar chart): is inpatient service steady, or is work backing up?
    3. Lab and exam visits ranked by department (bar chart): which departments are under the most exam pressure, as input for staffing and resources?
    4. Bed occupancy (line chart plus a threshold line): a red line at 85%, with months above it marked automatically, so it is obvious when beds are tight.

    One product judgment mattered more than the rest: that red line is worth more than every visual polish. In a spreadsheet, leaders and functional departments had to scan a column of numbers. On the chart, the months that cross the line are immediate. The data moves from “look-upable” to “perceivable.”

    Technically, the page is an ordinary web page embedded in the department’s existing admin system. People sign in with their current accounts. No client install is required. Full-screen in a conference-room browser on a TV is the “big screen.” It is not an expensive LED video wall. For day-to-day hospital operations, a web page is enough, and the budget can go somewhere more urgent.

    6. Deployment and access: easy to skip, necessary to get right

    “Built” and “usable” are separated by deployment and permissions. The acceptance checklist included:

    • Reuse the existing session: dashboard APIs sit behind the current authentication; an unauthenticated call returns 401.
    • Least privilege on the database: dashboard queries use a read-only account, granted only the views or tables they need.
    • A performance backstop: cache monthly aggregates or use a pre-aggregated table so opening the page does not scan everything.
    • How gaps appear: months with missing data stay blank and are labeled; the whole chart does not error out and disappear.
    • Usable on a phone: leaders sometimes check from a mobile browser, so the layout must adapt without breaking.

    Each item was written into the prompt. The assistant could implement them. If they are not stated, it will not invent them. The acceptance checklist is part of the requirement.

    7. What went wrong

    1. Coding before definitions were agreed: one round of rework. Confirm metric definitions with the business departments before generating code.
    2. Asking for too much at once: iterate in rounds. One chart per round, then the next, was faster overall.
    3. No limit on data volume: the first API returned full detail and loaded slowly. Monthly aggregation returned in milliseconds.
    4. Session and access ignored: the first API was not behind login. Testing caught it. Security requirements must be written explicitly.
    5. Chasing spectacle: 3D charts and auto-rotation were added, then removed. The value of the screen is clarity, not show.

    8. The role changed; the skill did not disappear—it moved

    The main gain was not the budget avoided. It was a different way of working: hospital IT engineers do not have to type every line, but they still have to define the problem, align definitions, break down the request, and accept the quality. The assistant lowers the cost of implementation. Deciding what is actually needed remains the human contribution.

    If you work in hospital IT, with a similar coding background, and you face an operations dashboard request, try this path: write the charts and definitions clearly, let the assistant propose a design, implement in rounds, and accept against a checklist. Almost no code is written by hand, but the result is a real tool that fits the existing system and gets used every day.