I am looking for some suggestions on the best approaches to script processing when reading a file in C #; a specific scenario is something that most people will not know if you are not involved in healthcare, so I will give a brief explanation first.
I am working on a health plan and we receive complaints from doctors in several ways (EDI, paper, etc.). The paper form for standard medical claims is the “HCFA” or “CMS 1500” form. Some of our contract doctors use software that allows you to create and save your claims in the HCFA "layout", but in a text file (so you can think of it as a paper form, but without background / boxes, etc.) . I attached an image of a fictitious claims file that shows how it will look.
Claim information is currently extracted from text files and converted to XML. The whole process is working fine, but I would like to make it better and easier to maintain. There is one serious problem that relates to the scenario: each doctor’s office can send these text files to us in several different layouts. Meaning, Doctor A may have the name of the patient on line 10 starting with character 3, while Doctor B may send a file where the name begins on line 11 on character 4, etc. Yes, what we have to do is follow the standard layout, which any doctor who wants to present in this way must follow. However, the management stated that we (the developers) should handle the various possibilities ourselves and that we cannot ask them to do something special, since they want to maintain good relations.
There is currently a “mapping table” set up with one row for each different doctor’s office. The table shows the columns for each field (for example, patient name, participant ID, date of birth, etc.). Each of them receives a value based on the first file that we received from the doctor (we manually set the map). Thus, the PATIENT_NAME column can be defined in the mapping table as "10.3.25", which means that the name starts on line 10 with character 3 and can contain up to 25 characters. It was a painful process, from the point of view of (a) creating a map for each doctor - it is tiring, and (b) maintainability, as they sometimes suddenly change their layout, and then we have to reassign all this for this doctor.
The file is read sequentially, the line is added to
List<string>
As soon as this is done, we will do the following: we will get the map data and read the list of lines in the file and get the field values (recall that each displayed field is a value similar to "10.3.25" (without quotes)):
ClaimMap M = ClaimMap.GetMapForDoctor(17); List<HCFA_Claim> ClaimSet = new List<HCFA_Claim>(); foreach (List<string> cl in Claims) //Claims is List<List<string>>, where we have a List<string> for each claim in the text file (it can have more than one, and the file is split up into separate claims earlier in the process) { HCFA_Claim c = new HCFA_Claim(); c.Patient = new Patient(); c.Patient.FullName = cl[Int32.Parse(M.Name.Split(',')[0]) - 1].Substring(Int32.Parse(M.Name.Split(',')[1]) - 1, Int32.Parse(M.Name.Split(',')[2])).Trim(); //...and so on... ClaimSet.Add(c); }
Sorry it took so long ... but I felt some background / explanation was needed. Are there any better / more creative ways to do something like this?