예제 #1
0
        /// <summary>
        /// Returns true if Thing instances are equal
        /// </summary>
        /// <param name="other">Instance of Thing to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ExportCsv other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ObservationType == other.ObservationType ||
                     ObservationType != null &&
                     ObservationType.Equals(other.ObservationType)
                     ) &&
                 (
                     ThingId == other.ThingId ||
                     ThingId != null &&
                     ThingId.Equals(other.ThingId)
                 ) &&
                 (
                     EndTime == other.EndTime ||
                     EndTime != null &&
                     EndTime.Equals(other.EndTime)
                 ) &&
                 (
                     StartTime == other.StartTime ||
                     StartTime != null &&
                     StartTime.Equals(other.StartTime)
                 ));
        }
예제 #2
0
 public static ObservationType GetObservationTypeByID(int id)
 {
     ObservationType observationType = new ObservationType();
     SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();
     observationType = sqlObservationTypeProvider.GetObservationTypeByID(id);
     return observationType;
 }
예제 #3
0
        /// <summary>
        /// 解析字符串
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        static public ObservationCode Parse(string str)
        {
            ObservationType type = ObservationTypeHelper.RinexCodeToObservationType(str);
            //(ObservationType)Enum.Parse(typeof(ObservationType), str.Substring(0, 1), true);
            int    band      = int.Parse(str.Trim().Substring(1, 1));
            string attribute = null;

            //三个则直接提取
            if (str.Length > 2)
            {
                attribute = str.Substring(2, 1);
            }
            else if (type == ObservationType.C)//否则转换P1,P2为C1X,C2W
            {
                var fisrtChar = str.Trim().Substring(0, 1);
                if (fisrtChar == "P")
                {
                    attribute = "W";
                }
                else
                {
                    attribute = "C";
                }
            }

            return(new ObservationCode(type, band, attribute));
        }
예제 #4
0
        internal VitalSign buildVitalSign(IDataReader reader)
        {
            SiteId facility = new SiteId()
            {
                Id   = DbReaderUtil.getInt16Value(reader, reader.GetOrdinal("Sta3n")),
                Name = DbReaderUtil.getValue(reader, reader.GetOrdinal("Location"))
            };

            string          id        = DbReaderUtil.getInt64Value(reader, reader.GetOrdinal("VitalSignSID"));
            string          dateTaken = DbReaderUtil.getDateTimeValue(reader, reader.GetOrdinal("VitalSignTakenDateTime"));
            string          vitalType = DbReaderUtil.getValue(reader, reader.GetOrdinal("VitalType"));
            string          typeId    = DbReaderUtil.getInt32Value(reader, reader.GetOrdinal("VitalTypeSID"));
            ObservationType type      = new ObservationType(typeId, VitalSign.VITAL_SIGN, vitalType);

            VitalSign vitalSign = new VitalSign()
            {
                Id        = id,
                Facility  = facility,
                Type      = type,
                Value1    = DbReaderUtil.getValue(reader, reader.GetOrdinal("Result")),
                Timestamp = dateTaken
            };

            return(vitalSign);
        }
예제 #5
0
        public override int GetHashCode()
        {
            int hash = 1;

            hash ^= shape_.GetHashCode();
            if (CompressionType != 0)
            {
                hash ^= CompressionType.GetHashCode();
            }
            if (observationDataCase_ == ObservationDataOneofCase.CompressedData)
            {
                hash ^= CompressedData.GetHashCode();
            }
            if (observationDataCase_ == ObservationDataOneofCase.FloatData)
            {
                hash ^= FloatData.GetHashCode();
            }
            hash ^= compressedChannelMapping_.GetHashCode();
            hash ^= dimensionProperties_.GetHashCode();
            if (ObservationType != 0)
            {
                hash ^= ObservationType.GetHashCode();
            }
            hash ^= (int)observationDataCase_;
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #6
0
 public FolderObserver(DirectoryInfo observedFolder,
                       ObservationType observationType = ObservationType.FoldersNonRecursive | ObservationType.FilesRecursive)
 {
     _observationType = observationType;
     _observedFolder  = observedFolder;
     _timer           = new Timer(TimerElapsed, null, 0, 5000);
 }
예제 #7
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (ObservationType != null)
                {
                    hashCode = hashCode * 59 + ObservationType.GetHashCode();
                }
                if (ThingId != null)
                {
                    hashCode = hashCode * 59 + ThingId.GetHashCode();
                }
                if (StartTime != null)
                {
                    hashCode = hashCode * 59 + StartTime.GetHashCode();
                }
                if (EndTime != null)
                {
                    hashCode = hashCode * 59 + EndTime.GetHashCode();
                }

                return(hashCode);
            }
        }
