public void FindFindAllTest04()
        {
            LIST <EN> names = LIST <EN> .CreateList();

            names.NullFlavor = NullFlavor.Other;
            Assert.IsTrue(names.Validate());
        }
示例#2
0
        public void R2CDQualifierNestedCodeParseTest()
        {
            var cdi = new CD <String>("64572001", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, new ED("Some original text"));

            cdi.Qualifier = new LIST <CR <string> >();
            cdi.Qualifier.Add(new CR <string>(
                                  new CV <String>("116676008", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null),
                                  new CD <String>("72704001", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null)
                                  ));
            cdi.Qualifier.Add(new CR <String>(
                                  new CV <String>("363698007", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null),
                                  new CD <String>("12611008", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null)
            {
                Qualifier = LIST <CR <String> > .CreateList(
                    new CR <String>(
                        new CV <String>("272741003", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null),
                        new CD <String>("7771000", "2.16.840.1.113883.6.96", "SNOMED-CT", null, null, null)
                        )
                    )
            }
                                  ));
            string actualXml = R2SerializationHelper.SerializeAsString(cdi);
            var    cd2       = R2SerializationHelper.ParseString <CD <String> >(actualXml);

            Assert.AreEqual(cdi, cd2);
        }
        public void FindFindAllTest03()
        {
            LIST <EN> names = LIST <EN> .CreateList();

            names.NullFlavor = null;
            Assert.IsFalse(names.Validate());
        }
