Exemplo n.º 1
0
        public void ParseFiles(string file, PatientStorage patients, ref List <StudyHeader> parsedHeaders, ref Export export, Dictionary <string, bool> launch)
        {
            headers.fileName = Path.GetFileNameWithoutExtension(file);
            using (var stream = File.OpenRead(file))
                using (var reader = new StreamReader(stream))
                {
                    string line;
                    string mainFlag = "none";
                    while ((line = reader.ReadLine()) != null)
                    {
                        Match match = Regex.Match(line, @"\[([^)]*)\]");
                        if (match.Success)
                        {
                            mainFlag = match.Groups[1].Value;
                            continue;
                        }
                        currentStorage = _setupStorage(mainFlag, line);

                        if (currentStorage != null)
                        {
                            currentStorage.AddElement(currentStorage.AdditionalInfo + line);
                        }
                    }
                }

            StudyHeader currentExperiment = headers.ParseElements(patients);

            currentExperiment.TryParseFileNameArray();
            parsedHeaders.Add(currentExperiment);
            if (launch["Preassures"])
            {
                export.DumpValues("Preassures", preassureMeasurements.ParseElements(currentExperiment));
            }
            if (launch["Butterfly Parameters"])
            {
                export.DumpValues("ButterflyParameters", butterflyParameters.ParseElements(currentExperiment));
            }
            if (launch["Other Preassures"])
            {
                export.DumpValues("OtherPreassures", otherPressures.ParseElements(currentExperiment));
            }
            if (launch["Parameters"])
            {
                export.DumpValues("DynamicParameters", parameters.ParseElements(currentExperiment));
            }
            if (launch["Force Overlays"])
            {
                export.DumpValues("ForceOverlays", forceOverlays.ParseElements(currentExperiment));
            }
            if (launch["Max Forces"])
            {
                export.DumpValues("MaxForces", maxForces.ParseElements(currentExperiment));
            }
            if (launch["Other Parameters"])
            {
                export.DumpValues("OtherDynamicParameters", otherParameters.ParseElements(currentExperiment));
            }
        }
Exemplo n.º 2
0
        //}
        private AbstractStorage _setupStorage(string mainFlag, string line)
        {
            switch (mainFlag)
            {
            case "Header":
                currentStorage = headers;
                break;

            case "COP averaged":
                currentStorage = COPAverages;
                break;

            case "COP, left track":
                currentStorage = COPTracks;
                currentStorage.AdditionalInfo = "Left, ";
                break;

            case "COP, both track":
                currentStorage = COPTracks;
                currentStorage.AdditionalInfo = "Both, ";
                break;

            case "":
                if (line.Contains("Left forefoot"))
                {
                    currentStorage = sideForces;
                    currentStorage.AdditionalInfo = "Left, Forefoot, ";
                }
                if (line.Contains("Left backfoot"))
                {
                    currentStorage = sideForces;
                    currentStorage.AdditionalInfo = "Left, Backfoot, ";
                }
                if (line.Contains("Right forefoot"))
                {
                    currentStorage = sideForces;
                    currentStorage.AdditionalInfo = "Right, Forefoot, ";
                }
                if (line.Contains("Right backfoot"))
                {
                    currentStorage = sideForces;
                    currentStorage.AdditionalInfo = "Right, Backfoot, ";
                }
                if (line.Contains("Parameters"))
                {
                    currentStorage = parameters;
                }
                break;

            default:
                currentStorage = null;
                break;
            }

            return(currentStorage);
        }
Exemplo n.º 3
0
        public CompressedAppendStorage(AbstractStorage appendStorage, AbstractStorage compressedStorage, AbstractStorage indexStorage,
                                       IMetricsSource metricsSource)
            : base(metricsSource)
        {
            _appendOnlyDataStorage = appendStorage;
            _compressedStorage     = compressedStorage;
            _indexAndHeaderStorage = indexStorage;

            IsAppendOnly = true;
        }