예제 #8
0
    private void showObservationTypeData()
    {
        ObservationType observationType = new ObservationType();

        observationType = ObservationTypeManager.GetObservationTypeByID(Int32.Parse(Request.QueryString["observationTypeID"]));

        txtObservationTypeName.Text = observationType.ObservationTypeName;
    }
예제 #9
0
    public static ObservationType GetObservationTypeByID(int id)
    {
        ObservationType            observationType            = new ObservationType();
        SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();

        observationType = sqlObservationTypeProvider.GetObservationTypeByID(id);
        return(observationType);
    }
예제 #10
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        ObservationType observationType = new ObservationType();

        observationType.ObservationTypeName = txtObservationTypeName.Text;
        int resutl = ObservationTypeManager.InsertObservationType(observationType);

        Response.Redirect("AdminObservationTypeDisplay.aspx");
    }
        nuint Observe(ObservationType observationType, Action <ObservationType, T> handler)
        {
            var observerHandle = _dbGroupNode.ObserveEvent(
                GetDataEventTypeFromObservationType(observationType),
                (snapshot, prevKey) =>
                HandleObserveChildEvent(snapshot, prevKey, observationType, handler));

            return(observerHandle);
        }
 /// <summary>
 /// Initializes a new instance of the Observation class.
 /// </summary>
 /// <param name="obsId">integer type obsId parameter</param>
 /// <param name="visitId">integer type visitId parameter</param>
 /// <param name="specie">Specie type specie parameter</param>
 /// <param name="obsType">ObservationType type obsType parameter</param>
 /// <param name="amount">integer type amount parameter</param>
 /// <param name="xcor">integer type xCor parameter</param>
 /// <param name="ycor">integer type yCor parameter</param>
 public Observation(int obsId, int visitId, Specie specie, ObservationType obsType, int amount, int xcor, int ycor)
 {
     ObsId = obsId;
     VisitId = visitId;
     Specie = specie;
     ObsType = obsType;
     Amount = amount;
     XCor = xcor;
     YCor = ycor;
 }
예제 #13
0
        /// <summary>
        /// 构造函数。创建一个观测组合类型。
        /// </summary>
        /// <param name="observationType">观测值类型</param>
        /// <param name="bandOrFrequency">波段或频率</param>
        /// <param name="attribute">属性</param>
        public ObservationCode(ObservationType observationType, int bandOrFrequency, string attribute = null)
        {
            this.ObservationType = observationType;
            this.BandOrFrequency = bandOrFrequency;
            if (String.IsNullOrWhiteSpace(attribute))
            {
                attribute = "C";
            }

            this.Attribute = attribute;
        }
        void HandleObserveChildEvent(DataSnapshot snapshot, string prevKey, ObservationType observationType, Action <ObservationType, T> handleChildEvent, params string[] excludeIds)
        {
            _logger.Debug($"Event: {observationType}, prevKey: {prevKey}");

            var nsDictionary = snapshot.ValueInExportFormat as NSDictionary;
            var obj          = Encoder.DecodeObject <T>(nsDictionary);

            if (!excludeIds.Contains(obj.Id))
            {
                handleChildEvent(observationType, obj);
            }
        }
예제 #15
0
    public bool UpdateObservationType(ObservationType observationType)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_UpdateObservationType", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ObservationTypeID", SqlDbType.Int).Value        = observationType.ObservationTypeID;
            cmd.Parameters.Add("@ObservationTypeName", SqlDbType.NVarChar).Value = observationType.ObservationTypeName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return(result == 1);
        }
    }
예제 #16
0
 public ObservationTypeTO(ObservationType mdo)
 {
     if (mdo == null)
     {
         return;
     }
     this.id        = mdo.Id;
     this.name      = mdo.Name;
     this.category  = mdo.Category;
     this.shortName = mdo.ShortName;
     this.dataId    = mdo.DataId;
     this.dataName  = mdo.DataName;
     this.dataType  = mdo.DataType;
 }
