public KamaAcquisitionFile(string filename, AcquisitionInterface acquisitionInterface, ILogger logger,
                                   int eitDefaultChunkSize = 24000, int ecgDefaultChunkSize = 10)
        {
            FileName            = filename;
            Logger              = logger;
            EITDefaultChunkSize = eitDefaultChunkSize;
            ECGDefaultChunkSize = ecgDefaultChunkSize;

            RecordNumber = 1;
            H5E.set_auto(H5E.DEFAULT, null, IntPtr.Zero);
            fileId               = Hdf5.CreateFile(filename);
            groupRoot            = fileId;
            groupEIT             = Hdf5.CreateOrOpenGroup(groupRoot, "eit");
            ProcedureInformation = new ProcedureInformation(fileId, groupRoot, logger)
            {
                ProcedureDirectory = Path.GetDirectoryName(filename),
                StartDateTime      = DateTime.Now,
                EndDateTime        = DateTime.Now
            };

            SystemInformation            = new SystemInformation(fileId, groupRoot, logger);
            SystemInformation.SystemType = acquisitionInterface.ToString();
            //  InjectionGroup = new InjectionGroup(fileId, groupRoot);
            CalibrationGroup = new CalibrationGroup(fileId, groupRoot, logger);
            SystemEvents     = new SystemEventGroup(fileId, groupRoot, logger);
            RPosition        = new RPositionGroup(fileId, groupRoot, logger);
            Tags             = new TagsGroup(fileId, groupRoot, logger);
            UserEventsGroup  = new UserEventsGroup(fileId, groupRoot, logger);
        }
 public KamaAcquisitionReadOnlyFile(string filename)
 {
     FileName             = filename;
     ProcedureInformation = new ProcedureInformation();
     SystemInformation    = new SystemInformation();
     PatientInformation   = new Patient();
     ECG    = new ECGData();
     EITs   = new List <EITEntry>();
     Events = new List <SystemEvent>();
     Hdf5.Settings.LowerCaseNaming = true;
     Hdf5.Settings.DateTimeType    = DateTimeType.UnixTimeMilliseconds;
     fileId = Hdf5.OpenFile(filename);
 }
示例#3
0
        public bool Validate(ProcedureInformation info)
        {
            if (_notice.Type != NoticeType.Contract)
            {
                return(true);
            }

            var canAccelerateTypes = new[]
            { ProcedureType.ProctypeOpen, ProcedureType.ProctypeRestricted, ProcedureType.ProctypeCompNegotiation };

            return(ValidateAll(Valid(info != null, $"ProcedureInformation"),
                               Valid(info != null && info.ProcedureType != ProcedureType.Undefined, "ProcedureInformation.ProcedureType"),
                               Valid(info != null && (!info.AcceleratedProcedure || canAccelerateTypes.Contains(info?.ProcedureType ?? ProcedureType.Undefined) && (info?.JustificationForAcceleratedProcedure).HasAnyContent()), "ProcedureInformation.AcceleratedProcedure + JustificationForAcceleratedProcedure"),
                               Validate(info.FrameworkAgreement, info)
                               ));
        }
        private async Task CloseHandles()
        {
            ProcedureInformation.FlushDataAndCloseObject();
            SystemInformation.FlushDataAndCloseObject();
            CalibrationGroup.FlushDataAndCloseObject();
            //wait for writing all data before resetting
            if (EIT != null)
            {
                await EIT.WaitForDataWritten();

                EIT.Dispose();
            }

            if (ECG != null)
            {
                await ECG.WaitForDataWritten();

                ECG.Dispose();
            }
            if (SystemEvents != null)
            {
                await SystemEvents.WaitForDataWritten();

                SystemEvents.Dispose();
            }

            if (RPosition != null)
            {
                await RPosition.WaitForDataWritten();

                RPosition.Dispose();
            }
            if (Tags != null)
            {
                await Tags.WaitForDataWritten();

                Tags.Dispose();
            }
            if (UserEventsGroup != null)
            {
                await UserEventsGroup.WaitForDataWritten();

                UserEventsGroup.Dispose();
            }
            await Task.CompletedTask;
        }
示例#5
0
        public bool Validate(FrameworkAgreementInformation frameworkAgreement, ProcedureInformation procedure)
        {
            if (_notice.Type != NoticeType.Contract)
            {
                return(true);
            }

            return(ValidateAll(
                       Valid(frameworkAgreement != null, "FrameworkAgreement null"),
                       Valid(!(frameworkAgreement?.IncludesDynamicPurchasingSystem ?? true) ||
                             procedure.ProcedureType == ProcedureType.ProctypeRestricted,
                             "Procedure type must be rescricted when IncludesDynamicPurchasingSystem"),
                       Valid(!(frameworkAgreement?.IncludesDynamicPurchasingSystem ?? true) ||
                             _notice.Project.CentralPurchasing || !frameworkAgreement.DynamicPurchasingSystemInvolvesAdditionalPurchasers,
                             "DynamicPurchasingSystemInvolvesAdditionalPurchasers cannot be selected when Project.CentralPurchasing is not set")


                       ));
        }