Exemplo n.º 1
0
        private void createListsBTN_Click(object sender, EventArgs e)
        {
            disableUI();

            List <State> missingListChecks = new List <State>()
            {
                State.FILE_PATH_EMPTY,
                State.FILE_PATH_NOT_FOUND
            };
            List <State> folderChecks = new List <State>()
            {
                State.FOLDER_PATH_EMPTY,
                State.FOLDER_PATH_NOT_FOUND
            };

            State missingListState = StateChecks.performStateChecks(missingListChecks,
                                                                    missingListPathField.Text);
            State folderState   = StateChecks.performStateChecks(folderChecks, saveFileToPathField.Text);
            State checkBoxState = (checkedListBox1.CheckedItems.Count > 0) ? State.READY :
                                  State.CHECKBOX_NOT_CHECKED;

            if (missingListState != State.READY)
            {
                StateChecks.showErrorMessage(missingListState, missingListPathField.Text);
            }
            else if (folderState != State.READY)
            {
                StateChecks.showErrorMessage(folderState, saveFileToPathField.Text);
            }
            else if (checkBoxState != State.READY)
            {
                StateChecks.showErrorMessage(checkBoxState, null);
            }
            else
            {
                List <string> subListIDs = new List <string>();
                foreach (object checkedItem in checkedListBox1.CheckedItems)
                {
                    subListIDs.Add(checkedListBox1.GetItemText(checkedItem));
                }

                List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text);
                createLogFile(subLists);

                MessageBox.Show("Done!!");
            }

            enableUI();
        }
Exemplo n.º 2
0
        private void createListsBTN_Click(object sender, EventArgs e)
        {
            disableUI();

            List <State> missingListChecks = new List <State>()
            {
                State.FILE_PATH_EMPTY,
                State.FILE_PATH_NOT_FOUND
            };
            List <State> logFileChecks = new List <State>()
            {
                State.FILE_PATH_EMPTY,
                State.FILE_PATH_NOT_FOUND
            };
            List <State> folderChecks = new List <State>()
            {
                State.FOLDER_PATH_EMPTY,
                State.FOLDER_PATH_NOT_FOUND,
                State.FOLDER_HAS_NO_PDFS,
                State.BAD_FILE_NAME
            };
            State missingListState = StateChecks.performStateChecks(missingListChecks,
                                                                    missingListPathField.Text);
            State logFileState = StateChecks.performStateChecks(logFileChecks,
                                                                logFilePathField.Text);
            State folderState = StateChecks.performStateChecks(folderChecks,
                                                               folderPathField.Text);

            if (missingListState != State.READY)
            {
                StateChecks.showErrorMessage(missingListState, missingListPathField.Text);
            }
            else if (logFileState != State.READY)
            {
                StateChecks.showErrorMessage(logFileState, logFilePathField.Text);
            }
            else if (folderState != State.READY)
            {
                StateChecks.showErrorMessage(folderState, folderPathField.Text);
            }
            else
            {
                List <Dictionary <string, string> > tdnnList = new List <Dictionary <string, string> >();
                List <Dictionary <string, string> > vdList   = new List <Dictionary <string, string> >();
                string dos_mmddyyyy = null;
                LogReportOnDemand.ParseLogReportOnDemand(ref tdnnList,
                                                         ref vdList,
                                                         ref dos_mmddyyyy,
                                                         "CT",
                                                         logFilePathField.Text,
                                                         folderPathField.Text);

                // load each missing list section into a sublist struct
                // subListIDs here should be only log codes we want to send to coding
                List <string> subListIDs = new List <string>()
                {
                    "ME", "NN", "PM", "SG", "TD", "WR"
                };
                List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text);

                // loop through all files in folder and handle stragglers and BAD files
                List <Dictionary <string, string> > stragglerList = new List <Dictionary <string, string> >();
                List <string> nnList = new List <string>();
                foreach (string absolute_file_path in Directory.EnumerateFiles(folderPathField.Text, "*.pdf"))
                {
                    string fileName = Path.GetFileNameWithoutExtension(absolute_file_path);
                    if (fileName.Contains("BAD"))
                    {
                        string dest = DONT_NEEDS + fileName + ".pdf";
                        copyToDontNeeds(absolute_file_path, dest);

                        string sanitizedName = getSanitizedName(fileName);
                        nnList.Add(sanitizedName);
                    }
                    else
                    {
                        // go through each sub list
                        // if it is found, add patient info struct to straggler list
                        foreach (SubList subList in subLists)
                        {
                            if (subList.patientInfo.ContainsKey(fileName))
                            {
                                stragglerList.Add(subList.patientInfo[fileName]);
                            }
                        }
                    }
                }
                List <Dictionary <string, string> > sortedStragglerList = stragglerList.OrderBy(x => x["chartNum"])
                                                                          .ThenBy(x => Convert.ToDateTime(x["date"]))
                                                                          .ToList <Dictionary <string, string> >();

                bool accountability_list_created = AccountabilityLists.CreateAccountabilityLists(tdnnList,
                                                                                                 vdList,
                                                                                                 stragglerList,
                                                                                                 "CT",
                                                                                                 dos_mmddyyyy,
                                                                                                 folderPathField.Text);
                if (accountability_list_created)
                {
                    missingTotalLabel.Text = "Missing Total: " + tdnnList.Count;
                    int voidedChartsNotMissing = 0;
                    foreach (var patientInfo in vdList)
                    {
                        if (patientInfo["missing"] != "-")
                        {
                            voidedChartsNotMissing++;
                        }
                    }
                    voidedTotalLabel.Text     = "Voided Total: " + vdList.Count + " (" + voidedChartsNotMissing + ")";
                    stragglersTotalLabel.Text = "Straggler Total: " + stragglerList.Count;
                }
                else
                {
                    MessageBox.Show("The accountability list could not be created.\n\n" +
                                    "Either try again or create this list manually.");
                }

                removeNNFromMissingList(tdnnList, nnList);
                createUIPathList(tdnnList, stragglerList, nnList);

                MessageBox.Show("Lists created!!");
            }

            enableUI();
        }
