private async void PartPlot(CancellationToken token) { _timer.Stop(); if (Pacient != null) { try { if (!Equals(Range, null)) { HumanData data = await PatientUtilities.LoadHumanData(Pacient, new Tuple <DateTime, DateTime>(Range.Item1, Range.Item2)); string dis = "Normal"; string emo = (await PatientUtilities.GetEmotion(Pacient))?.LastOrDefault()?.Emotion; if (data != null && data.Data?.Count > 0 && dis != null && emo != null) { Plot(data, token); Disease = dis; RaisePropertyChanged(nameof(Disease)); Emotion = emo; RaisePropertyChanged(nameof(Emotion)); } } } catch (Exception ex) { MessageBox.Show($"An unhandled exception just occurred: {ex.Message}", "Part Plot", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
public IActionResult Create([FromBody] HumanData hdata) { if (hdata == null) { return(BadRequest()); } int needed = 0; bool isExist = false; for (int i = 0; i < HumanDatas.DataList.Count; i++) { if (HumanDatas.DataList[i].DeviceId == hdata.DeviceId) { needed = i; isExist = true; break; } } if (!isExist) { HumanDatas.DataList.Add(hdata); } else { HumanDatas.DataList[needed].Data = HumanDatas.DataList[needed].Data.Concat(hdata.Data).ToList(); } return(CreatedAtRoute("GetData", new { deviceid = hdata.DeviceId }, hdata)); }
public static async System.Threading.Tasks.Task <HttpResponseMessage> RunAsync(HttpRequestMessage req, TraceWriter log) { log.Info("C# HTTP trigger function processed a request."); string resultData = ""; string data = await req.Content.ReadAsStringAsync(); HttpResponseMessage result; if (data.Length > 2000) { result = new HttpResponseMessage(HttpStatusCode.RequestEntityTooLarge); } else { MessageData mdata = JsonConvert.DeserializeObject <MessageData>(data); DeviceData devicedata = new DeviceData { Temperature = mdata.Temperature, Cardio = mdata.Cardio, EventProcessedUtcTime = mdata.EventProcessedUtcTime, HR = mdata.HR }; HumanData newdata = new HumanData { DeviceId = mdata.DeviceId, Data = devicedata }; resultData = JsonConvert.SerializeObject(newdata); HttpContent content = new StringContent(resultData); using (HttpClient client = new HttpClient()) { var requestUri = new Uri("http://maconcentrator.westeurope.cloudapp.azure.com:5200/api/datasaver"); var request = new HttpRequestMessage { RequestUri = requestUri, Method = HttpMethod.Post, Content = content }; request.Headers.Add("Accept", "application/json"); var response = await client.SendAsync(request); if (response != null && response.IsSuccessStatusCode) { result = new HttpResponseMessage(HttpStatusCode.OK); } else { result = new HttpResponseMessage(HttpStatusCode.BadRequest); } } } return(req.CreateResponse(result.StatusCode, resultData)); }
private void Plot(HumanData hd, CancellationToken token) { CardioPlotLst.Clear(); TemperaturePlotLst.Clear(); HeartRatePlotLst.Clear(); if (token.IsCancellationRequested) { _timer.Stop(); Range = null; if (Ranges?.Count > 0) { Ranges.Clear(); } CardioPlotLst.Clear(); RaisePropertyChanged(nameof(CardioPlotLst)); TemperaturePlotLst.Clear(); RaisePropertyChanged(nameof(TemperaturePlotLst)); HeartRatePlotLst.Clear(); RaisePropertyChanged(nameof(HeartRatePlotLst)); HR = 0; return; } for (int i = 0; i < hd.Data.Count; i++) { for (int j = 0; j < hd.Data[i].Cardio.Count; j++) { CardioPlotLst.Add(new CardioPlot { EventTime = PatientUtilities.UnixTimeStampToDateTime(hd.Data[i].Ticks[j]), Cardio = hd.Data[i].Cardio[j] }); RaisePropertyChanged(nameof(CardioPlotLst)); HeartRatePlotLst.Add(new HeartRatePlot { EventTime = PatientUtilities.UnixTimeStampToDateTime(hd.Data[i].Ticks[j]), HeartRate = hd.Data[i].HR[j] }); RaisePropertyChanged(nameof(HeartRatePlotLst)); TemperaturePlotLst.Add(new TemperaturePlot { EventTime = PatientUtilities.UnixTimeStampToDateTime(hd.Data[i].Ticks[j]), Temperature = hd.Data[i].Temperature[j] }); RaisePropertyChanged(nameof(TemperaturePlotLst)); } } if (hd.Data?.Count > 0) { HR = hd.Data.LastOrDefault().HR.LastOrDefault(); } RaisePropertyChanged(nameof(HR)); }
public void OnClickTest() { var human = Instantiate(ResourcesManager.LoadPrefab(ConstantsResourcesPath.PREFABS, ConstantsPrefabName.CREATURE_HUMAN), Vector3.zero, Quaternion.identity).GetComponent <HumanController>(); //Test data's var data = new HumanData(); data.body = "human_01"; data.parametersList.Add(new ParameterData(EnumParameters.Speed, 1.5f)); human.Initialize(data); human.gameObject.AddComponent <CreatureInputPlayer>(); }
public static async Task <HumanData> LoadHumanData(Pacient pat, Tuple <DateTime, DateTime> daterange) { HumanData data = null; try { using (HttpClient client = new HttpClient()) { StringBuilder builder = new StringBuilder(Consts.Chart); builder.Append("/"); builder.Append(pat.DeviceID); builder.Append("/"); string b = JsonConvert.SerializeObject(daterange.Item1); builder.Append(b.Substring(1, b.Length - 2)); builder.Append("/"); b = JsonConvert.SerializeObject(daterange.Item2); builder.Append(b.Substring(1, b.Length - 2)); using (HttpRequestMessage request = new HttpRequestMessage { RequestUri = new Uri(builder.ToString()), Method = HttpMethod.Get }) { request.Headers.Add("Accept", "application/json"); using (HttpResponseMessage response = await client.SendAsync(request)) { if (response.StatusCode == HttpStatusCode.OK) { string tmp = await response.Content.ReadAsStringAsync(); var tmpobj = JsonConvert.DeserializeObject <HumanData>(tmp); if (!Equals(tmpobj, null)) { data = tmpobj; } } } } } } catch (Exception ex) { MessageBox.Show($"An unhandled exception just occurred: {ex.Message}", "Load Data", MessageBoxButton.OK, MessageBoxImage.Warning); } return(data); }
private void Awake() { animator = GetComponent <Animator>(); navAgent = GetComponent <NavMeshAgent>(); gameController = Util.FindGameController(); if (gameController.mode == GameController.Mode.Reinforce) { academy = gameController.academy; brain = academy.GetComponentInChildren <Brain>(); } gameController.AddHuman(this); actions = GameObject.FindGameObjectWithTag("GameController").GetComponentsInChildren <ActionReward>(); this.gameObject.name = Util.Names[Random.Range(0, Util.Names.Count)]; shirtRenderer.material.color = Util.ShirtColors[Random.Range(0, Util.ShirtColors.Count)]; data = new HumanData(); }
// Update is called once per frame void Update() { if (dead) { Destroy(gameObject); } // - check to see if a gameObject has the Human Data Component component, if it does add it to an Array List // called allHumans, and then continue to the next object in the list. HumanData hd = (HumanData)go.GetComponent(typeof(HumanData)); if (hd != null) { allHumans.Add(go); continue; } }
public void AddHuman(Human h) { int num = this.humanData.FindIndex((HumanData hd) => hd.human == h); if (num < 0) { HumanData humanData = new HumanData(); humanData.human = h; humanData.waypointCount = 0; humanData.contactCount = 1; this.humanData.Add(humanData); } else { this.humanData[num].contactCount++; } }
public static async Task <HumanData> GetFiles(string deviceid, DateTime begin, DateTime end) { //begin = begin.ToUniversalTime(); //end = end.ToUniversalTime(); BlobContinuationToken continuationToken = null; List <CloudBlockBlob> result = new List <CloudBlockBlob>(); do { var resultSegment = await BlobContainer.ListBlobsSegmentedAsync(deviceid, true, BlobListingDetails.All, 20, continuationToken, null, null); result.AddRange(resultSegment.Results.Cast <CloudBlockBlob>()); continuationToken = resultSegment.ContinuationToken; } while (continuationToken != null); result = result.Where(x => { Tuple <DateTime, DateTime> tmp = ParseFileName(x.Name); return(tmp.Item1 >= begin && tmp.Item2 <= end); }).ToList(); var resultData = new HumanData { DeviceId = deviceid, Data = new List <DeviceData>() }; foreach (var item in result) { resultData.Data.AddRange( JsonConvert.DeserializeObject <HumanData>( await item.DownloadTextAsync()).Data); } resultData.Data.Sort((x, y) => DateTime.Compare(x.EventProcessedUtcTime, y.EventProcessedUtcTime)); GC.Collect(); //TODO HumanDataOptimization(ref resultData, begin, end); return(resultData); }
/// <summary> /// Initialize Curve manipulation for Rigs /// </summary> public CurveManipulation(GameObject target, RigGoalController controller, int frame, Transform mouthpiece, AnimationTool.CurveEditMode manipMode, int zoneSize, double tangentContinuity) { isHuman = true; manipulationMode = manipMode; initialMouthMatrix = mouthpiece.worldToLocalMatrix; Frame = frame; Target = target; continuity = tangentContinuity; List <AnimationSet> previousSets = new List <AnimationSet>(); controller.AnimToRoot.ForEach(x => { if (null != x) { previousSets.Add(new AnimationSet(x)); } }); humanData = new HumanData() { Animations = previousSets, Controller = controller, ObjectAnimation = new AnimationSet(controller.Animation), InitFrameMatrix = controller.MatrixAtFrame(frame) }; if (manipulationMode == AnimationTool.CurveEditMode.Segment) { startFrame = frame - zoneSize; endFrame = frame + zoneSize; AddSegmentHierarchy(controller, frame); AddSegmentKeyframes(frame, controller.Animation); } if (manipulationMode == AnimationTool.CurveEditMode.Tangents) { startFrame = humanData.ObjectAnimation.GetCurve(AnimatableProperty.RotationX).GetPreviousKeyFrame(frame); endFrame = humanData.ObjectAnimation.GetCurve(AnimatableProperty.RotationX).GetNextKeyFrame(frame); } }
void LoadHumans() { lHumans = new List <HumanData>(); JsonData creature; string sCreatureType = "Humans"; for (int i = 0; i < jsCreatureData[sCreatureType].Count; i++) { creature = jsCreatureData[sCreatureType][i]; HumanData humanData = new HumanData(creature); if (humanData.nPower == -1) { humanData.nPower = defaultHuman.nPower; } if (humanData.nHealthMax == -1) { humanData.nHealthMax = defaultHuman.nHealthMax; } lHumans.Add(humanData); } }
public static HumanPrediction Predict(HumanData input) { var result = PredictionEngine.Value.Predict(input); return(result); }
private void Awake() { _mesh = GetComponent <MeshRenderer>(); human = (HumanData)ScriptableObject.CreateInstance("HumanData"); this.state = HumanState.Unselected; }
void SetRandomData() { successCount++; if (successCount >= successRequired) { if (GameController.daysCount == 1 || GameController.isFired) { CanvasScript.Instance.Computer.FinishDay(); } else { CanvasScript.Instance.Computer.FinishDay2(); } } curData = data.data.OrderBy(a => Random.value).FirstOrDefault(); if (Random.Range(0, 100) < fakeChance) { curData.faked = true; switch (Random.Range(0, 4)) { case 0: curData.Name = Guid.NewGuid().ToString(); curData.fakedReason = "Name is not real"; break; case 1: if (Random.value > 0.2f) { curData.Email = TruncatePercents(curData.Email); } else { curData.Email = Guid.NewGuid().ToString(); } curData.fakedReason = "Email is incorrect"; break; case 2: curData.ExpireDate = curData.ExpireDate.Remove(curData.ExpireDate.Length - 1, 1) + Random.Range(0, 4); curData.fakedReason = "Passport already expired"; break; case 3: if (Random.value > 0.5f) { curData.CreditCard = curData.CreditCard.Remove(0, 5); } else { curData.CreditCard = curData.CreditCard.Replace(curData.CreditCard[Random.Range(0, curData.CreditCard.Length)], 'i'); } curData.fakedReason = "Credit card is fake"; break; default: break; } } Name.text = "Name: " + curData.Name; Email.text = "Email: " + curData.Email; PasspordId.text = "Passpord ID: " + curData.PasspordId; ExpireDate.text = "Expire Date: " + curData.ExpireDate; Country.text = "Country: " + curData.Country; City.text = "City: " + curData.City; CreditCard.text = "Credit Card: " + curData.CreditCard; }