예제 #17
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        ObservationType observationType = new ObservationType();

        observationType = ObservationTypeManager.GetObservationTypeByID(Int32.Parse(Request.QueryString["observationTypeID"]));
        ObservationType tempObservationType = new ObservationType();

        tempObservationType.ObservationTypeID = observationType.ObservationTypeID;

        tempObservationType.ObservationTypeName = txtObservationTypeName.Text;
        bool result = ObservationTypeManager.UpdateObservationType(tempObservationType);

        Response.Redirect("AdminObservationTypeDisplay.aspx");
    }
예제 #18
0
    public int InsertObservationType(ObservationType observationType)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_InsertObservationType", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ObservationTypeID", SqlDbType.Int).Direction    = ParameterDirection.Output;
            cmd.Parameters.Add("@ObservationTypeName", SqlDbType.NVarChar).Value = observationType.ObservationTypeName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return((int)cmd.Parameters["@ObservationTypeID"].Value);
        }
    }
예제 #19
0
        /// <summary>
        /// Initializes the sensor.
        /// </summary>
        /// <param name="observationSize">Number of vector observations.</param>
        /// <param name="name">Name of the sensor.</param>
        public VectorSensor(int observationSize, string name = null, ObservationType observationType = ObservationType.Default)
        {
            if (string.IsNullOrEmpty(name))
            {
                name = $"VectorSensor_size{observationSize}";
                if (observationType != ObservationType.Default)
                {
                    name += $"_{observationType.ToString()}";
                }
            }

            m_Observations    = new List <float>(observationSize);
            m_Name            = name;
            m_ObservationSpec = ObservationSpec.Vector(observationSize, observationType);
        }
        nuint ObserveAfterId(ObservationType observationType, string afterId, Action <ObservationType, T> handler)
        {
            var query = _dbGroupNode.GetQueryOrderedByKey();

            // If afterId provided, start observing from this id
            if (!string.IsNullOrEmpty(afterId))
            {
                query = query.GetQueryStartingAtValue(new NSString(afterId));
            }

            var observerHandle = query.ObserveEvent(
                GetDataEventTypeFromObservationType(observationType), (snapshot, prevKey) =>
                HandleObserveChildEvent(snapshot, prevKey, observationType, handler, afterId));

            return(observerHandle);
        }
