
Chris Parmer
November 30, 2026
Bakken well monitoring and decline curve analysis app
A data app example built with Dash and an AI coding agent in 55 minutes
TL;DR
- Building data apps with AI coding agents in Python and managing them on Dash Enterprise or Plotly Cloud is the modern alternative to BI. At Plotly, many of our customers are migrating away from point-and-click tools like Spotfire, Tableau, and Power BI toward code-backed tools powered by AI. This example showcases the types of apps that you can create.
- This app does production monitoring and decline curve analysis for the wells of one Bakken oil field in North Dakota, on the state's public monthly production reports and well maps. A coding agent built it from one prompt in about 55 minutes.
- Every well has its own page with a decline fit you can move, so you can send a colleague a link to the exact well you're asking about.
- Each time the app starts, it refits every producing well's decline without its last three months and flags the wells that fell below it, which is the list a production engineer works through each month.
- The full prompt is below, so you can build the same kind of app on your own wells and run it on Dash Enterprise behind your firewall or have it hosted for you on Plotly Cloud.
Walkthrough
Production engineers on a Bakken asset look at the same questions every month: which wells made less than they should, which ones went down, and how the new wells compare with the last ones. The app starts with the field, then the wells, then one well's decline curve.
The data is the North Dakota Industrial Commission's (NDIC) monthly production report for every well since May 2015, and NDIC's public map layers for the wells and their horizontal laterals. Little Knife was the top-producing field in those reports for 2025.
See the whole field and every lateral

The overview shows the field's oil by operator, the wells producing, water cut, and the share of gas flared, each with the month it changed. The stick map draws every horizontal lateral NDIC has on file, colored by when the well first made oil or by operator, and clicking one opens that well.
Open any well and refit its decline curve

Each well's page has a decline curve with an Arps hyperbolic fit from SciPy. Move the slider to change where the fit starts, or type a different economic limit, and the forecast and the estimated ultimate recovery (EUR) update in the callback.
Below it, the well sits against the type curve of wells that came on in the same years, next to its lateral on the map and its water cut and gas-oil ratio.
Find the wells that fell below their decline

This is the practice the app is built around. For every producing well, the app fits the decline without its last three months, then compares those months with the fit, and flags wells that came in 25% or more below, went offline, or saw their water cut climb.
A production engineer usually builds this list by hand in a spreadsheet. Here it's a few Python functions that run for every well each time the app starts, and each dot on the chart opens the well.
Compare type curves by vintage, lateral length, or operator

The type curves page groups the Bakken wells whose whole history is in the data by first-oil years, lateral length, or operator, and draws P10, P50, and P90 as small multiples on the same axes. A switch normalizes them per 1,000 feet of lateral, so a longer well doesn't look better only because it's longer.
The scatter under them plots each well's first 12 months of oil against its lateral length, and clicking a dot opens the well.
See each operator's share of the field

Each operator gets its own panel with the field total behind it, so you can see who is drilling and when. Operators are as NDIC lists them each month, so a sale shows up as one line stopping and another starting.
Ask the app from an AI agent

The app is also a Model Context Protocol (MCP) server. Seven of its Python functions are marked with @mcp_enabled, so any AI tool like Claude, ChatGPT, Copilot, or Plotly Studio Embedded can ask for the field's latest month, one well's history, a decline refit, the monitoring list, or a type curve, and get the same numbers the pages show. Each tool's type hints become its schema and its docstring becomes the instructions the agent reads:
from dash.mcp import mcp_enabled@mcp_enabled(expose_docstring=True)def fit_decline(fileno: int, start_month: Optional[int] = None, economic_limit: float = 15.0) -> dict:"""Fit an Arps hyperbolic decline to a well's producing-day oil rates and forecast it to the economiclimit (b/d), with an 8%-a-year terminal decline. start_month is the producing month to fit from(1 is the first month with oil); by default the fit starts at the peak. Returns qi (b/d), Di (nominal,per year), b, RÂČ, remaining oil and EUR in barrels."""f = W.fit_arps(fileno, start=None if start_month is None else max(start_month - 1, 0), econ=max(economic_limit, 1.0))...
Ask it inside the app with Plotly Studio Embedded

