Esempio n. 1
0
        /// <summary>
        /// Parses the procedure
        /// </summary>
        /// <param name="line"> The line being parsed </param>
        /// <returns>BillableProcedure with information</returns>
        ///

        private BillableProcedure ParseProcedure(string line)
        {
            //Validate the line
            Match match = Regex.Match(line, BP_REGEX);

            //If the line is invalid
            if (!match.Success)
            {
                throw new ArgumentException("Invalid line '" + line + "'");
            }

            //Instantiate a new Billable Procedure
            BillableProcedure bp = new BillableProcedure();

            //Parse and store the information
            bp.year  = int.Parse(match.Groups["year"].Value);
            bp.month = int.Parse(match.Groups["month"].Value);
            bp.day   = int.Parse(match.Groups["day"].Value);

            bp.HCN  = match.Groups["hcn"].Value;
            bp.sex  = match.Groups["sex"].Value[0];
            bp.code = match.Groups["code"].Value;
            bp.fee  = match.Groups["fee"].Value;

            bp.response = match.Groups["resp"].Value;

            return(bp);
        }
Esempio n. 2
0
        /// <summary>
        /// Parses the data
        /// </summary>
        /// <param name="data"> string array of data </param>
        /// <param name="logger"> Logger used to log any errors or success messages </param>
        /// <returns>Dictionary with information</returns>
        ///

        private Dictionary <BillableProcedure, List <string> > ParseData(string[] data, Logging logger = null)
        {
            //Create a new dictionary
            Dictionary <BillableProcedure, List <string> > _data = new Dictionary <BillableProcedure, List <string> >();

            //Loop through each line in string array
            foreach (string line in data)
            {
                try
                {
                    //Parse the line
                    BillableProcedure bp = ParseProcedure(line);

                    //Create a list to store info
                    List <string> codes = _data.ContainsKey(bp) ? _data[bp] : new List <string>();

                    //Add the info to the list
                    codes.Add(bp.response);

                    //Save the list to dictionary
                    _data[bp] = codes;
                }

                //If an exception is thrown
                catch (ArgumentException e)
                {
                    logger?.Log(LoggingInfo.ErrorLevel.ERROR, e.Message);
                    continue;
                }
            }

            return(_data);
        }
Esempio n. 3
0
        /// <summary>
        /// Reinterperits the billable procedure table as a dictionary between
        /// a billable procedure (one per day:patient:code) and a list of the pks
        /// for each procedure which share the attributes.
        /// </summary>
        /// <param name="target_month">The current month</param>
        /// <returns>The dictionary.</returns>
        private Dictionary <BillableProcedure, List <int> > BillingDBAsDict(int target_month)
        {
            //Creates a new dictionary
            Dictionary <BillableProcedure, List <int> > dict = new Dictionary <BillableProcedure, List <int> >();

            //Loop through the keys
            foreach (object pk in procedures.Keys)
            {
                //Create a new billable procedure
                BillableProcedure bp = new BillableProcedure();

                //Save the aptid
                int aptid = (int)procedures[pk, "AppointmentID"];

                //Save the month
                int month = (int)appointments[aptid, "Month"];

                //If the month isnt the current month
                if (month != target_month)
                {
                    continue;
                }

                //Obtain all of the information needed
                bp.year  = CalendarManager.ConvertMonthToYear(ref month);
                bp.month = month;

                bp.day = (int)appointments[aptid, "Day"];

                bp.HCN = (string)people[appointments[aptid, "PatientID"], "HCN"];

                bp.code = (string)procedures[pk, "BillingCode"];

                bp.sex = people[appointments[aptid, "PatientID"], "sex"].ToString()[0];

                bp.fee = (string)billingMaster[bp.code, "DollarAmount"];

                //Create a list that will hold this information
                List <int> pks = dict.ContainsKey(bp) ? dict[bp] : new List <int>();

                //Add the information to the list
                pks.Add((int)pk);

                //Save the information into a dictionary
                dict[bp] = pks;
            }

            return(dict);
        }