예제 #21
0
 public ObservationType GetObservationTypeFromReader(IDataReader reader)
 {
     try
     {
         ObservationType observationType = new ObservationType
                                           (
             (int)reader["ObservationTypeID"],
             reader["ObservationTypeName"].ToString()
                                           );
         return(observationType);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
예제 #22
0
 public ObservationType GetObservationTypeFromReader(IDataReader reader)
 {
     try
     {
         ObservationType observationType = new ObservationType
             (
                 (int)reader["ObservationTypeID"],
                 reader["ObservationTypeName"].ToString()
             );
          return observationType;
     }
     catch(Exception ex)
     {
         return null;
     }
 }
        DataEventType GetDataEventTypeFromObservationType(ObservationType observationType)
        {
            switch (observationType)
            {
            case ObservationType.ChildAdded:
                return(DataEventType.ChildAdded);

            case ObservationType.ChildChanged:
                return(DataEventType.ChildChanged);

            case ObservationType.ChildRemoved:
                return(DataEventType.ChildRemoved);

            default:
                throw new NotImplementedException();
            }
        }
예제 #24
0
        /// <summary>
        /// Constructs a <see cref="MovingAverage"/> instance with a set
        /// length of "7" elements.
        /// </summary>
        /// <param name="setLength">
        /// The max number of elements to allow in the Set.
        /// </param>
        public ObservedValue(
            ObservationType observationType,
            object syncRoot = null)
        {
            _observationType = observationType;
            switch (_observationType)
            {
            case ObservationType.Minimum:
                _value = long.MaxValue;
                break;

            case ObservationType.Maximum:
                _value = long.MinValue;
                break;
            }
            _lock = syncRoot ?? new object();
        }
예제 #25
0
        /// <summary>
        /// Creates a <see cref="GridSensor"/> instance.
        /// </summary>
        /// <param name="buffer">The <see cref="GridBuffer"/> instance to wrap</param>
        /// <param name="compressionType">The <see cref="SensorCompressionType"/>
        /// to apply to the generated image</param>
        /// <param name="observationType">The <see cref="ObservationType"/>
        /// (default or goal signal) of the sensor</param>
        /// <param name="name">Name of the sensor</param>
        public GridSensor(
            string name,
            GridBuffer buffer,
            SensorCompressionType compressionType,
            ObservationType observationType)
        {
            m_Name = name;

            buffer.GetShape().Validate();
            m_GridBuffer = buffer;

            m_CompressionType = compressionType;
            HandleCompressionType();

            m_ObservationSpec = ObservationSpec.Visual(
                m_GridBuffer.Height, m_GridBuffer.Width, m_GridBuffer.NumChannels, observationType);
        }
        static AddObservationDto CreateObservation(ObservationType type, ResidentDto resident, int i)
        {
            switch (type)
            {
            case ObservationType.BloodPressure:
                return(new AddObservationDto
                {
                    ResidentId = resident.ResidentId,
                    Type = ObservationType.BloodPressure,
                    RecordedDate = DateTime.Now.AddDays(i * -1),
                    DiastolicValue = GetRandomNumber(80, 140),
                    SystolicValue = GetRandomNumber(80, 140),
                    Unit = "mmHg"
                });

            case ObservationType.HeartRate:
                return(new AddObservationDto
                {
                    ResidentId = resident.ResidentId,
                    Type = ObservationType.HeartRate,
                    RecordedDate = DateTime.Now.AddDays(i * -1),
                    Value = Math.Round(GetRandomNumber(60.0, 120.0), 2),
                    Unit = "bpm"
                });

            case ObservationType.Temperature:
                return(new AddObservationDto
                {
                    ResidentId = resident.ResidentId,
                    Type = ObservationType.Temperature,
                    RecordedDate = DateTime.Now.AddDays(i * -1),
                    Value = Math.Round(GetRandomNumber(36.0, 38.0), 2),
                    Unit = "°C"
                });
            }

            return(null);
        }
예제 #27
0
 public static int InsertObservationType(ObservationType observationType)
 {
     SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();
     return sqlObservationTypeProvider.InsertObservationType(observationType);
 }
예제 #28
0
        internal VitalSign[] toLatestVitalSigns(string response)
        {
            if (!cxn.IsConnected)
            {
                throw new NotConnectedException();
            }

            if (response == "")
            {
                return null;
            }
            string[] lines = StringUtils.split(response, StringUtils.CRLF);
            ArrayList lst = new ArrayList(lines.Length);
            string category = "Vital Signs";
            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i] == "")
                {
                    continue;
                }
                string[] flds = StringUtils.split(lines[i], StringUtils.CARET);
                ObservationType observationType = null;
                if (flds[1] == "T")
                {
                    observationType = new ObservationType(flds[0], category, "Temperature");
                }
                else if (flds[1] == "P")
                {
                    observationType = new ObservationType(flds[0], category, "Pulse");
                }
                else if (flds[1] == "R")
                {
                    observationType = new ObservationType(flds[0], category, "Respiration");
                }
                else if (flds[1] == "BP")
                {
                    observationType = new ObservationType(flds[0], category, "Blood Pressure");
                }
                else if (flds[1] == "HT")
                {
                    observationType = new ObservationType(flds[0], category, "Height");
                }
                else if (flds[1] == "WT")
                {
                    observationType = new ObservationType(flds[0], category, "Weight");
                }
                else if (flds[1] == "PN")
                {
                    observationType = new ObservationType(flds[0], category, "Pain");
                }
                if (observationType == null)
                {
                    continue;
                }
                VitalSign observation = new VitalSign();
                observation.Type = observationType;
                observation.Value1 = flds[4];
                if (flds.Length == 6)
                {
                    observation.Value2 = flds[5];
                }
                observation.Timestamp = VistaTimestamp.toUtcString(flds[3]);
                lst.Add(observation);
            }
            return (VitalSign[])lst.ToArray(typeof(VitalSign));
        }
예제 #29
0
        /// <summary>
        /// Creates and returns the camera sensor.
        /// </summary>
        /// <param name="camera">Camera object to capture images from.</param>
        /// <param name="width">The width of the generated visual observation.</param>
        /// <param name="height">The height of the generated visual observation.</param>
        /// <param name="grayscale">Whether to convert the generated image to grayscale or keep color.</param>
        /// <param name="name">The name of the camera sensor.</param>
        /// <param name="compression">The compression to apply to the generated image.</param>
        /// <param name="observationType">The type of observation.</param>
        public CameraSensor(
            Camera camera, int width, int height, bool grayscale, string name, SensorCompressionType compression, ObservationType observationType = ObservationType.Default)
        {
            m_Camera    = camera;
            m_Width     = width;
            m_Height    = height;
            m_Grayscale = grayscale;
            m_Name      = name;
            var channels = grayscale ? 1 : 3;

            m_ObservationSpec = ObservationSpec.Visual(height, width, channels, observationType);
            m_CompressionType = compression;
        }
