public void WriteV1File(GlobalData cGlobals) { string sFileName = cGlobals.sPracticeCode + "_Tribal_-_" + cGlobals.sExportType + "_Patients_1.csv"; StreamWriter fOutFile = new StreamWriter(cGlobals.sOutPath + sFileName); fOutFile.WriteLine(cGlobals.sV1HeaderLine); foreach (string sP in PatientData) { string[] sFields = sP.Split(','); string sOut; // Date of Birth sOut = cUtils.PrintFieldV1(Columns.IndexOf("DATE_OF_BIRTH"), sFields, "DATE"); // Sex sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("SEX"), sFields, "STRING"); // GP sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("GP"), sFields, "STRING"); // Usual GP sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("GP_USUAL"), sFields, "STRING"); // Registration Status sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("ACTIVE"), sFields, "STRING"); // Registration Date sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("REGISTERED_DATE"), sFields, "DATE"); // Removed Date sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("REMOVED_DATE"), sFields, "DATE"); // Postcode sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("POSTCODE"), sFields, "STRING"); // NHS Number sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("NHS_NUMBER"), sFields, "STRING"); // Patient ID -- USING NHS NUMBER AS PATIENT ID sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("NHS_NUMBER"), sFields, "STRING"); // Date of Death sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("DATE_OF_DEATH"), sFields, "DATE"); fOutFile.WriteLine(sOut); } fOutFile.Close(); }
public bool Save(GlobalData cGlobals) { string sFileName = cGlobals.sOutPath + cGlobals.sPracticeCode + "_" + String.Format("{0:yyyyMMdd}", cGlobals.dtQueryDate) + "_PATIENTS.csv"; return cUtils.SaveFileFromArrayList(sFileName, PatientData, Columns, cGlobals.bPseudonymise, cGlobals.iPseudoDateShift); }
public void WriteV1File(GlobalData cGlobals) { string sFileName = cGlobals.sPracticeCode + "_Tribal_-_" + cGlobals.sExportType + "_Encounters_1.csv"; StreamWriter fOutFile = new StreamWriter(cGlobals.sOutPath + sFileName); fOutFile.WriteLine(cGlobals.sV1HeaderLine); foreach (string sP in EncounterData) { string[] sFields = sP.Split(','); string sOut; // Patient ID (use NHS Number) sOut = cUtils.PrintFieldV1(Columns.IndexOf("NHS_NUMBER"), sFields, "STRING"); // Encounter Date sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("DATE"), sFields, "DATE"); // HCP sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("HCP"), sFields, "STRING"); // HCP Type sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("HCP_TYPE"), sFields, "HCPTYPE"); // Session sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("SESSION"), sFields, "STRING"); // Location sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("LOCATION"), sFields, "STRING"); fOutFile.WriteLine(sOut); } fOutFile.Close(); }
public void WriteV1File(GlobalData cGlobals) { string sFileName = cGlobals.sPracticeCode + "_Tribal_-_" + cGlobals.sExportType + "_Encounters_1.csv"; StreamWriter fOutFile = new StreamWriter(cGlobals.sOutPath + sFileName); fOutFile.WriteLine(cGlobals.sV1HeaderLine); foreach (string sP in encounters) { string[] sFields = sP.Split(','); string sOut; // Patient ID (use NHS Number) sOut = cUtils.PrintFieldV1(iNhsnumber, sFields, "STRING"); // Encounter Date sOut += "," + cUtils.PrintFieldV1(iDate, sFields, "DATE"); // HCP sOut += "," + cUtils.PrintFieldV1(iHcp, sFields, "STRING"); // HCP Type sOut += "," + cUtils.PrintFieldV1(iHcp_type, sFields, "HCPTYPE"); // Session sOut += "," + cUtils.PrintFieldV1(iSession, sFields, "STRING"); // Location sOut += "," + cUtils.PrintFieldV1(iLocation, sFields, "STRING"); fOutFile.WriteLine(sOut); } fOutFile.Close(); }
public bool Save(GlobalData cGlobals) { // Can't use the Save in utils because of the daft Apollo V1 structure we need bool bRet = true; string sFileName = cGlobals.sPracticeCode + "_" + String.Format("{0:yyyyMMdd}", cGlobals.dtQueryDate) + "_JOURNAL.csv"; StreamWriter fOutFile = new StreamWriter(cGlobals.sOutPath + sFileName); fOutFile.WriteLine(cUtils.PrintStringArray(Columns)); foreach (JournalEntry je in JournalData) { string[] sFields = je.Content.Split(','); if (sFields.Length != Columns.Count) { bRet = false; } string sRow = ""; foreach (string sAttributeName in Columns) { int pos = Columns.IndexOf(sAttributeName); if (pos != -1) { string sData; if (sAttributeName.IndexOf("DATE") != -1) sData = cUtils.CleanField(pos, sFields, "DATE"); else sData = cUtils.CleanField(pos, sFields, "STRING"); if (cGlobals.bPseudonymise) { sData = cUtils.Pseudomymise(sData, sAttributeName, cGlobals.iPseudoDateShift); } sData = cUtils.Quote(sData); if (sRow == "") sRow = sData; else sRow += "," + sData; } } fOutFile.WriteLine(sRow); } fOutFile.Close(); return bRet; }
public void WriteV1File(GlobalData cGlobals) { string sFileName = cGlobals.sPracticeCode + "_Tribal_-_" + cGlobals.sExportType + "_Events_1.csv"; StreamWriter fOutFile = new StreamWriter(cGlobals.sOutPath + sFileName); fOutFile.WriteLine(cGlobals.sV1HeaderLine); foreach (JournalEntry jEntry in JournalData) { string[] sFields = jEntry.Content.Split(','); string sOut; // Patient ID -- USING NHS NUMBER AS PATIENT ID sOut = cUtils.PrintFieldV1(Columns.IndexOf("NHS_NUMBER"), sFields, "STRING"); // Event Start Date sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("DATE"), sFields, "DATE"); // HCP sOut = sOut + "," + cUtils.PrintFieldV1(Columns.IndexOf("HCP"), sFields, "STRING"); // HCP Type sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("HCP_TYPE"), sFields, "STRING"); // Recorded Date (use event date) sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("DATE"), sFields, "DATE"); // Read Code sOut = sOut + "," + cUtils.PrintFieldV1(Columns.IndexOf("CODE"), sFields, "STRING"); // Value 1 sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("VALUE1"), sFields, "STRING"); // Value 2 sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("VALUE2"), sFields, "STRING"); // End Date (use event date) sOut += "," + cUtils.PrintFieldV1(Columns.IndexOf("DATE"), sFields, "DATE"); // Prescription Type - Empty sOut += ",\"\"" ; // Event Types if (jEntry.Type == "DRUGS") sOut += ",\"P\""; else { string sCode = cUtils.CleanString(sFields[Columns.IndexOf("CODE")]); if (sCode == "Ub0oo") sOut += ",\"S\""; else if (sCode == "22K..") sOut += ",\"M\""; else if (sCode == "X773t") sOut += ",\"B\""; else sOut += ",\"C\""; } fOutFile.WriteLine(sOut); } fOutFile.Close(); }