Medical coding plays a key role in the healthcare industry. It enables both providers and payors to describe diagnoses and treatments and to determine the associated costs and reimbursements. It’s also complicated, time-consuming, and prone to errors.

A recent collaboration between ClearScale, AWS, and Creative Practice Solutions, a medical consulting firm, has yielded an application prototype to help overcome those issues.

Powered by AWS artificial intelligence (AI) and machine learning (ML) services, including Amazon Comprehend Medical, the app translates recorded medical appointment notes and uses the information to more accurately generate medical codes. The solution incorporates high-level security and data privacy controls to help meet HIPAA compliance requirements. It’s also cost-effective and requires little administration.

The Background and Challenges

Medical coding consists of numerous code systems, from the American Medical Association’s Current Procedural Terminology (CPT) codes to the World Health Organization’s International Classification of Diseases (ICD) codes. As a result, there’s a seemingly endless number of codes. The more codes, the more chances of errors.

Even the numerous software programs developed to ease some of the burdens through the use of macros and automation fall short. Rules for bundling services within a single code, misinterpretation of or inability to decipher notes, and other factors all contribute to the problems.

There’s also the issue of regulatory compliance. Any organization that touches protected health information (PHI) is subject to the stringent HIPAA rules for security and privacy. Failure to adhere to them can lead to costly fines and penalties.

A few companies have attempted to use AI and ML to address the issues but with limited success.

The AWS and ClearScale Team

AWS currently offers the broadest, deepest set of artificial intelligence (AI) and machine learning (ML) services. These complement its robust portfolio of infrastructure, the Internet of Things, and other services. As an AWS Premier Consulting Partner, ClearScale has extensive, proven expertise both in the use of AWS services and in collaborating with AWS itself.

So, when Creative Practice Solutions needed assistance in developing an application that could facilitate daily medical note writing and coding with AI and ML, AWS and ClearScale offered the ideal team.

Solution Architecture and Workflow

To reduce costs and administration time, the solution uses serverless architecture based on AWS services. AWS Step Functions coordinates the multiple AWS services into serverless workflows. It’s well suited to crafting long-running workflows such as machine learning model training, as well as for building high-volume, short-duration workflows.

The process starts with a healthcare provider recording medical appointment notes, typically on a mobile device. The user has the ability to review and edit the notes if needed.

The app uploads the recorded notes to an Amazon Simple Storage Service (S3) object storage bucket. This triggers an AWS Lambda function to start the processing cycle. Lambda allows for running code without provisioning or managing servers. (AWS Step Functions triggers all the Lambda functions in the application tier.)

Amazon Transcribe

The first step of the cycle starts an Amazon Transcribe service job. Amazon Transcribe uses a deep learning process called automatic speech recognition (ASR) to quickly convert speech to text. Voice activity detection (VAD) algorithms are also used for noise reduction and to help classify speech versus non-speech.

The result is a highly accurate transcription of the recording. The transcription file is then moved from transitional internal AWS secure storage to the separate raw-transcripts S3 bucket.

This triggers another Lambda function, which downloads the transcription and extracts raw text from it. Another function determines if the text is in English. If so, it’s uploaded as a JSON file to the English-transcripts S3 bucket. If it’s Spanish instead of English, Amazon Translate uses deep learning models to create an accurate translation. The file is then uploaded as a JSON file to the English-transcripts S3 bucket.

Amazon Comprehend Medical

Another Lambda function is triggered to download the JSON file. From there, Amazon Comprehend Medical, a natural language processing service, extracts relevant medical information, such as medical codes, from unstructured text.

The results are analyzed, and a medical note is created and saved to an Amazon DocumentDB database. A Lambda function then sends a push notification to all user application instances to reload medical notes.

Architecture Diagram
Architecture Diagram


The UI is set up to automatically adapt to the surrounding environment, working much like Dark Mode in Mac OS devices. The system adopts a darker color palette for all windows, views, menus, and controls. It also uses more vibrancy to make foreground content stand out against the darker backgrounds.

The solution incorporates features to enhance accessibility. For example, it employs Apple’s VoiceOver gesture-based screen reader for vision accessibility.

In addition, the UX is customizable. Because every individual has his or her own “voice preset” covering things such as pitch and sound frequency, the app includes the ability to change the VAD frequency for each user. The app can also have variable settings for the amount of time no speech is detected, so recording can be stopped.

Two different kinds of search functions are incorporated: predicate-based, which requires an exact match of some part of the word, and fuzzy search, which is more heuristic-based. The latter is useful for cases where it is hard to remember the exact wording when conducting a search or it is faster to search for a patient’s name based on initials.

Backend Application Architecture

Backend Application Architecture

The Benefits

While the solution is still evolving with many more features in the works, the prototype has already demonstrated numerous valuable benefits:

  • Flexibility. The single app works across multiple devices using any of four different operating systems using a single codebase, essentially yielding four apps for the price of one.
  • Accuracy. The solution delivers a more accurate translation of speech-to-text because background noise is eliminated, and there’s no need to recognize different speakers.
  • English and Spanish. It has the capability of recognizing both U.S. Spanish and U.S. English and translating U.S. Spanish to U.S. English.
  • Accessibility. The solution incorporates features to enhance accessibility.
  • Customizable UX/UI. The system can automatically adapt to the surrounding environment on all devices using any of the four supported OSs, working much like Dark Mode in Mac OS devices.
  • HIPAA compliance. The solution is architected for HIPAA compliance with built-in security controls and the use of HIPAA-compliant services such as Amazon Comprehend Medical. It also incorporates security and data privacy best practices. That includes encryption at rest and in transit, audit trails, and multi-factor authentication.
  • Export Options. Medical notes can be exported using various formats — PDF, XML, JSON, PLIST, and HTML — for compatibility with a variety of systems.
  • Reduced management time. Using various AWS managed services reduces administration and management time — and subsequently costs. With Amazon Lambda, for example, code can be run for virtually any type of app or backend service with zero administration.
  • Reduced costs. The use of AWS services also helps reduce costs, as demonstrated by Amazon Comprehend Medical. Creative Practice Solutions is only charged based on the amount of text processed on a monthly basis (in particular) and the usage base (in general).

More to Come

The application is poised to radically change how medical coding is done in the healthcare industry, but this is just the beginning. ClearScale, AWS, and Creative Practice Solutions continue to explore, develop, and test additional capabilities and features. You can learn about some of them in a future blog.

In the meantime, if you are interested in learning how ClearScale can help your company leverage AWS’s AI and ML services — or any other AWS services — in your next project, contact us.