Patient Encounter notification Application

In this tutorial we will create simple application written on Clojure programming language using Aidbox Clojure SDK and or as a backend.

All source code available on Github Aidbox/app-mailgun-clj

Problem statement

We have a Encounter included Patient, date and location of visit.

We want send Email to patient with notification of upcoming visit. In this email we want show Patient information, time and location of visit. These notifications should be sent the day before the visit.


Aidbox as backend which will store all Encounters. .....

Clojure application with Aidbox Clojure SDK as connector between our application and backend.

For sending Emails we will use MailGun service as a most easiest way to send emails instead SMPT.

Architecture of Aidbox based Application

Get started

In the first you need install local See full instruction how to install and how to use Rest API

In this sample application we use Clojure CLI. See Getting Started for details on how to install the tools.

Enable Aidbox SDK

In this sample app we will use Clojure Cli - command line tools for running REPL and Clojure apps. In deps.end file need specify aidbox-sdk as reference to git.

{aidbox-sdk {:git/url ""
:sha "057ebd1a542bb17c7a910283ae942f56a89167f1"}}}

And then require aidbox-sdk in the main mailgun.core file

(ns mailgun.core
(:require [aidbox.sdk.core :as aidbox]))

Connect your app with Aidbox

For connecting your application with Aidbox, you need call aidbox/call method send them information about location of Aidbox and your application.

(def manifest
{:id "mailgun-app"
:type "app"
:env {:box {;; host and port of Aidbox instance
:host "localhost"
:scheme "http"
:port 8888}
:app {;; host, port and client creds of your application
;;:host "docker.for.mac.localhost" ;; for Mac Os
:host "localhost"
:scheme "http"
:port 8989
:id "root"
:secret "secret"}}})
(defn -main [] (aidbox/start manifest))

How it works?

When you call aidbox/start method, aidbox-sdk try to connect to Aidbox with given , and credentials and then, if connection success, register your app in Aidbox. After that, aidbox/sdk create local web server running on port, in our case is 8989.

Email templating

Sending email

Aidbox Jobs