On Plotly Cloud you can switch on Plotly Studio Embedded, a chat panel that sits on top of the app and calls the same tools. We asked it which producing wells are furthest below their own decline curve and how much oil a month the field is short because of them, then asked for the worst 10 in a chart colored by operator. It ran the app's surveillance_list tool and built the chart from what the tool returned.
Those 10 wells lose about 43,800 bbl a month against their own declines, which is just over half of the shortfall across all 56 wells below their decline. Eight of the 10 are Burlington's Keene and Manchester wells, and the largest single loss is Petro-Hunt's Hartman 144-97-5A-8-3H at about 6,900 bbl a month. Its first chart had a filter error on the Burlington series, so it drew a corrected one and said so in the answer.
Studio Embedded is available on Plotly Cloud now (in beta) and is planned for Dash Enterprise in Q4 2026. Every answer has a Methodology link that shows the tool calls and code behind it.
See how every number is defined

The How we calculate page writes down the app's data definitions and methodology: calendar-day against producing-day rates, which months a fit skips, the terminal decline and economic limit behind each EUR, how lateral length is measured, and what counts as below a decline. Each card has the formula and the Python function that computes it.
Data is often messy and ambiguous, and writing things down is a way for your app's viewers to know how you came to certain numbers.
Those functions are the app's semantic layer. The charts, the tables, and the AI tools all call the same ones, so a number means the same thing wherever it shows up.
What else could you add?
The prompt is a starting point. These are the kinds of things teams usually ask for next, and each one is a sentence or two more in the prompt:
- Your own production accounting system and daily allocated volumes instead of the state's monthly report
- Completion data (proppant, fluid, stages) on each well, and type curves by completion design
- Notes and work orders saved from the monitoring list, so the next engineer sees what was checked
- Alerts by email or Teams when a well drops below its decline, with a link to its page
- Parent and child well pairs from the lateral map, to see how infill wells affect their neighbors
- An economics page with price decks, operating costs, and net present value for each well
How is this different from Spotfire and other BI tools?
If you're comparing Spotfire alternatives or other BI tools, the main differences come down to five things:
- With AI, apps like this can be built quickly and cheaply by anyone, including the production and reservoir engineers who know the data best.
- The apps are backed by code, which you can version control, manage, and update more easily than a fleet of point-and-click dashboards, especially when AI is making the changes.
- The apps can go much further than a traditional BI tool, with multiple pages, write-back to databases, custom simulations, decline fits that refit live, AI chart building inside the app, MCP endpoints, and more.
- You have full control over the app: the look and feel, the controls, filters, and buttons, and every computation. You aren't fighting a tool to get what you want.
- The apps can connect to several data sources at once, and to the other systems your team already uses.
How long did it take to build?
About 55 minutes of agent time, from the first data request to a working private deploy on Plotly Cloud. Claude Code (with Claude Opus 5.5) downloaded the monthly reports and the well maps, prepared them with Polars, wrote the decline fits, the monitoring list and the pages, ran the app, took screenshots, and fixed what looked wrong in them. The first deploy kept restarting while it built its data, because each filtered month still held on to that month's full set of strings in memory, so the agent copied out the rows it kept and deployed again.
To check the data, it compared the state's monthly totals in the public reports with the Energy Information Administration's (EIA) North Dakota series. The reports come in 7% to 10% below, because they leave out wells that are still confidential, and the gap tracks the number of confidential wells each month.
The prompt
Paste this into Claude Code, Codex, Copilot, Cursor, or another coding agent, in an empty folder. Swap in your own data source and the features you need.
Build a Dash app for production monitoring and decline curve analysis on one Bakken oil field in North Dakota, the field with the most oil in the state's public production reports for 2025, using Polars for every query and SciPy for the decline fits.
Data
- Download the North Dakota Industrial Commission's monthly production reports (one Excel file per month since May 2015, listed on its Monthly Production Report Index page) and, from NDIC's public GIS services, the wells, the horizontal well bore paths, and the outline for the field.
- Keep the field's rows, and the state total and oil by field for each month. Save small tables the app reads, and compute each well's lateral length from its bore paths.
- Check the state totals against the EIA's North Dakota crude production series before you build anything, and tell me what doesn't match and why.
Pages (each with its own URL, and the back button must work)
- Overview: KPI cards with sparklines, field oil stacked by operator with wells producing, a stick map of every lateral colored by first-oil year or operator where a click opens the well, the wells to look at this month, and water cut and gas-oil ratio.
- Wells: a grid of every well; clicking a row opens /well/<NDIC file number>.
- /well/<file number>: a log-scale decline curve with an Arps hyperbolic fit from SciPy, a slider for where the fit starts, an economic-limit input, a modified hyperbolic forecast and EUR; oil, water, and gas; the well against its type curve; its lateral on the map; and water cut and gas-oil ratio.
- Monitoring: refit every producing well without its last three months and flag the ones 25% or more below the fit, the ones that went offline, and the ones with water cut rising, with a forecast against actual scatter.
- Type curves: P10, P50, and P90 by producing month as small multiples, grouped by first-oil years, lateral length, or operator, per well or per 1,000 feet of lateral, with an Arps fit to each P50.
- Operators: small multiples of oil by operator with the field total behind each one.
- AI tools: expose the field summary, the wells, one well, the decline fit, the monitoring list, and the type curves as read-only `@mcp_enabled` tools, and list them on a page.
- How we calculate: a card per metric with the question it answers, its definition, its formula, and the function that computes it.
Design
- A gray page with an inset sidebar. Each card is a light surface with its title above a white inset panel for the chart or table. Inter everywhere. No chart toolbars.
Write tests for the decline fit. Run it, screenshot every page at 1600x1000, and fix anything that overflows, looks empty, or doesn't match the numbers before you stop.
How do I run it on Dash Enterprise or Plotly Cloud?
Dash Enterprise runs Dash apps inside your own infrastructure, behind your firewall and even air-gapped, with single sign-on and access control for each app.
This app needs nothing special. It's a Dash app with a requirements.txt, and your coding agent can deploy it through the Dash Enterprise or Plotly Cloud command line.
On its first start the app downloads the monthly reports and builds its tables, which took about a minute in our tests. Attach a persistent filesystem and set DATA_DIR to it, and the tables are built once and kept through restarts and redeploys.
If you'd rather not run any infrastructure, Plotly Cloud hosts the same app for you. We tested this one there.
Tips and tricks
These are things we like doing when we build apps like this one.
- Ask for a page per well. A link to one well's decline curve is what people actually send each other, and it makes the app feel like a website rather than a report.
- Test the forecast on months it hasn't seen. Refitting without the last three months and comparing is a simple backtest, and it turns a decline fit into a monitoring list.
- Say which rate you mean. Calendar-day and producing-day rates differ whenever a well is down, so the app uses one for field totals and the other for decline fits, and the How we calculate page says which is which.
- Normalize by lateral length. Per 1,000 feet of lateral is how Bakken teams compare wells of different lengths, and asking the agent for the toggle costs one line of the prompt.
- Let plain Python functions be your semantic layer. The rates, the Arps fit, the forecast, the flags, and the type curves are short functions in wells.py, and you can read them, test them, and change them, and so can the agent. Plain Python functions like these can become your semantic layer, one definition that every page, test, and agent uses.
- Wrap your Python functions in @mcp_enabled. Turn on enable_mcp=True in the Dash(...) call and mark the functions with @mcp_enabled, and chat agents like Claude, ChatGPT, or Copilot can call them over MCP and get the same numbers the app's pages show.
- Switch on Plotly Studio Embedded. The same tools power Plotly Studio Embedded, an AI chat inside the app that answers questions with charts and tables built from your functions. It's available now on Plotly Cloud (in beta) and is planned for Dash Enterprise in Q4 2026.
FAQ
See what Dash Enterprise and Plotly Cloud can do for your team
Our customers in energy, pharma, finance, and manufacturing are building apps like this one with coding agents and running them on Dash Enterprise behind their firewall or on Plotly Cloud. Request a demo and we'll show you how it works for your team.