Exemplo n.º 4
0
        public RaxLogTable(AbstractStorageFactory factory)
        {
            _factory = factory;

            _tableHeaderStorage = factory.CreateStorage(FILE_TABLE_BIN);
            _logsStorage        = factory.CreateStorage(FILE_LOGS);
            _categoriesStorage  = factory.CreateStorage(FILE_CATEGORIES);
            _logsDataStorage    = factory.CreateStorage(FILE_LOGS_DATA, AbstractStorageFactory.Parameters.AppendOnlyStorage);

            _categoriesByName      = new Dictionary <string, CategoryInformation>();
            _categoriesByIndex     = new Dictionary <long, CategoryInformation>();
            _indexYearStorages     = new Dictionary <int, AbstractStorage>();
            _yearMinutesIndexCache = new Dictionary <int, RaxTimeIndexEntry[]>();

            if (_tableHeaderStorage.Exist())
            {
                OpenExistingTable();
            }
            else
            {
                CreateNewTable();
            }
        }
Exemplo n.º 5
0
        private AbstractStorage _setupStorage(string mainFlag, string line)
        {
            switch (mainFlag)
            {
            case "Header":
                currentStorage = headers;
                break;

            case "Left":
                if (line == "Force,N	  X,mm	   Y,mm")
                {
                    currentStorage = preassureMeasurements;
                    currentStorage.AdditionalInfo = "Left, ";
                    break;
                }
                if (line.Contains("force overlay"))
                {
                    currentStorage = forceOverlays;
                    currentStorage.AdditionalInfo = "Left, force overlay, ";
                    break;
                }
                if (currentStorage.AdditionalInfo.Contains("force overlay"))
                {
                    currentStorage.AdditionalInfo = _forceOverlayInfo("Left", overlayCriteria, line, currentStorage.AdditionalInfo);
                }
                break;

            case "Right":
                if (line == "Force,N	  X,mm	   Y,mm")
                {
                    currentStorage = preassureMeasurements;
                    currentStorage.AdditionalInfo = "Right, ";
                    break;
                }
                if (line.Contains("force overlay"))
                {
                    currentStorage = forceOverlays;
                    currentStorage.AdditionalInfo = "Right, force overlay, ";
                    break;
                }
                if (currentStorage.AdditionalInfo.Contains("force overlay"))
                {
                    currentStorage.AdditionalInfo = _forceOverlayInfo("Right", overlayCriteria, line, currentStorage.AdditionalInfo);
                }
                break;

            case "Butterfly":
                if (line == "Force,N	  X,mm	   Y,mm")
                {
                    currentStorage = preassureMeasurements;
                    currentStorage.AdditionalInfo = "Butterfly, ";
                    break;
                }
                if (line.Contains("force overlay"))
                {
                    currentStorage = forceOverlays;
                    currentStorage.AdditionalInfo = "Butterfly, force overlay, ";
                    break;
                }
                if (currentStorage.AdditionalInfo.Contains("force overlay"))
                {
                    currentStorage.AdditionalInfo = _forceOverlayInfo("Butterfly", overlayCriteria, line, currentStorage.AdditionalInfo);
                }
                break;

            case "Parameters":
                currentStorage = parameters;
                break;

            case "Butterfly Parameters":
                currentStorage = butterflyParameters;
                break;

            case "":

                if (line.Contains("max pressure") && !line.Contains("Signal"))
                {
                    foot           = line.Split(' ')[0];
                    type           = "max pressure";
                    currentStorage = otherPressures;
                }
                if (line.Contains("force") && !line.Contains("Signal") && !line.Contains("Max"))
                {
                    foot           = line.Split(' ')[0];
                    type           = "force";
                    currentStorage = otherPressures;
                }

                if (type == "max pressure" || type == "force")
                {
                    if (line == "Time, %\t Value, \t SD, ")
                    {
                        measure = "Measurement 1";
                    }
                    if (line == "Time, %\t Value, ")
                    {
                        measure = "Measurement 2";
                    }
                }
                if (Regex.IsMatch(line, @"(Max force \d)+"))
                {
                    currentStorage = maxForces;
                }

                if (otherParameters.OtherParameterHeaders.ContainsKey(line))
                {
                    currentStorage = otherParameters;
                    List <string> tempList = (otherParameters.OtherParameterHeaders[line]).Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    foot    = tempList[0];
                    type    = tempList[1];
                    measure = null;
                }
                if (line.Contains("Time change heel to forefoot"))
                {
                    currentStorage = otherParameters;
                    foot           = type = measure = null;
                }
                currentStorage.AdditionalInfo = foot + ", " + type + ", " + measure + ", ";
                break;

            default:
                currentStorage = null;
                break;
            }

            return(currentStorage);
        }