public ClientState(Guid clientId, LiveState state) { Id = LiveGuid.NewGuid(); ClientId = clientId; StatusDate = DateTime.Now; Status = state; }
public Encounter() { //Status = "Created"; Id = LiveGuid.NewGuid(); EncounterDate = DateTime.Now; VisitType = SharedKernel.Model.VisitType.None; }
private Encounter(Guid clientId, Guid formId, Guid encounterTypeId, DateTime encounterDate, Guid providerId, Guid deviceId, Guid practiceId, DateTime?started, DateTime?stopped, Guid userId, bool isComplete, Guid?indexClientId, VisitType visitType) : this(LiveGuid.NewGuid(), clientId, formId, encounterTypeId, encounterDate, providerId, deviceId, practiceId, started, stopped, userId, isComplete, indexClientId, visitType) { }
public virtual void AssignId() { if (typeof(TId) == typeof(Guid)) { Id = (TId)(object)LiveGuid.NewGuid(); } }
public void should_Evaluate_Count_Range() { // 1 to 4 var q4 = _form.Questions.First(x => x.Rank == 4); var obs = _encounter.Obses.First(x => x.QuestionId == q4.Id); _questionValidation = q4.Validations.First(x => x.ValidatorId.ToLower() == "Range".ToLower() && x.ValidatorTypeId.ToLower() == "Count".ToLower() && x.Revision == 0); _questionValidation.MinLimit = "1"; _questionValidation.MaxLimit = "4"; obs.ValueMultiCoded = $"{LiveGuid.NewGuid()},{LiveGuid.NewGuid()}"; _responseMinMax = new Response(obs.EncounterId, _encounter.ClientId, q4, obs); var isvalid = _questionValidation.Evaluate(_responseMinMax); Assert.IsTrue(isvalid); Console.WriteLine($"{q4}={obs.ValueMultiCoded} | {_questionValidation}"); _responseMinMax.Obs.ValueMultiCoded = String.Empty; Assert.Throws <ArgumentException>(() => _questionValidation.Evaluate(_responseMinMax)); _responseMinMax.Obs.ValueMultiCoded = null; Assert.Throws <ArgumentException>(() => _questionValidation.Evaluate(_responseMinMax)); _responseMinMax.Obs.ValueMultiCoded = $"{LiveGuid.NewGuid()},{LiveGuid.NewGuid()},{LiveGuid.NewGuid()},{LiveGuid.NewGuid()},{LiveGuid.NewGuid()}"; }
private void Activate() { RequestDate = DateTime.Now; ActivationCode = LiveGuid.NewGuid().ToString(); ActivationDate = DateTime.Now; ExpiryDate = DateTime.Now.AddYears(1); }
public InvalidMessage(Guid clientId, MessageType type, string message) { Id = LiveGuid.NewGuid(); ClientId = clientId; Type = type; Message = message; }
public void should_check_null_guids() { var blank2 = new Guid(); Assert.IsTrue(blank2.IsNullOrEmpty()); var blank3 = Guid.Empty; Assert.IsTrue(blank3.IsNullOrEmpty()); var blank4 = LiveGuid.NewGuid(); Assert.IsFalse(blank4.IsNullOrEmpty()); Guid?blank5 = null; Assert.IsTrue(blank5.IsNullOrEmpty()); blank5 = new Guid(); Assert.IsTrue(blank5.IsNullOrEmpty()); blank5 = Guid.Empty; Assert.IsTrue(blank5.IsNullOrEmpty()); blank5 = LiveGuid.NewGuid(); Assert.IsFalse(blank5.IsNullOrEmpty()); }
public IActionResult SaveRestProtocol([FromBody] RestProtocol entity) { if (null == entity) { return(BadRequest()); } if (entity.Id.IsNullOrEmpty()) { entity.Id = LiveGuid.NewGuid(); } try { _emrManagerService.SaveRestProtocol(entity); return(Ok(entity)); } catch (Exception e) { var msg = $"Error saving {nameof(RestProtocol)}"; Log.Error(msg); Log.Error($"{e}"); return(StatusCode(500, msg)); } }
public void SetUp() { _id1 = LiveGuid.NewGuid(); _id2 = LiveGuid.NewGuid(); _searchHits = new List <SearchHit> { new SearchHit(_id1), new SearchHit(_id1), new SearchHit(_id2) }; }
private PSmartStore(string shr, Guid clientId) { Shr = shr; Date_Created = Status_Date = DateTime.Now; Uuid = LiveGuid.NewGuid(); Status = "PENDING"; ClientId = clientId; }
public async Task <int> Load(Guid extractId, int found, bool diffSupport) { int count = 0; var mapper = diffSupport ? ExtractDiffMapper.Instance : ExtractMapper.Instance; try { DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientExtract), nameof(ExtractStatus.Loading), found, 0, 0, 0, 0))); const int take = 500; var eCount = await _tempPatientExtractRepository.GetCleanCount(); var pageCount = _tempPatientExtractRepository.PageCount(take, eCount); int page = 1; while (page <= pageCount) { var tempPatientExtracts = await _tempPatientExtractRepository.GetAll(a => a.ErrorType == 0, page, take); var batch = tempPatientExtracts.ToList(); count += batch.Count; //Auto mapper var extractRecords = mapper.Map <List <TempPatientExtract>, List <PatientExtract> >(batch); foreach (var record in extractRecords) { record.Id = LiveGuid.NewGuid(); } //Batch Insert var inserted = _patientExtractRepository.BatchInsert(extractRecords); if (!inserted) { Log.Error($"Extract {nameof(PatientExtract)} not Loaded"); return(0); } Log.Debug("saved batch"); page++; DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientExtract), nameof(ExtractStatus.Loading), found, count, 0, 0, 0))); } await _mediator.Publish(new DocketExtractLoaded("NDWH", nameof(PatientExtract))); return(count); } catch (Exception e) { Log.Error(e, $"Extract {nameof(PatientExtract)} not Loaded"); throw; } }
public async Task <int> Load(Guid extractId, int found) { try { DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientArtExtract), nameof(ExtractStatus.Loading), found, 0, 0, 0, 0))); //load temp extracts without errors StringBuilder querybuilder = new StringBuilder(); querybuilder.Append($" SELECT * FROM {nameof(TempPatientArtExtract)}s s"); querybuilder.Append($" INNER JOIN PatientExtracts p ON "); querybuilder.Append($" s.PatientPK = p.PatientPK AND "); querybuilder.Append($" s.SiteCode = p.SiteCode "); querybuilder.Append($" WHERE s.CheckError = 0"); string query = querybuilder.ToString(); var tempPatientArtExtracts = _tempPatientArtExtractRepository.GetFromSql(query); const int take = 1000; int skip = 0; var count = tempPatientArtExtracts.Count(); while (skip < count) { var batch = tempPatientArtExtracts.Skip(skip).Take(take).ToList(); //Auto mapper var extractRecords = Mapper.Map <List <TempPatientArtExtract>, List <PatientArtExtract> >(batch); foreach (var record in extractRecords) { record.Id = LiveGuid.NewGuid(); } //Batch Insert var inserted = _patientArtExtractRepository.BatchInsert(extractRecords); if (!inserted) { Log.Error($"Extract {nameof(PatientArtExtract)} not Loaded"); return(0); } Log.Debug("saved batch"); skip = skip + take; DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientArtExtract), nameof(ExtractStatus.Loading), found, skip, 0, 0, 0))); } return(count); } catch (Exception e) { Log.Error(e, $"Extract {nameof(PatientArtExtract)} not Loaded"); return(0); } }
protected Entity() { Type idType = typeof(TId); if (idType == typeof(Guid)) { Id = (TId)(object)LiveGuid.NewGuid(); } }
public async Task <int> Extract(DbExtract extract, DbProtocol dbProtocol) { int batch = 500; var list = new List <TempPatientAdverseEventExtract>(); int count = 0; int loaded = 0; using (var rdr = await _reader.ExecuteReader(dbProtocol, extract)) { while (rdr.Read()) { count++; // AutoMapper profiles var extractRecord = Mapper.Map <IDataRecord, TempPatientAdverseEventExtract>(rdr); extractRecord.Id = LiveGuid.NewGuid(); if (extractRecord.HasData()) { loaded++; list.Add(extractRecord); } if (count == batch) { _extractRepository.BatchInsert(list); count = 0; DomainEvents.Dispatch( new ExtractActivityNotification(extract.Id, new DwhProgress( nameof(PatientAdverseEventExtract), nameof(ExtractStatus.Finding), loaded, 0, 0, 0, 0))); list = new List <TempPatientAdverseEventExtract>(); } } if (count > 0) { // save remaining list; _extractRepository.BatchInsert(list); } _extractRepository.CloseConnection(); } // TODO: Notify Completed; DomainEvents.Dispatch( new ExtractActivityNotification(extract.Id, new DwhProgress( nameof(PatientAdverseEventExtract), nameof(ExtractStatus.Found), loaded, 0, 0, 0, 0))); return(loaded); }
public DwhManifest(int siteCode, List <int> patientPks, string siteName, EmrDto emrDto) { Id = LiveGuid.NewGuid(); SiteCode = siteCode; PatientPks = patientPks; Name = siteName; EmrId = emrDto.EmrId; EmrName = emrDto.Name; EmrSetup = emrDto.EmrSetup; }
public DwhManifestMessageBag(List <DwhManifestMessage> messages) { Session = LiveGuid.NewGuid(); var sessionStart = DateTime.Now; foreach (var message in messages) { message.Manifest.InitSession(Session, sessionStart, string.Empty); } Messages = messages; }
public void should_Save_Or_Update_Obs_New() { var newObs = _obs; newObs.Id = LiveGuid.NewGuid(); _obsRepository.SaveOrUpdate(newObs); _obsRepository = new ObsRepository(_liveSetting); var savedNewObs = _obsRepository.Get(newObs.Id); Assert.AreEqual(newObs.Id, savedNewObs.Id); Assert.IsNotNull(savedNewObs); }
public static ObsPartnerScreening Create(DateTime screeningDate, Guid ipvScreening, Guid physicalAssult, Guid threatened, Guid sexuallyUncomfortable, Guid hivStatus, Guid eligibility, DateTime bookingDate, string remarks, Guid?pnsAccepted, Guid?iPVOutcome, string occupation, Guid?pNSRealtionship, Guid?livingWithClient, Guid?pNSApproach, Guid encounterId, Guid indexClientId) { var obs = new ObsPartnerScreening(LiveGuid.NewGuid(), screeningDate, ipvScreening, physicalAssult, threatened, sexuallyUncomfortable, hivStatus, eligibility, bookingDate, remarks, pnsAccepted, iPVOutcome, occupation, pNSRealtionship, livingWithClient, pNSApproach, encounterId, indexClientId); return(obs); }
public async Task <int> Load(Guid extractId, int found) { try { DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientExtract), nameof(ExtractStatus.Loading), found, 0, 0, 0, 0))); //load temp extracts without errors var tempPatientExtracts = _tempPatientExtractRepository.GetAll().Where(a => a.CheckError == false); const int take = 1000; int skip = 0; var count = tempPatientExtracts.Count(); while (skip < count) { var batch = tempPatientExtracts.Skip(skip).Take(take).ToList(); //Auto mapper var extractRecords = Mapper.Map <List <TempPatientExtract>, List <PatientExtract> >(batch); foreach (var record in extractRecords) { record.Id = LiveGuid.NewGuid(); } //Batch Insert var inserted = _patientExtractRepository.BatchInsert(extractRecords); if (!inserted) { Log.Error($"Extract {nameof(PatientExtract)} not Loaded"); return(0); } Log.Debug("saved batch"); skip = skip + take; DomainEvents.Dispatch( new ExtractActivityNotification(extractId, new DwhProgress( nameof(PatientExtract), nameof(ExtractStatus.Loading), found, skip, 0, 0, 0))); } return(count); } catch (Exception e) { Log.Error(e, $"Extract {nameof(PatientExtract)} not Loaded"); throw; } }
public async Task <int> Load(bool diffSupport) { var mapper = diffSupport ? ExtractDiffMapper.Instance : ExtractMapper.Instance; int count = 0; try { const int take = 1000; var eCount = await _tempHtsClientsLinkageExtractRepository.GetCleanCount(); var pageCount = _tempHtsClientsLinkageExtractRepository.PageCount(take, eCount); int page = 1; while (page <= pageCount) { var tempHtsClientLinkages = await _tempHtsClientsLinkageExtractRepository.GetAll(QueryUtil.Linkage, page, take); var batch = tempHtsClientLinkages.ToList(); count += batch.Count; //Auto mapper var extractRecords = mapper.Map <List <TempHtsClientLinkage>, List <HtsClientLinkage> >(batch); foreach (var record in extractRecords) { record.Id = LiveGuid.NewGuid(); } //Batch Insert var inserted = _clientsLinkageExtractRepository.BatchInsert(extractRecords); if (!inserted) { Log.Error($"Extract {nameof(HtsClientLinkage)} not Loaded"); return(0); } Log.Debug("saved batch"); page++; } DomainEvents.Dispatch(new HtsNotification(new ExtractProgress(nameof(HtsClientLinkage), "Loading...", Found, 0, 0, 0, 0))); return(count); } catch (Exception e) { Log.Error(e, $"Extract {nameof(HtsClientLinkage)} not Loaded"); throw; } }
public void should_Get_Obs_Value_Single() { // Single | Numeric | Multi | DateTime | Text _response.Question.Concept.ConceptTypeId = "Single"; _response.Obs.ValueCoded = LiveGuid.NewGuid(); var obsVal = _response.GetValue(); Assert.IsNotNull(obsVal); Assert.IsInstanceOfType(obsVal.Value, typeof(Guid?)); _response.Obs.ValueCoded = null; var obsValEmpty = _response.GetValue(); Assert.IsInstanceOfType(obsValEmpty.Value, typeof(Guid?)); Console.WriteLine(obsVal); Console.WriteLine(new string('-', 30)); Console.WriteLine(obsValEmpty); }