Building a Medical Terms (SNOMED CT) Healthcare Application
Systematized nomenclature of medicine or SNOMED CT is a collection of clinical terms. It provides terms and definitions for diseases, substances and anatomy used in reporting and clincial documentation.
Many healthcare applications use SNOMED CT to provide healthcare personnel including doctors, nurses and physicians assistants access to the latest medical definitions. These applications include:
- Genetic Databases
- Electronic Healthcare Records
- Medical Diagnosis
- Laboratory Reporting
SNOMED CT is maintained and distributed by the IHTSDO, an international non-profit standards development organization, located in Copenhagen, Denmark.
In this blog post, we are going to outline the key steps to build a medical terms healthcare application using the BioOntology API.
STEP 1: Sign up for a BioPortal Account
Go to http://bioportal.bioontology.org/accounts/new to sign up for an account. You will receive an API key that you will need to build your application. BioPortal provides REST services for accessing their clinic terms repository.
STEP 2: Designing the User Interface
The user interface consists of a top aligned Toolbar and a client aligned ListBox. The Listbox serves as a container for our search bar, description memo, URL bar and navigation buttons.
STEP 3: Connecting to the SNOMED CT REST service
Place the following 5 components onto your Form:
- TRestRequest
- TRestClient
- TRestResponse
- TRestResponseDataSetAdapter
- FDMemTable
First, you will need to set the BaseURL on your RESTClient component to http://data.bioontology.org
Next, you will need to set some properties on the RESTRequest component. Set Resource to search and define two parameters, one for the query (q) and one for the apikey. Set an initial value for q, such as Biceps.
On the RESTResponseDataSetAdapter, set the Dataset to FDMemTable1 and define the RootElement as collection. Set the Active property to True.
Right-click on RESTRequest and select Execute.
After executing your REST request, right-click on the FDMemTable component and select Fields Editor. Then right-click within the empty dialog to Add Fields. All the available fields should be auto selected. Click OK to add them to your in-memory data table for data binding.
STEP 4: Connecting the UI elements to data
Go to View > LiveBindings Designer to bring up the LiveBindings Designer.
To set up a data binding, drag a line between RESTRequest1's Params.q and Edit1.Text. This will allow the user to search for a medical term by entering the term in the Edit control. Next, drag a line between FDMemTable1's definition and Memo1.Text and FDMemTable1's @id and URLEdit.Text. This will display the definition for our medical term in our Memo and the reference URL in the second Edit control.
Right-click on the RESTRequest component again to execute the request. This will display data at design time.
The last step is to set up the Next and Prior buttons for navigating between the results. Place a TActionList component onto your Form.
Select the Prior button. In the Object Inspector, select Action>New Standard Action>LiveBindings>TFMXBindNavigatePrior. Expand the DataSource and ensure that DataSet is set to FDMemTable. Repeat the steps for the Next button.
STEP 5: Coding the application
This application only consists of 4 lines of code.
//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit15.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.fmx" TForm15 *Form15; //--------------------------------------------------------------------------- __fastcall TForm15::TForm15(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TForm15::btnGoClick(TObject *Sender) { //set dataset to active and execute REST request BindSourceDB1->DataSet->Active = True; RESTRequest1->Execute(); } //--------------------------------------------------------------------------- void __fastcall TForm15::FormCreate(TObject *Sender) { //set dataset to inactive at application launch BindSourceDB1->DataSet->Active = False; } //--------------------------------------------------------------------------- void __fastcall TForm15::Memo1Change(TObject *Sender) { //display predefined text in the Memo if the data source returns no definition if ((BindSourceDB1->DataSet->Active) && (Memo1->Lines->Text = '')) Memo1->Text = 'no data available' } //---------------------------------------------------------------------------
STEP 6: Deploying your application to iOS, Android, Windows and Mac
Tips & Tricks: Utilizing the REST Debugger for quick testing
The REST Debugger is a tool for making ad hoc requests. The TRESTDataSetAdapter and TFDMemTable components convert the JSON representation into a dataset.
With this tool, you can use different authentication methods to connect to services such as Google API or Twitter, or the SNOMED CT API in this case. You can send a request to the specified service and view the response.
The REST Debugger can be accessed via Tools>REST Debugger in the IDE. The REST Debugger can also generate the components for you that you can then just copy and paste onto your form with all the properties already set.
REST Resources:
- http://docwiki.embarcadero.com/RADStudio/Berlin/en/REST
- http://docwiki.embarcadero.com/CodeExamples/Berlin/en/REST.SurfSpotFinder_Sample_(Delphi)
- https://www.embarcadero.com/free-tools/rest-debugger
- 5 Minute REST Client Video Challenge


Thank you Sarina for clean and practical example. It is exceptionally helpful.
Milen