Skip to content

Repository files navigation

Claims Data Processor

Description

This is a simple console utility which helps to accumulate insurance statistics data for further processing. Console application reads input data from a comma-separated text file (.csv), and writes output data to a different comma-separated text file (*.csv).

Instructions

Below you can find some examples of how to run the application.

Run console application without 'process' command:

claims-processor.exe --input ./Examples/incremental_data_triangle.csv --output ./Examples/cumulative_data_triangle.csv

Run console application with 'process' command:

claims-processor.exe process --input ./Examples/incremental_data_triangle.csv --output ./Examples/cumulative_data_triangle.csv

Run console application with 'unsorted' argument to handle unsorted input data:

claims-processor.exe --input ./Examples/unsorted_incremental_data_triangle.csv --output ./Examples/cumulative_data_triangle.csv --unsorted

View help information:

claims-processor.exe --help

Implementation details

Console application is implemented in C# and .NET 8.0.

Algorithm

Both versions of data processing algorithm are implemented for the case when input data is sorted and not sorted. See implementations of the IClaimDataProcessor interface.

Best practices

Console application is implemented with the following best practices in mind:

Test Driven Development (TDD)

Unit tests are implemented for all testable functionality, such as data processing algorithm, validation of input data, etc. Integration tests represents tests for the main scenarios. According to testing pyramid, there are more unit tests than integration tests. Unit test and integration tests were implemented before the implementation of data processing algorithms. Unit tests and integration tests were run after each codebase change.

Single Responsibility Principle (SRP)

Each class represents only one responsibility, i.e. SimpleCsvReaderWriter is responsible only for reading and writing CSV files, SortedClaimDataProcessor is responsible only for processing claims data, etc.

Dependencies Inversion Principle (DIP)

High-level modules (such as ProcessClaimDataCommandHandler) do not depend on low-level modules (such as SimpleCsvReaderWriter), both depend on abstractions (interfaces).

Dependency Injection (DI)

All dependencies are injected through constructor, dependency injection framework is used in Program.Main entry point.

Open Source Libraries

Open source libraries are used in this project for non-core functionality, such as command-line parsing and CSV file handling. Data processing algorithm is implemented without use of any of these libraries.

Open source libraries used in this project include:

  • System.CommandLine (command-line parsing)
  • CsvHelper (CSV file read and write)
  • FluentValidation (validation of input data)
  • Microsoft.Extensions.DependencyInjection (dependency injection framework)
  • Microsoft.Extensions.Logging (logging library)
  • FluentAssertions
  • Moq (dependency mocking library)
  • NUnit (testing framework)

AI usage

AI agents were used for non-core functionality, i.e SimpleCsvReaderWriter was initially generated by AI agent. Data processing algorithm is implemented without any AI generated code.

Currently project contains both implementation for CSV files handling: SimpleCsvReaderWriter and CsvHelperReaderWriter. If CsvHelper open source project will be considered undesirable, CsvHelperReaderWriter can be removed from solution.

About

Test task for Lead Developer role in one company that specializes in providing analytics for insurance companies

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages