public void TestRumRun() { var rum = new Rum(true); var patient = new PatientIdentifier() { InternalId = new Guid(PGuid) }; var patData = rum.GetPatientData(patient); Assert.IsTrue(patData.FindAll(p => p.Patient.InternalId == patient.InternalId).Count == 1, "There are no entries for test patient, why?"); Assert.IsTrue(patData.FindAll(p => p.Data.FindAll(d => d.OntologicName == "rdf:TestEntry").Count > 0).Count == 1, "PhrPluginEmpty should have been returned DataUnit with a TestEntry."); Assert.IsTrue(patData.FindAll(p => p.Data.FindAll(d => d.OntologicName == "rdf:DifferentTestEntry").Count > 0).Count == 0, "DifferentTestEntry should have been filtered out by RUMs' config."); }
public string GetUserName(PatientIdentifier p) { if (authMap == null) { LoadAuthTokens(); } if (this.authMap.ContainsKey(p.InternalId.ToString())) return ((CarreAuthToken)authMap[p.InternalId.ToString()]).Username; return null; }
public CarreAuthToken GetAuthToken(PatientIdentifier p) { CarreAuthToken t = new CarreAuthToken(); if (authMap == null) { LoadAuthTokens(); } if (this.authMap.ContainsKey(p.InternalId.ToString())) return (CarreAuthToken)authMap[p.InternalId.ToString()]; return null; }
public List<PhrData> GetMockData() { PatientIdentifier patient1 = new PatientIdentifier() { InternalId = new Guid(guid) }; SourceIdentifier source1 = new SourceIdentifier() { InternalId = new Guid("5c30ee9a-2e63-42c7-b418-ef4fe2f3e565"), SourceName = "vivaport" }; List<PhrData> TestData = new List<PhrData>() { new PhrData() { Patient = patient1, Source = source1, Data = new List<DataUnit>() { new DataUnit() { OntologicName = "test1", Datetime = DateTime.Now.Date.AddDays(-2), //overrides value-1 Identifier = "identifier-1", Name = "name-1", Value = "value-1", Source = source1, OntologicType = "string", }, new DataUnit() { OntologicName = "test2", Datetime = DateTime.Now.Date.AddDays(-2), Identifier = "identifier-2", Name = "name-2", Value = "value-1-1", Source = source1, OntologicType = "string", } } }, }; return TestData; }
public void TestUnification() { var unificator = new Unificator(); unificator.LoadUnificationRules("../../Fixtures/SourcePriorities.xml"); PatientIdentifier patient1 = new PatientIdentifier() { InternalId = new Guid("5c30ee9a-2e63-42c7-b418-ef4fe2f3e565") }; PatientIdentifier patient2 = new PatientIdentifier() { InternalId = new Guid("5c30ee9a-2e63-42c7-b418-ef4fe2f3e566") // should be untouched }; SourceIdentifier source1 = new SourceIdentifier() { InternalId = new Guid("5c30ee9a-2e63-42c7-b418-ef4fe2f3e565"), // has priority 10 SourceName = "FAKE" }; SourceIdentifier source2 = new SourceIdentifier() { InternalId = new Guid("5c30ee9a-2e63-42c7-b418-ef4fe2f3e566"), // has priority 20 SourceName = "FAKE" }; List<PhrData> TestData = new List<PhrData>() { new PhrData() { Patient = patient1, Source = source1, Data = new List<DataUnit>() { new DataUnit() { OntologicName = "test1", Datetime = DateTime.Now.Date.AddDays(-2), //overrides value-1 Identifier = "identifier-1", Name = "name-1", Value = "value-1" }, new DataUnit() { OntologicName = "test2", Datetime = DateTime.Now.Date.AddDays(-2), Identifier = "identifier-2", Name = "name-2", Value = "value-1-1" } } }, new PhrData() { Patient = patient1, Source = source2, // priority of 20, should be overriden Data = new List<DataUnit>() { new DataUnit() { OntologicName = "test1", Datetime = DateTime.Now.Date.AddDays(-2), Identifier = "identifier-1", Name = "name-1", Value = "value-1-3" }, new DataUnit() { OntologicName = "test2", Datetime = DateTime.Now.Date.AddDays(-1), //newer, should override Identifier = "identifier-2", Name = "name-2", Value = "value-1-4" } } }, new PhrData() { Patient = patient2, Source = source2, Data = new List<DataUnit>() { new DataUnit() { OntologicName = "test1", Datetime = DateTime.Now.AddDays(-2), Identifier = "identifier-1", Name = "name-1", Value = "value-1" }, new DataUnit() { OntologicName = "test2", Datetime = DateTime.Now.AddDays(-1), Identifier = "identifier-2", Name = "name-2", Value = "value-1-1" } } }, }; List<PhrData> result = unificator.Unify(TestData); Assert.IsTrue(result.Exists(phd => phd.Patient == patient1), "patient1 should exist in list."); Assert.IsTrue(result.Exists(phd => phd.Patient == patient2), "patient2 should exist in list."); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-1")), "patient1 data missing"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-2")), "patient1 data missing"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient2).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-1")), "patient2 data missing"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient2).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-2")), "patient2 data missing"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient2).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-1" && dat.Value == "value-1")), "patient2 data touched!"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient2).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-2" && dat.Value == "value-1-1")), "patient2 data touched!"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).FindAll(pd => pd.Data.Exists(dat => dat.Name == "name-1")).Count == 1); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).FindAll(pd => pd.Data.Exists(dat => dat.Name == "name-2")).Count == 1); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-1" && dat.Value == "value-1")), "patient1 data identifier-1 is not value-1!"); Assert.IsTrue(result.FindAll(phd => phd.Patient == patient1).Exists(pd => pd.Data.Exists(dat => dat.Name == "name-2" && dat.Value == "value-1-4")), "partient1 data name-2 is not value-1-4!"); }