예제 #30
0
    public static int InsertObservationType(ObservationType observationType)
    {
        SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();

        return(sqlObservationTypeProvider.InsertObservationType(observationType));
    }
예제 #31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Observation"/> class.
 /// </summary>
 /// <param name="value">The value to add.</param>
 /// <param name="when">The sample timestamp.</param>
 /// <param name="name">The name for the observation.</param>
 /// <param name="units">The units the observation is in.</param>
 /// <param name="observationType">The type of the observation.</param>
 public Observation(double value, DateTime when, string name, ObservationUnits units, ObservationType observationType)
 {
     this.Value           = value;
     this.Observed        = when;
     this.Name            = name;
     this.ObservationType = observationType;
     this.Units           = units;
 }
예제 #32
0
 /// <summary>
 /// 哈希数
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     return(BandOrFrequency.GetHashCode() ^ 7 + Attribute.GetHashCode() ^ 3 + ObservationType.GetHashCode() * 3);
 }
예제 #33
0
 /// <summary>
 /// 默认构造函数
 /// </summary>
 /// <param name="type"></param>
 public SameTypeObservations(ObservationType type)
 {
     this.ObservationType = type;
 }
예제 #34
0
    public bool UpdateObservationType(ObservationType observationType)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_UpdateObservationType", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ObservationTypeID", SqlDbType.Int).Value = observationType.ObservationTypeID;
            cmd.Parameters.Add("@ObservationTypeName", SqlDbType.NVarChar).Value = observationType.ObservationTypeName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
예제 #35
0
    public static bool UpdateObservationType(ObservationType observationType)
    {
        SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();

        return(sqlObservationTypeProvider.UpdateObservationType(observationType));
    }
예제 #36
0
 public static bool UpdateObservationType(ObservationType observationType)
 {
     SqlObservationTypeProvider sqlObservationTypeProvider = new SqlObservationTypeProvider();
     return sqlObservationTypeProvider.UpdateObservationType(observationType);
 }
예제 #37
0
        internal VitalSign[] toLatestVitalSigns(string response)
        {
            if (!cxn.IsConnected)
            {
                throw new NotConnectedException();
            }

            if (response == "")
            {
                return(null);
            }
            string[]  lines    = StringUtils.split(response, StringUtils.CRLF);
            ArrayList lst      = new ArrayList(lines.Length);
            string    category = "Vital Signs";

            for (int i = 0; i < lines.Length; i++)
            {
                if (lines[i] == "")
                {
                    continue;
                }
                string[]        flds            = StringUtils.split(lines[i], StringUtils.CARET);
                ObservationType observationType = null;
                if (flds[1] == "T")
                {
                    observationType = new ObservationType(flds[0], category, "Temperature");
                }
                else if (flds[1] == "P")
                {
                    observationType = new ObservationType(flds[0], category, "Pulse");
                }
                else if (flds[1] == "R")
                {
                    observationType = new ObservationType(flds[0], category, "Respiration");
                }
                else if (flds[1] == "BP")
                {
                    observationType = new ObservationType(flds[0], category, "Blood Pressure");
                }
                else if (flds[1] == "HT")
                {
                    observationType = new ObservationType(flds[0], category, "Height");
                }
                else if (flds[1] == "WT")
                {
                    observationType = new ObservationType(flds[0], category, "Weight");
                }
                else if (flds[1] == "PN")
                {
                    observationType = new ObservationType(flds[0], category, "Pain");
                }
                if (observationType == null)
                {
                    continue;
                }
                VitalSign observation = new VitalSign();
                observation.Type   = observationType;
                observation.Value1 = flds[4];
                if (flds.Length == 6)
                {
                    observation.Value2 = flds[5];
                }
                observation.Timestamp = VistaTimestamp.toUtcString(flds[3]);
                lst.Add(observation);
            }
            return((VitalSign[])lst.ToArray(typeof(VitalSign)));
        }
예제 #38
0
    public int InsertObservationType(ObservationType observationType)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("AL_InsertObservationType", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@ObservationTypeID", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@ObservationTypeName", SqlDbType.NVarChar).Value = observationType.ObservationTypeName;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return (int)cmd.Parameters["@ObservationTypeID"].Value;
        }
    }