public void AddDir(String dir) { if (!Path.IsPathRooted(dir)) { dir = Path.Combine(this.m_workingDirectory, dir); } if (!Directory.Exists(dir)) { throw new FileNotFoundException(dir); } // Add foreach (var file in Directory.GetFiles(dir)) { Console.WriteLine("Add {0}", Path.GetFileName(file)); try { using (var fs = File.OpenRead(file)) { var protoSource = ProtocolDefinition.Load(fs); var proto = new XmlClinicalProtocol(protoSource); ApplicationContext.Current.GetService <IClinicalProtocolRepositoryService>().InsertProtocol(proto.GetProtocolData()); } } catch (Exception e) { base.PrintStack(e); } } }
public void TestShouldSkipWeight() { ProtocolDefinition definition = ProtocolDefinition.Load(typeof(TestProtocolApply).Assembly.GetManifestResourceStream("SanteDB.Cdss.Xml.Test.Protocols.Weight.xml")); XmlClinicalProtocol xmlCp = new XmlClinicalProtocol(definition); // Patient that is just born = Schedule OPV Patient newborn = new Patient() { Key = Guid.NewGuid(), DateOfBirth = DateTime.Now, GenderConcept = new Core.Model.DataTypes.Concept() { Mnemonic = "FEMALE" }, Participations = new List <ActParticipation>() { new ActParticipation() { ParticipationRole = new Core.Model.DataTypes.Concept() { Mnemonic = "RecordTarget" }, Act = new QuantityObservation() { Value = (decimal)3.2, TypeConcept = new Core.Model.DataTypes.Concept() { Mnemonic = "VitalSign-Weight" }, ActTime = DateTime.Now } }, new ActParticipation() { ParticipationRole = new Core.Model.DataTypes.Concept() { Mnemonic = "RecordTarget" }, Act = new PatientEncounter() { ActTime = DateTime.Now } } } }; // Now apply the protocol var acts = xmlCp.Calculate(newborn, null); var jsonSerializer = new JsonViewModelSerializer(); String json = jsonSerializer.Serialize(newborn); Assert.AreEqual(59, acts.Count); }
public void Add(String file) { if (!Path.IsPathRooted(file)) { file = Path.Combine(this.m_workingDirectory, file); } if (!File.Exists(file)) { throw new FileNotFoundException(file); } // Add using (var fs = File.OpenRead(file)) { var protoSource = ProtocolDefinition.Load(fs); var proto = new XmlClinicalProtocol(protoSource); ApplicationContext.Current.GetService <IClinicalProtocolRepositoryService>().InsertProtocol(proto.GetProtocolData()); } }
public void TestShouldScheduleOPV() { ProtocolDefinition definition = ProtocolDefinition.Load(typeof(TestProtocolApply).Assembly.GetManifestResourceStream("SanteDB.Cdss.Xml.Test.Protocols.OralPolioVaccine.xml")); XmlClinicalProtocol xmlCp = new XmlClinicalProtocol(definition); // Patient that is just born = Schedule OPV Patient newborn = new Patient() { Key = Guid.NewGuid(), DateOfBirth = DateTime.Now, GenderConcept = new Core.Model.DataTypes.Concept() { Mnemonic = "FEMALE" } }; // Now apply the protocol var acts = xmlCp.Calculate(newborn, new Dictionary <String, Object>()); var jsonSerializer = new JsonViewModelSerializer(); String json = jsonSerializer.Serialize(newborn); Assert.AreEqual(4, acts.Count); }
public void TestShouldScheduleDTP() { ProtocolDefinition definition = ProtocolDefinition.Load(typeof(TestProtocolApply).Assembly.GetManifestResourceStream("OpenIZ.Protocol.Xml.Test.Protocols.DTP-HepB-HibTrivalent.xml")); XmlClinicalProtocol xmlCp = new XmlClinicalProtocol(definition); // Patient that is just born = Schedule OPV Patient newborn = new Patient() { Key = Guid.NewGuid(), DateOfBirth = DateTime.Now, GenderConcept = new Core.Model.DataTypes.Concept() { Mnemonic = "FEMALE" } }; // Now apply the protocol var acts = xmlCp.Calculate(newborn, null); var jsonSerializer = new JsonViewModelSerializer(); String json = jsonSerializer.Serialize(newborn); Assert.AreEqual(3, acts.Count); }