Just a quick update that I plan to try and get some more functionaltuy added to the the CSV File Reader utility, with another update this week with a designed XML file that describes the type expected in each column and an application which can create a XML settings file.
CSV is a comma separated values file, which allows data to be saved in a table structured format. CSVs look like a garden-variety spreadsheet but with a .csv extension (Traditionally they take the form of a text file containing information separated by commas, hence the name).
At work, when taking on a new client and integrating them into our Distribution systems, we mostly write import routines to take in data and process it into our back office file system. We mainly receive these as flat CSV files – because these are easy to work with. Lets face it, the better way would be to expose some public API endpoints and provide these to clients to push data in a temporary data store (then for us to post-process it into our back office). We don’t. In an ideal world we would, but we live in a world of ideals which involve providing lots of different flat files and writing some custom code each and every time, mainly because we don’t have the time to write a more modular and reusable application….until now.
I will explore in my own time, how best to create a CSV Reader system using C# and how to process a file and validate it. Because there is no defacto standard, I have chosen to work with RFC4180 for the default behaviour. I have just started this and the 1st version was pushed to github on Monday and can be found here:
I’m not going to explain all the code now as I would like to try a video tutorial at explaining each individual class, but the gist of it is in Bradaz.Utils.IO namespace includes:
- CSVRow – Represents a CSV File Row and tracks things like the row number and the original data. Also stores a collection of CSV Columns (CSVColumn).
- CSVColumn – Represents a CSV File Column and tracks thinks like the column and row number and the original data.
- CSVFile – This represents a CSV File itself with a collection of rows and a CSV File Reader (CSVReader) of buffered data.
- The project itself contains some example code on how to load a test file, validate it (simple validation currently) and display the contents. Currently I only load into a string to view it:
I next want to enchance the Parser based on a XML configuration file that will allow a user to specify things like how many columns should be in the file and what types to expect in those columns and convert to a usable object, no more strings! (Things like dates and integers). More to come!
I have been wanting to build my 1st MVC site for a while and always wanted to take the 8weekgame concept further and build it out into its own site. Well now I’m – I have completed the functional analysis and design and now in the process of mocking the HTML pages using a snazzy tool called CoffeeCup. I have decided to get the front end pages done first before moving onto designing and building the backend database (the model part of MVC).
The first protoype page is now up and will grow as the weeks come on. I have decided to use the CSS framework Metro UI CSS to rapidly develop the pages using Microsoft’s Modern UI design language. This is changing with the advent of Windows 10 and there is a new version (3.0) of the Metro UI Framework coming. Please note I will remain on version 2.0 until later on after golive and way up the pro’s and con’s in upgrading. The Mock can be found here:
I mentioned Phase 1 earlier. I’m splitting 2015 into two Phases and using Trello to help me organise this in a simple Scrumboard approach of Todo/Doing/Done. Again this can be found here:
I will of course keep this blog upto date on my progress.