The concept of no-code was first introduced by James Martin in his book Application Development Without Programmers (1981), he envisioned a future where non-programmers could build applications without coding skills. Almost 40 years later I can confidently say that this has started to become a reality. In this article, we will explore how you can build a Patient Management EHR in FHIR using AI in under 30 minutes.
Why are we using FHIR?#
FHIR (Fast Healthcare Interoperability Resources) is a healthcare standard that enables uniform health information exchange between different systems. Read more about it here.
Let’s say you build your application in a certain way with your own proprietary patient data model. Your application will only work for you and whoever has adopted your data model to capture data. Hence, it's important to use a widely used health data standard such as FHIR so that the app you build and the data it generates are interoperable and can be used by a wider audience.
The setup#
We’ll be splitting up this section into two parts —
- Setting up the FHIR data layer
- Setting up the AI development environment
Setup a FHIR server locally#
Skip this step if you have access to a FHIR server from the various cloud providers like Microsoft Azure, IBM, AWS, GCP, Aidbox, etc.
In this section, we’ll see how to set up a HAPI FHIR server within your computer with the help of an application called Docker. This will enable you to have different servers running on your computer within isolated virtual boxes called containers.
For brevity, I won’t be going into detail on how to step up the servers in this article, you’ll find everything you need in this GitHub repo: https://github.com/medblocks/hapi-fhir-docker-compose.git
Go through this README file for a beginner-friendly tutorial: https://github.com/medblocks/hapi-fhir-docker-compose/blob/main/README.md or watch the following video
Now that we have access to a FHIR data platform we can move on to setting up our AI coding environment.
Installing Nodejs#
We are going to build our EHR as a JavaScript web app. For this we need to run Javascript on our computers, there are multiple JS 'runtimes' to choose from, but the most popular one is Nodejs.
Click here to download and install nodejs: https://nodejs.org/en
- Install nodejs in windows video guide
- Install nodejs on Mac video guide
Setting up Cursor - An AI code editor#
There are multiple options of AI coding tools available on the internet. The editor we are going to use for this project is Cursor.
AI isn’t a mind reader. When creating real-world products, you can't expect AI to intuitively get everything right. The key isn’t about crafting perfect prompts or using the most advanced models—it’s about providing clear, concrete context and docs. Here is a well-structured rules file that can turn your AI coding assistant into a dependable and efficient development partner.
- Download, install, and log in to Cursor
- Clone this repo or download the zip of this repo and unzip it on your computer ( "Code" > "Download Zip") : https://github.com/medblocks/ai-coding-fhir-starter
- Open Cursor > File(top most menu)>Open Folder>(Select the folder you unzipped)>open
- Once you have it open use the README.md file
On the left-hand side, you can see all the files in this folder, there is a rules file called .cursorrules
that provides context to the AI about how you want the code to be written and how your project is structured. It has been specifically customised for this project to utilise FHIR data standards. We use Svelte as our JS framework, but a similar pattern can be used for any other project you may want to work on, play around this file and customise it according to your needs.
Let's start Prompting#
In this project, we are going to build a simple patient management application that works on FHIR APIs.
Cursor has a very useful feature called composer. It allows us to perform multi-file editing and generate entire applications based on high-level instructions, significantly expanding the capabilities of traditional code editors.
You can open the composer using the shortcut Ctrl + i
on Windows or Cmd + i
on Mac.
All we need to do now is generate a detailed prompt to paste into the cursor composer to get our desired output.
Let's try the following prompt :
Create a modern-looking EHR that can list patient details, add patients, delete patients, search for patients, and edit patient details using FHIR standards using a local HAPI FHIR server with {{BASE URL OF THE FHIR SERVER}} and patient URL {{BASE URL OF THE FHIR SERVER}}/Patient The tech stack for this is as follows
- SvelteKit
- TypeScript
- Tailwind CSS
- HAPI FHIR
We can submit this prompt and let Cursor do its magic.
NOTE: Complex projects cannot be created in a single prompt. What this initial prompt is meant to do is to lay the groundwork to build on. Go step by step prompting the composer as you add and change features. If the AI messes up at any point, you can always go back to a previous checkpoint in the composer and try a different prompt.
Use this excellent 10 min video from Better Stack youtube channel that walks you through all the unique features of Cursor : These Hidden Cursor Features Will Make You 10x More Productive
Conclusion#
Programming has increasingly become more accessible to everyone. With the skills of good prompting and context writing, it is now possible to tackle bigger and more complex projects, and bring valuable ideas to life.
The article merely scratches the surface of what is possible with coding with ai tools.