DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Best Practices for Microservices: Building Scalable and Efficient Systems
  • Legacy Code Refactoring: Tips, Steps, and Best Practices
  • Designing and Maintaining Event-Driven Architectures
  • A Step-by-Step Guide to Write a System Design Document

Trending

  • How to Submit a Post to DZone
  • Enforcing Architecture With ArchUnit in Java
  • Tired of Spring Overhead? Try Dropwizard for Your Next Java Microservice
  • Chat With Your Knowledge Base: A Hands-On Java and LangChain4j Guide
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. Decompose Legacy System Into Microservices: Part 2

Decompose Legacy System Into Microservices: Part 2

In this article, follow along with a breakdown of a legacy insurance Reimbursement Calculation System into microservices in a domain-specific example.

By 
Somasundaram Kumarasamy user avatar
Somasundaram Kumarasamy
·
Nov. 29, 23 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
5.3K Views

Join the DZone community and get the full member experience.

Join For Free

In today’s evolving technological landscape, the shift from monolithic architectures to microservices is a strategic move for many businesses. This is particularly relevant in the domain of reimbursement calculation systems. As I mentioned in my previous article Part 1, let's explore how such a transition can be effectively managed.

The Monolithic Challenge

Imagine a scenario where you have a large-scale, monolithic system - possibly a bulky C# console application or an extensive SQL Server stored procedure. This system is tasked with performing reimbursement calculations, typically running overnight through a batch process scheduled in SQL Server. While functional, this monolithic approach often leads to challenges in scalability, flexibility, and maintenance.

Moving to Microservices

The objective of migrating to microservices is to decompose this large, complex system into smaller, more manageable components. The transition to a microservices architecture aims to leverage the cloud's advantages, including scalability, resource optimization, and cost-effectiveness.

Steps for Migration

1. Understanding the System

Begin by defining the data models from the existing monolithic application to understand its workflow, dependencies, and key components of the reimbursement calculation process. Source data for this system is thru 837 File which is a standardized electronic format for healthcare claim information. This file is extracted and data is generally loaded into a database through another loading process for the purpose of reimbursement calculation.  For example, a few data models from the 837 file might look as below:

C#
 
public class Patient
{
    public string Name { get; set; }
    public DateTime DateOfBirth { get; set; }
    public string Address { get; set; }
    public string Gender { get; set; }
    public string PatientId { get; set; }
}

public class Provider
{
    public string Name { get; set; }
    public string Address { get; set; }
    public string NPI { get; set; }
    public string TaxID { get; set; }
    public string RenderingProvider { get; set; }
}

public class Claim
{
    public string ControlNumber { get; set; }
    public DateTime ServiceFromDate { get; set; }
    public DateTime ServiceToDate { get; set; }
    public string TypeOfBill { get; set; }
    public string AdmissionType { get; set; }
    public string DischargeStatus { get; set; }
    public List<string> DiagnosisCodes { get; set; }
    public List<string> ProcedureCodes { get; set; }
}

public class Insurance
{
    public string PayerName { get; set; }
    public string PayerAddress { get; set; }
    public string PayerId { get; set; }
    public string SubscriberInformation { get; set; }
    public string SubscriberId { get; set; }
    public string CoordinationOfBenefitsData { get; set; }
}

public class ServiceLine
{
    public string RevenueCode { get; set; }
    public DateTime ServiceDate { get; set; }
    public int ServiceUnits { get; set; }
    public decimal ServiceCharges { get; set; }
    public List<string> ServiceModifiers { get; set; }
}


2. Identifying Microservices

Break down the monolithic process into smaller, logically separated services. Each microservice should represent a specific aspect of the reimbursement calculation, such as input validation, calculation logic, and output generation.  In many cases, a healthcare reimbursement system can involve multiple microservices working together to provide end-to-end functionality. Here are some microservices that might be part of a comprehensive healthcare reimbursement system: 

Microservices that might be part of a comprehensive healthcare reimbursement system

For demonstration purposes, I will provide a simplified implementation of the Reimbursement Calculation Service. It is assumed that patient information, procedure details, and fee schedule data are retrieved from their respective microservices and passed as inputs to this service, Reimbursement.web layer:

C#
 
using Microsoft.AspNetCore.Mvc;
using Reimbursement.Service;

namespace Reimbursement.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ReimbursementController : ControllerBase
    {
        private IReimbursementService _reimbursementService;

        public ReimbursementController(IReimbursementService reimbursementService)
        {
            _reimbursementService = reimbursementService;
        }

        [HttpPost("calculate")]
        public ActionResult<decimal> CalculateExpectedReimbursement(Patient patient, Procedure procedure, FeeSchedule feeSchedule)
        {
            try
            {
                decimal expectedReimbursement = _reimbursementService.CalculateExpectedReimbursement(patient, procedure, feeSchedule);

                return Ok(expectedReimbursement);
            }
            catch (Exception ex)
            {
                return StatusCode(500, $"Internal server error: {ex.Message}");
            }
        }
    }
}


Reimbursement service layer:

C#
 
using System;

namespace Reimbursement.Service
{
    public class ReimbursementService : IReimbursementService
    {
        public decimal CalculateExpectedReimbursement(Patient patient, Procedure procedure, FeeSchedule feeSchedule)
        {
            // Check if the patient and procedure exist
            if (patient == null || procedure == null)
            {
                throw new ArgumentNullException("Patient and Procedure must be provided.");
            }

            // Check if the feeSchedule exists
            if (feeSchedule == null)
            {
                throw new ArgumentNullException("FeeSchedule must be provided.");
            }

            // Calculate the expected reimbursement
            decimal expectedReimbursement = feeSchedule.Fee; // Basic reimbursement logic

            // You can add more complex reimbursement calculations here based on patient data and rules

            return expectedReimbursement;
        }
    }
}


The exact composition and architecture of microservices in a healthcare reimbursement system may vary based on the specific needs and scale of the application. The services listed above are examples of components that can be part of such a system, and they may interact with each other through APIs or message queues to perform end-to-end reimbursement processes.

3. Batch Processing in the Cloud

Adapt the overnight batch processing to the cloud environment. This could involve leveraging cloud-native services for scheduled tasks, ensuring that the process is reliable and scalable. CalculationService can also be triggered through the user interface manually in case users need to rerun for specific accounts only so that this service can be reused in places other than batch processing.

Conclusion

Migrating a complex, monolithic reimbursement calculation system to microservices and deploying it in the cloud is a transformative step. This approach not only modernizes the system but also brings significant benefits in terms of scalability, resource utilization, and cost savings, aligning the system with modern cloud capabilities and business objectives.

Legacy system Scalability microservice systems

Opinions expressed by DZone contributors are their own.

Related

  • Best Practices for Microservices: Building Scalable and Efficient Systems
  • Legacy Code Refactoring: Tips, Steps, and Best Practices
  • Designing and Maintaining Event-Driven Architectures
  • A Step-by-Step Guide to Write a System Design Document

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!