Exemplo n.º 3
0
        private void createListsBTN_Click(object sender, EventArgs e)
        {
            disableUI();

            List <State> missingListChecks = new List <State>()
            {
                State.FILE_PATH_EMPTY,
                State.FILE_PATH_NOT_FOUND
            };
            List <State> logFileChecks = new List <State>()
            {
                State.FILE_PATH_EMPTY,
                State.FILE_PATH_NOT_FOUND
            };
            List <State> folderChecks = new List <State>()
            {
                State.FOLDER_PATH_EMPTY,
                State.FOLDER_PATH_NOT_FOUND
            };
            State missingListState = StateChecks.performStateChecks(missingListChecks,
                                                                    missingListPathField.Text);
            State logFileState = StateChecks.performStateChecks(logFileChecks,
                                                                logFilePathField.Text);
            State folderState = StateChecks.performStateChecks(folderChecks,
                                                               saveFileToPathField.Text);

            if (missingListState != State.READY)
            {
                StateChecks.showErrorMessage(missingListState, missingListPathField.Text);
            }
            else if (logFileState != State.READY)
            {
                StateChecks.showErrorMessage(logFileState, logFilePathField.Text);
            }
            else if (folderState != State.READY)
            {
                StateChecks.showErrorMessage(folderState, saveFileToPathField.Text);
            }
            else
            {
                List <Dictionary <string, string> > tdList = new List <Dictionary <string, string> >();
                List <Dictionary <string, string> > vdList = new List <Dictionary <string, string> >();
                string dos_mmddyyyy = null;
                LogReportOnDemand.ParseLogReportOnDemand(ref tdList,
                                                         ref vdList,
                                                         ref dos_mmddyyyy,
                                                         "GV",
                                                         logFilePathField.Text,
                                                         null);

                List <string> subListIDs = new List <string>()
                {
                    "ME", "PM", "SG", "TD", "WR"
                };
                List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text);
                List <Dictionary <string, string> > stragglerList = createStragglerList(subLists);

                bool accountability_list_created = AccountabilityLists.CreateAccountabilityLists(tdList,
                                                                                                 vdList,
                                                                                                 stragglerList,
                                                                                                 "GV",
                                                                                                 dos_mmddyyyy,
                                                                                                 saveFileToPathField.Text);

                if (accountability_list_created)
                {
                    // missing list file to be used in UiPath
                    if (stragglerList.Count > 0)
                    {
                        createTextFile(stragglerList);
                    }

                    // output number on each list
                    missingTotalLabel.Text    = "Missing Total: " + tdList.Count;
                    voidedTotalLabel.Text     = "Voided Total: " + vdList.Count;
                    stragglersTotalLabel.Text = "Straggler Total: " + stragglerList.Count;

                    MessageBox.Show("Lists created!!");
                }
                else
                {
                    MessageBox.Show("An error occurred so the lists were not created and the missing list was not updated. Try again.");
                }
            }

            enableUI();
        }
        private void renameFilesBTN_Click(object sender, EventArgs e)
        {
            disableUI();

            const string renameMessage = "Before running this program make sure you have separated all of the straggler files into your selected folder.\n\n" +
                                         "If the charts for your day are also in this folder it will rename all of them, which you don't want.\n\n" +
                                         "Are you sure you are ready to continue?";
            DialogResult renameWarning = MessageBox.Show(renameMessage, "Warning", MessageBoxButtons.YesNo);

            if (renameWarning == DialogResult.Yes)
            {
                // check state of missing list and files in folder
                List <State> missingListChecks = new List <State>()
                {
                    State.FILE_PATH_EMPTY,
                    State.FILE_PATH_NOT_FOUND
                };
                List <State> folderChecks = new List <State>()
                {
                    State.FOLDER_PATH_EMPTY,
                    State.FOLDER_PATH_NOT_FOUND,
                    State.FOLDER_HAS_NO_PDFS,
                    State.BAD_FILE_NAME
                };
                State missingListState = StateChecks.performStateChecks(missingListChecks,
                                                                        missingListPathField.Text);
                State folderState = StateChecks.performStateChecks(folderChecks,
                                                                   folderPathField.Text);
                if (missingListState != State.READY)
                {
                    StateChecks.showErrorMessage(missingListState, missingListPathField.Text);
                }
                else if (folderState != State.READY)
                {
                    StateChecks.showErrorMessage(folderState, folderPathField.Text);
                }
                else
                {
                    // subListIDs here should be ALL codes that we track on the missing list
                    List <string> subListIDs = new List <string>()
                    {
                        "ME", "NN", "PM", "SC", "SG", "WR", "TD"
                    };
                    List <SubList> subLists = MissingList.createSubLists(subListIDs, missingListPathField.Text);

                    // grab TD list for checking "- BAD" files
                    SubList tdList = null;
                    foreach (SubList sub in subLists)
                    {
                        if (sub.name == "TD")
                        {
                            tdList = sub;
                            break;
                        }
                    }

                    // loop through files in straggler folder
                    // if "- BAD", copy to DONT NEEDS and look up on TD list
                    // else, search for fileName on missing list (each sub list)
                    List <string> nnList = new List <string>();
                    foreach (string file in Directory.EnumerateFiles(folderPathField.Text, "*.pdf"))
                    {
                        string fileName = Path.GetFileNameWithoutExtension(file);
                        if (fileName.Contains("BAD"))
                        {
                            string dest = DONT_NEEDS + fileName + ".pdf";
                            copyToDontNeeds(file, dest);

                            // SEARCH ON TD LIST
                            string sanitizedName = getSanitizedName(fileName);
                            if (tdList.patientInfo.ContainsKey(sanitizedName))
                            {
                                nnList.Add(sanitizedName);
                            }

                            appendToFileName("not on list", file);
                        }
                        else
                        {
                            string listContainingChart = searchSubLists(subLists, fileName);
                            if (listContainingChart == null)
                            {
                                string dest = DONT_NEEDS + fileName + ".pdf";
                                copyToDontNeeds(file, dest);
                            }
                            renameFile(listContainingChart, file);
                        }
                    }

                    // Create UiPath file to modify "- BAD" files to NN
                    if (nnList.Count > 0)
                    {
                        createUIPathFile(nnList);
                        MessageBox.Show("There were " + nnList.Count.ToString() +
                                        " - BAD files to modify to NN.\r\n\r\n" +
                                        "Make sure to modify these charts!\r\n\r\n" +
                                        "The list should be at the bottom of this folder!\r\n\r\n");
                    }

                    MessageBox.Show("Rename complete!!");
                }
            }
            enableUI();
        }