/CsvParser

Primary LanguageC#GNU General Public License v3.0GPL-3.0

📃 CsvParser

An API app using asynchronous endpoints and data loaded from external files.


🔗 Table of contents

  1. Introduction
  2. Application Overview
    1. Technologies Used
    2. API Reference
  3. Pre-requisites
  4. Getting Started
    1. Application Setup
    2. Restore Dependencies
    3. Run Application
    4. Running Tests
    5. Main Entry Point

Introduction 👋

An API app designed to parse a CSV file and return records from different endpoints based on a pre-established set of criteria.

💻 Application Overview

The application consists of the following main components:

  • CSV Parser
  • Data Query

⚒️ Technologies Used

C# .NET 6 ASP.NET MVC 6 (Web API) EntityFramework Swagger


🔄 API Reference

Load data from CSV file

  POST /api/v1/parser
Usage ReturnType Description
Load all people data int Reads data from file and persists to database, returns count of rows loaded

Get all people

  GET /api/v1/people[action]
Action ReturnType Description
Get people with 'Esq' in Company Name List<Object> Returns a list of people who have the string 'Esq' in their company name

Get all people whose Company Name contains string 'Esq'

  GET /api/v1/people/[action]
Action ReturnType Description
Get people from Derbyshire List<Object> returns a list of people who live in county Derbyshire

Get all people where house number is three digits

  GET /api/v1/people/[action]
Action ReturnType Description
Get people whose house number is exactly 3 digits List<Object> returns a list of people whose house number is exactly 3 digits

Get all people whose web URL has more than 35 characters

  GET /api/v1/people/[action]
Action ReturnType Description
Get people whose website URL length is greater than 35 characters List<Object> returns a list of people whose URL length > 35

Get all people whose postcode contains only one digit after the city code, example SE2

  GET /api/v1/people/[action]
Action ReturnType Description
Get people who live in a postcode with a single digit value List<Object> returns list of people whose postcode contains one digit

Pre-requisites

  • C# / .NET 6
  • NuGet

🔀 Getting Started

Application Setup

Fork this repo to your Github and then clone the forked version of this repo.

  • Setup:
    • Open up project in Visual Studio
    • This application requires a path pointing to a csv file. By default the path is set to @"D:\Data\input.csv":
    • To use this application you will need to either specify a new file path or create a folder with a file in the default directory location - To change the filepath in the appliation, you will need to modify the path in the following files:

Restore Dependencies

  • Open up a terminal and navigate to the root folder of the main application directory CsvParser:
  • run: dotnet restore

Run Application

  • You can run the application in Visual Studio, or you can go to your terminal and inside the root of this directory, run:
  • run: dotnet run

Running the Unit Tests

  • You can run the unit tests in Visual Studio, or you can go to your terminal and inside the root of this directory, run:
    • dotnet test

Main Entry Point

  • The Main Entry Point for the application is: Program.cs

Thank you!! 👋