示例#4
0
        public void R2CDQualifierNestedCodeSerializationTest()
        {
            string expectedXml = @"<test xmlns=""urn:hl7-org:v3"" code=""64572001:{116676008=72704001,363698007=(12611008:272741003=7771000)}"" codeSystem=""2.16.840.1.113883.6.96"" codeSystemName=""Snomed-CT""><originalText value=""Some original text""/></test>";
            var    cdi         = new CD <String>("64572001", "2.16.840.1.113883.6.96", "Snomed-CT", null, new ST("disease"), new ED("Some original text"));

            cdi.Qualifier = new LIST <CR <string> >();
            cdi.Qualifier.Add(new CR <string>(
                                  new CV <String>("116676008", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "associated morphology", null),
                                  new CD <String>("72704001", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "fracture", null)
                                  ));
            cdi.Qualifier.Add(new CR <String>(
                                  new CV <String>("363698007", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "finding site", null),
                                  new CD <String>("12611008", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "bone structure of tibia", null)
            {
                Qualifier = LIST <CR <String> > .CreateList(
                    new CR <String>(
                        new CV <String>("272741003", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "laterality", null),
                        new CD <String>("7771000", "2.16.840.1.113883.6.96", "SNOMED-CT", null, "left", null)
                        )
                    )
            }
                                  ));
            string actualXml = R2SerializationHelper.SerializeAsString(cdi);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
示例#5
0
        public void R2LISTSimpleSerializationTest()
        {
            LIST <INT> inti = LIST <INT> .CreateList(1, 2, 3, 4);

            string expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><item value=""1""/><item value=""2""/><item value=""3""/><item value=""4""/></test>";
            string actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
示例#6
0
        public void R2LISTSimpleParseTest()
        {
            LIST <INT> inti = LIST <INT> .CreateList(1, 2, 3, 4);

            string     actualXml = R2SerializationHelper.SerializeAsString(inti);
            LIST <INT> int2      = R2SerializationHelper.ParseString <LIST <INT> >(actualXml);

            Assert.AreEqual(inti, int2);
        }
示例#7
0
        public void R2LISTTypeOverrideSerializationTest()
        {
            LIST <IQuantity> inti = LIST <IQuantity> .CreateList(
                (INT)1,
                (REAL)2,
                new PQ(3, "ft"));

            string expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><item xsi:type=""INT"" value=""1""/><item xsi:type=""REAL"" value=""2""/><item xsi:type=""PQ"" value=""3"" unit=""ft""/></test>";
            string actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
示例#8
0
        public void R2LISTTypeOverrideParseTest()
        {
            LIST <IQuantity> inti = LIST <IQuantity> .CreateList(
                (INT)1,
                (REAL)2,
                new PQ(3, "ft"));

            string           actualXml = R2SerializationHelper.SerializeAsString(inti);
            LIST <IQuantity> int2      = R2SerializationHelper.ParseString <LIST <IQuantity> >(actualXml);

            Assert.AreEqual(inti, int2);
        }
示例#9
0
        public void R2SETNestedParseTest()
        {
            SET <IColl> inti = SET <IColl> .CreateSET(
                SET <INT> .CreateSET(1, 2, 3),
                LIST <INT> .CreateList(1, 1, 2),
                BAG <ST> .CreateBAG("1", "2")
                );

            string      actualXml = R2SerializationHelper.SerializeAsString(inti);
            SET <IColl> int2      = R2SerializationHelper.ParseString <SET <IColl> >(actualXml);

            Assert.AreEqual(inti, int2);
        }
示例#10
0
        public void R2SETNestedSerializationTest()
        {
            SET <IColl> inti = SET <IColl> .CreateSET(
                SET <INT> .CreateSET(1, 2, 3),
                LIST <INT> .CreateList(1, 1, 2),
                BAG <ST> .CreateBAG("1", "2")
                );

            string expectedXml = @"<test xmlns=""urn:hl7-org:v3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""><item xsi:type=""DSET_INT""><item value=""1""/><item value=""2""/><item value=""3""/></item><item xsi:type=""LIST_INT""><item value=""1""/><item value=""1""/><item value=""2""/></item><item xsi:type=""BAG_ST""><item value=""1"" language=""en-US""/><item value=""2"" language=""en-US""/></item></test>";
            string actualXml   = R2SerializationHelper.SerializeAsString(inti);

            R2SerializationHelper.XmlIsEquivalent(expectedXml, actualXml);
        }
示例#11
0
        public static ClinicalDocument CreateAPSDocument(PatientData recordTarget, PatientData father, PhysicianData author, DateTime docDate, params Section[] sections)
        {
            var doc = CreateCDA(
                LIST <II> .CreateList(new II("1.3.6.1.4.1.19376.1.5.3.1.1.2"), new II("1.3.6.1.4.1.19376.1.5.3.1.1.11.2")),
                new CE <String>("57055-6", "2.16.840.1.113883.6.1", "LOINC", null, "Antepartum Summary Note", null),
                "Antepartum Summary",
                docDate,
                recordTarget,
                null,
                null,
                author,
                sections
                );

            // Father of fetus
            if (father != null)
            {
                SET <II> fatherIds = new SET <II>();
                foreach (var id in father.OtherIds)
                {
                    fatherIds.Add(new II(id.Key, id.Value));
                }

                doc.Participant.Add(new Participant1(ParticipationType.IND, ContextControl.OverridingNonpropagating, null, new IVL <TS>(new TS(recordTarget.DateOfBirth, DatePrecision.Year)), null)
                {
                    AssociatedEntity = new AssociatedEntity(RoleClassAssociative.NextOfKin,
                                                            fatherIds,
                                                            new CE <string>("xx - fatherofbaby ", " 2.16.840.1.113883.6.96 ", null, null, " Father of fetus ", null),
                                                            SET <AD> .CreateSET(AD.FromSimpleAddress(PostalAddressUse.HomeAddress, father.Address, null, father.City, father.State, " CA ", null)),
                                                            SET <TEL> .CreateSET(new TEL()
                    {
                        NullFlavor = NullFlavor.NoInformation
                    }),
                                                            new Person(SET <PN> .CreateSET(PN.FromFamilyGiven(EntityNameUse.Legal, father.FamilyName, father.GivenName))),
                                                            null)
                });
            }

            return(doc);
        }
        public void FindFindAllTest01()
        {
            // create new list of names
            LIST <EN> names = LIST <EN> .CreateList(
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("John", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Jane", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Melany", EntityNamePartType.Given),
                new ENXP("Smith", EntityNamePartType.Family)
            }),
                new EN(EntityNameUse.Legal, new ENXP[] {
                new ENXP("Sue", EntityNamePartType.Given),
                new ENXP("Ellen", EntityNamePartType.Family)
            })
                );

            // Finds all the legal names
            var dispNames = names.Find(en => en.Use.Contains(EntityNameUse.Legal));

            Console.WriteLine(dispNames + "\n");

            // Finds all names with a family name of Smith
            var dispAllNames = names.FindAll(en => en.Part.Exists(part => part.Value == "Smith"));

            foreach (var item in dispAllNames)
            {
                Console.WriteLine(item.ToString());
            }

            names.NullFlavor = null;
            Assert.IsTrue(names.Validate());
        }
示例#13
0
        static void Main(string[] args)
        {
            ClinicalDocument cda = new ClinicalDocument();

            cda.MoodCode   = null;
            cda.ClassCode  = null;
            cda.TypeId     = II.CreatePublic("2.16.840.1.113883.1.3", "POCD_HD000040");
            cda.TemplateId = LIST <II> .CreateList(
                new II("2.16.840.1.113883.3.4424.13.10.1.1"),
                new II("2.16.840.1.113883.3.4424.13.10.1.2"),
                new II("2.16.840.1.113883.3.4424.13.10.1.3", "1.1.1"));

            cda.Id = new II("2.16.840.1.113883.3.4424.7.2.1", "2345678")
            {
                Displayable = true
            };
            var pi = new PertinentInformation()
            {
                TemplateId = LIST <II> .CreateList(new II("1.13.2.3"))
            };

            pi.CoveragePlan = new CoveragePlan(new CD <String>("PUBLICPOL", "2.16.840.1.113883.11.19350"));
            pi.CoveragePlan.Code.Qualifier = LIST <CR <String> > .CreateList(
                new CR <String>(
                    new CV <String>("RLEKUD", "1.2.3.4", null, null, "Refundacja ...", null),
                    new CD <String>("IB", "1.2.3.4")
                    )
                );

            //cda.DataEnterer = new MyDataEnterer();
            //cda.PertinentInformation.Add(pi);
            cda.RecordTarget.Add(new RecordTarget {
                PatientRole = new PatientRole()
            });
            cda.RecordTarget[0].PatientRole.Addr = SET <AD> .CreateSET(AD.CreateAD(new ADXPPL("Kiszka", AddressPartType.PostalCode)
            {
                PostCity = "PT"
            }));

            XmlIts1Formatter xftr = new XmlIts1Formatter();

            //xftr.AddFormatterAssembly(Assembly.GetExecutingAssembly());
            xftr.GraphAides.Add(new ClinicalDocumentDatatypeFormatter());
            xftr.ValidateConformance = false;
            xftr.RegisterXSITypeName("POCD_MT000040UV.ClinicalDocument", typeof(ClinicalDocument));
            xftr.Settings |= SettingsType.AlwaysCheckForOverrides;


            using (XmlStateWriter xw = new XmlStateWriter(XmlWriter.Create(Console.Out, new XmlWriterSettings()
            {
                Indent = true
            })))
            {
                xw.WriteStartElement("", "ClinicalDocument", "urn:hl7-org:v3");
                xw.WriteAttributeString("xmlns", "extPL", null, "http://www.csioz.gov.pl/xsd/extPL/r1");
                xw.WriteAttributeString("xmlns", "xsi", null, XmlIts1Formatter.NS_XSI);
                //xw.WriteAttributeString("xsi", "type", XmlIts1Formatter.NS_XSI, "extPL:ClinicalDocument");

                xftr.Graph(xw, cda);
                xw.WriteEndElement();
            }



            PatientData pat = new PatientData()
            {
                Address     = "123 Main Street West",
                City        = "Hamilton",
                DateOfBirth = new DateTime(1995, 04, 03),
                FamilyName  = "Smith",
                Gender      = "F",
                GivenName   = "Sarah",
                Id          = "102-30343",
                OtherIds    = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("2.16.2.3.2.3.2.4", "123-231-435")
                },
                State = "ON"
            };

            PhysicianData aut = new PhysicianData()
            {
                AddressLine   = " 35 King Street West ",
                City          = " Hamilton ",
                OrgId         = " 123 - 1221 ",
                OrgName       = new[] { " Good Health Clinics " },
                PhysicianId   = " 1023433 - ON ",
                PhysicianName = new string[] { " Dr.", " Francis ", " F ", " Family " },
                Postal        = "L0R2A0"
            };

            // var o = Parse(@"C:\temp\schematron\rec.xml");
            // Create the CDA
            //ClinicalDocument doc = CreateAPSDocument(pat, null, aut, DateTime.Now);
            //PrintStructure(doc);

            Console.ReadKey();
        }