예제 #1
0
 /// <summary>Set a Yes/No (coded) value on a DeathRecord.</summary>
 private static void SetYesNoValueDeathRecordCode(DeathRecord deathRecord, string property, string value)
 {
     if (String.IsNullOrWhiteSpace(value))
     {
         return;
     }
     if (value.Trim().ToLower() == "yes")
     {
         Dictionary <string, string> mserv = new Dictionary <string, string>();
         mserv.Add("code", "Y");
         mserv.Add("system", "http://terminology.hl7.org/CodeSystem/v2-0136");
         mserv.Add("display", "Yes");
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, mserv, null);
     }
     else if (value.Trim().ToLower() == "no")
     {
         Dictionary <string, string> mserv = new Dictionary <string, string>();
         mserv.Add("code", "N");
         mserv.Add("system", "http://terminology.hl7.org/CodeSystem/v2-0136");
         mserv.Add("display", "No");
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, mserv, null);
     }
 }
예제 #2
0
        public Message(Record record, String type)
        {
            DeathRecord dr = record.GetRecord();

            switch (type)
            {
            case "Submission":
            case "http://nchs.cdc.gov/vrdr_submission":
                message = new DeathRecordSubmission(dr);
                message.MessageSource = "https://example.com/jurisdiction/message/endpoint";
                break;

            case "Update":
            case "http://nchs.cdc.gov/vrdr_submission_update":
                message = new DeathRecordUpdate(dr);
                message.MessageSource = "https://example.com/jurisdiction/message/endpoint";
                break;

            case "Void":
            case "http://nchs.cdc.gov/vrdr_submission_void":
                message = new VoidMessage(dr);
                message.MessageSource = "https://example.com/jurisdiction/message/endpoint";
                break;

            default:
                throw new ArgumentException($"The given message type {type} is not valid.", "type");
            }
        }
예제 #3
0
        public void CreateSubmissionFromDeathRecord()
        {
            DeathRecord           record     = (DeathRecord)XMLRecords[0];
            DeathRecordSubmission submission = new DeathRecordSubmission(record);

            Assert.NotNull(submission.DeathRecord);
            Assert.Equal("2018-02-20T16:48:06-05:00", submission.DeathRecord.DateOfDeathPronouncement);
            Assert.Equal("http://nchs.cdc.gov/vrdr_submission", submission.MessageType);
            Assert.Equal(10, 10);
            Assert.Equal((uint)1, submission.CertificateNumber);
            Assert.Equal((uint)2018, submission.DeathYear);
            Assert.Equal("42", submission.StateAuxiliaryIdentifier);
            Assert.Equal("2018MA000001", submission.NCHSIdentifier);

            record     = null;
            submission = new DeathRecordSubmission(record);
            Assert.Null(submission.DeathRecord);
            Assert.Equal("http://nchs.cdc.gov/vrdr_submission", submission.MessageType);
            Assert.Null(submission.CertificateNumber);
            Assert.Null(submission.StateAuxiliaryIdentifier);
            Assert.Null(submission.NCHSIdentifier);

            record     = (DeathRecord)JSONRecords[1]; // no ids in this record
            submission = new DeathRecordSubmission(record);
            Assert.NotNull(submission.DeathRecord);
            Assert.Equal("2018-02-20T16:48:06-05:00", submission.DeathRecord.DateOfDeathPronouncement);
            Assert.Equal("http://nchs.cdc.gov/vrdr_submission", submission.MessageType);
            Assert.Null(submission.CertificateNumber);
            Assert.Null(submission.StateAuxiliaryIdentifier);
            Assert.Null(submission.NCHSIdentifier);
        }
예제 #4
0
        public ActionResult DeathRecord()
        {
            List <DeathRecord> CategoryList = new List <DeathRecord>();
            Property           p            = new Property();
            DataSet            ds           = new DataSet();

            p.OnTable = "FetchDeathRecord";

            ds = dl.FetchDeathRecord_sp(p);

            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    DeathRecord m = new DeathRecord();

                    m.FieldId  = item["FieldId"].ToString();
                    m.Name     = item["Name"].ToString();
                    m.AddedBy  = item["AddedBy"].ToString();
                    m.IsActive = item["IsActive"].ToString();
                    CategoryList.Add(m);
                }
                ViewBag.CategoryList = CategoryList;
            }
            catch (Exception e)
            {
            }
            return(View());
        }
예제 #5
0
 public Test Run(DeathRecord record)
 {
     TestRecord = new Record(record);
     RecordCompare();
     CompletedDateTime = DateTime.Now;
     CompletedBool     = true;
     return(this);
 }
예제 #6
0
        public void HandleDeathLocationIJE()
        {
            IJEMortality ije1   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/DeathLocation.ije")), true);
            DeathRecord  dr     = ije1.ToDeathRecord();
            IJEMortality ije1rt = new IJEMortality(dr);

            Assert.Equal("4", ije1rt.DPLACE);
        }
예제 #7
0
 public Test Run(string description)
 {
     TestRecord = new Record(DeathRecord.FromDescription(description));
     Compare();
     CompletedDateTime = DateTime.Now;
     CompletedBool     = true;
     return(this);
 }
    public void HeroResurrected(DeathRecord record)
    {
        var resurrectedRecord = existingRecordSlots.Find(existingRecord => existingRecord.Record == record);

        if (resurrectedRecord != null)
        {
            Destroy(resurrectedRecord.gameObject);
        }
    }
예제 #9
0
 public Test(DeathRecord record)
 {
     Created         = DateTime.Now;
     Total           = 0;
     Correct         = 0;
     Incorrect       = 0;
     CompletedBool   = false;
     ReferenceRecord = new Record(record);
 }
예제 #10
0
        public void HandleUnknownBirthRecordId()
        {
            IJEMortality ije1 = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/UnknownBirthRecordId.ije")), true);
            DeathRecord  dr1  = ije1.ToDeathRecord();

            Assert.Null(dr1.BirthRecordId);
            IJEMortality ije1rt = new IJEMortality(dr1);

            Assert.Equal("", ije1rt.BCNO);
        }
 /// <summary>
 /// Construct a DeathRecordSubmission from a FHIR Bundle.
 /// </summary>
 /// <param name="messageBundle">a FHIR Bundle that will be used to initialize the DeathRecordSubmission</param>
 /// <param name="baseMessage">the BaseMessage instance that was constructed during parsing that can be used in a MessageParseException if needed</param>
 internal DeathRecordSubmission(Bundle messageBundle, BaseMessage baseMessage) : base(messageBundle)
 {
     try
     {
         DeathRecord = new DeathRecord(findEntry <Bundle>(ResourceType.Bundle));
     }
     catch (System.ArgumentException ex)
     {
         throw new MessageParseException($"Error processing DeathRecord entry in the message: {ex.Message}", baseMessage);
     }
 }
예제 #12
0
        /// <summary>Set a String value on a DeathRecord.</summary>
        private static void SetStringValueDeathRecordString(DeathRecord deathRecord, string property, string value)
        {
            if (String.IsNullOrWhiteSpace(value))
            {
                return;
            }
            Type         type = deathRecord.GetType();
            PropertyInfo prop = type.GetProperty(property);

            prop.SetValue(deathRecord, value, null);
        }
예제 #13
0
        public async Task <Record> NewDescriptionPost()
        {
            string input = await new StreamReader(Request.Body, Encoding.UTF8).ReadToEndAsync();

            if (!String.IsNullOrEmpty(input))
            {
                DeathRecord record = DeathRecord.FromDescription(input);
                return(new Record(record));
            }
            return(null);
        }
예제 #14
0
        public void HandleOtherCODandCOUNTYC()
        {
            IJEMortality ije1 = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/CODandCOUNTYCOther.ije")), true);

            Assert.Equal("000", ije1.COD);
            Assert.Equal("000", ije1.COUNTYC);

            DeathRecord dr1 = ije1.ToDeathRecord();

            Assert.Equal("OTH", dr1.DeathLocationAddress["addressCounty"]);
            Assert.Equal("OTH", dr1.Residence["addressCounty"]);
        }
예제 #15
0
    public Hero(int rosterId, string classId, DeathRecord deathRecord)
        : base(DarkestDungeonManager.Data.HeroClasses[classId], deathRecord.ResolveLevel)
    {
        InitializeHeroInfo(rosterId, deathRecord.HeroName, classId, deathRecord.ResolveLevel, 10);

        int equipLevel = DarkestDungeonManager.Data.UpgradeTrees[classId + ".weapon"].Upgrades.FindAll(upgrade =>
                                                                                                       upgrade is HeroUpgrade && ((HeroUpgrade)upgrade).PrerequisiteResolveLevel <= deathRecord.ResolveLevel).Count + 1;

        InitializeEquipment(equipLevel, equipLevel);
        InitializeQuirks();
        InitializeCombatSkills();
        InitializeCampingSkills();
    }
예제 #16
0
        public static string SendResponse(HttpListenerRequest request)
        {
            string      requestBody = GetBodyContent(request);
            DeathRecord deathRecord = null;

            Console.WriteLine($"Request from: {request.UserHostAddress}, type: {request.ContentType}, url: {request.RawUrl}.");

            // Look at content type to determine input format; be permissive in what we accept as format specification
            switch (request.ContentType)
            {
            case string ijeType when new Regex(@"ije").IsMatch(ijeType):     // application/ije
                IJEMortality ije = new IJEMortality(requestBody);
                deathRecord = ije.ToDeathRecord();
                break;

            case string nightingaleType when new Regex(@"nightingale").IsMatch(nightingaleType):
                deathRecord = Nightingale.FromNightingale(requestBody);
                break;

            case string jsonType when new Regex(@"json").IsMatch(jsonType):  // application/fhir+json
            case string xmlType when new Regex(@"xml").IsMatch(xmlType):     // application/fhir+xml
            default:
                deathRecord = new DeathRecord(requestBody);
                break;
            }

            // Look at URL extension to determine output format; be permissive in what we accept as format specification
            string result = "";

            switch (request.RawUrl)
            {
            case string url when new Regex(@"(ije|mor)$").IsMatch(url):     // .mor or .ije
                IJEMortality ije = new IJEMortality(deathRecord);
                result = ije.ToString();
                break;

            case string url when new Regex(@"json$").IsMatch(url):     // .json
                result = deathRecord.ToJSON();
                break;

            case string url when new Regex(@"xml$").IsMatch(url):     // .xml
                result = deathRecord.ToXML();
                break;

            case string url when new Regex(@"nightingale$").IsMatch(url):     // .nightingale
                result = Nightingale.ToNightingale(deathRecord);
                break;
            }

            return(result);
        }
예제 #17
0
        public void HandleOtherEthnicityDataInIJE()
        {
            IJEMortality ije1   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/EthnicityOtherCase.ije")), true);
            DeathRecord  dr1    = ije1.ToDeathRecord();
            IJEMortality ije1rt = new IJEMortality(dr1);

            Assert.Equal("N", ije1rt.DETHNIC1);
            Assert.Equal("N", ije1rt.DETHNIC2);
            Assert.Equal("N", ije1rt.DETHNIC3);
            Assert.Equal("H", ije1rt.DETHNIC4);
            Assert.Equal("Guatemalan", ije1rt.DETHNIC5);

            IJEMortality ije2   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/EthnicityOtherCaseNoWriteIn.ije")), true);
            DeathRecord  dr2    = ije2.ToDeathRecord();
            IJEMortality ije2rt = new IJEMortality(dr2);

            Assert.Equal("N", ije2rt.DETHNIC1);
            Assert.Equal("N", ije2rt.DETHNIC2);
            Assert.Equal("N", ije2rt.DETHNIC3);
            Assert.Equal("H", ije2rt.DETHNIC4);

            IJEMortality ije3   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/EthnicityPlusOtherCase.ije")), true);
            DeathRecord  dr3    = ije3.ToDeathRecord();
            IJEMortality ije3rt = new IJEMortality(dr3);

            Assert.Equal("H", ije3rt.DETHNIC1);
            Assert.Equal("N", ije3rt.DETHNIC2);
            Assert.Equal("N", ije3rt.DETHNIC3);
            Assert.Equal("H", ije3rt.DETHNIC4);
            Assert.Equal("Guatemalan", ije3rt.DETHNIC5);

            IJEMortality ije4   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/EthnicityAllH.ije")), true);
            DeathRecord  dr4    = ije4.ToDeathRecord();
            IJEMortality ije4rt = new IJEMortality(dr4);

            Assert.Equal("H", ije4rt.DETHNIC1);
            Assert.Equal("H", ije4rt.DETHNIC2);
            Assert.Equal("H", ije4rt.DETHNIC3);
            Assert.Equal("H", ije4rt.DETHNIC4);

            // the only time unkown are preserved in a roundtrip is when all DETHNIC fields are unknown
            IJEMortality ije5   = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/EthnicityAllUnknown.ije")), true);
            DeathRecord  dr5    = ije5.ToDeathRecord();
            IJEMortality ije5rt = new IJEMortality(dr5);

            Assert.Equal("U", ije5rt.DETHNIC1);
            Assert.Equal("U", ije5rt.DETHNIC2);
            Assert.Equal("U", ije5rt.DETHNIC3);
            Assert.Equal("U", ije5rt.DETHNIC4);
        }
예제 #18
0
        // Writes record to a file named filename in a subdirectory of the current working directory
        //  Note that you do this with docker, you will have to set a bind mount on the container
        public static string WriteRecordAsXml(DeathRecord record, string filename)
        {
            string parentPath = System.IO.Directory.GetCurrentDirectory() + "/connectathon_files";

            System.IO.Directory.CreateDirectory(parentPath);  // in case the directory does not exist
            string fullPath = parentPath + "/" + filename;

            Console.WriteLine("writing record to " + fullPath + " as XML");
            string xml = record.ToXml();

            System.IO.File.WriteAllText(@fullPath, xml);
            // Console.WriteLine(xml);
            return(xml);
        }
예제 #19
0
        public (Record record, List <Dictionary <string, string> > issues) NewPost()
        {
            string input;

            using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
            {
                input = reader.ReadToEnd();
            }
            if (!String.IsNullOrEmpty(input))
            {
                if (input.Trim().StartsWith("<") || input.Trim().StartsWith("{")) // XML or JSON?
                {
                    return(Record.CheckGet(input, false));
                }
                else
                {
                    try // IJE?
                    {
                        if (input.Length != 5000)
                        {
                            return(null, new List <Dictionary <string, string> > {
                                new Dictionary <string, string> {
                                    { "severity", "error" }, { "message", "The given input does not appear to be a valid record." }
                                }
                            });
                        }
                        IJEMortality ije         = new IJEMortality(input);
                        DeathRecord  deathRecord = ije.ToDeathRecord();
                        return(new Record(deathRecord), new List <Dictionary <string, string> > {
                        });
                    }
                    catch (Exception e)
                    {
                        return(null, new List <Dictionary <string, string> > {
                            new Dictionary <string, string> {
                                { "severity", "error" }, { "message", e.Message }
                            }
                        });
                    }
                }
            }
            else
            {
                return(null, new List <Dictionary <string, string> > {
                    new Dictionary <string, string> {
                        { "severity", "error" }, { "message", "The given input appears to be empty." }
                    }
                });
            }
        }
예제 #20
0
        public Record NewDescriptionPost()
        {
            string input;

            using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
            {
                input = reader.ReadToEnd();
            }
            if (!String.IsNullOrEmpty(input))
            {
                DeathRecord record = DeathRecord.FromDescription(input);
                return(new Record(record));
            }
            return(null);
        }
예제 #21
0
        static void Main(string[] args)
        {
            Console.WriteLine("Consuming " + args[0] + "...");

            DeathRecord record = new DeathRecord(XDocument.Load(args[0]));

            Console.WriteLine("Producing " + args[0] + " in XML...");

            StringBuilder builder = new StringBuilder();

            using (TextWriter writer = new StringWriter(builder))
            {
                record.ToXML().Save(writer);
            }
            Console.WriteLine(builder.ToString());
        }
예제 #22
0
 public Test Run(string description)
 {
     if (Type.Contains("Message"))
     {
         TestMessage = new Message(description);
         Results     = MessageCompare();
     }
     else
     {
         TestRecord = new Record(DeathRecord.FromDescription(description));
         Results    = RecordCompare();
     }
     CompletedDateTime = DateTime.Now;
     CompletedBool     = true;
     return(this);
 }
예제 #23
0
        public void HandleUnknownDOBParts()
        {
            IJEMortality ije1 = new IJEMortality(File.ReadAllText(FixturePath("fixtures/ije/DOBDatePartAbsent.ije")), true);

            Assert.Equal("9999", ije1.DOB_YR);
            Assert.Equal("01", ije1.DOB_MO);
            Assert.Equal("01", ije1.DOB_DY);
            DeathRecord dr1 = ije1.ToDeathRecord();

            Assert.True(dr1.DateOfBirthDatePartAbsent != null);

            Tuple <string, string>[] datePart = { Tuple.Create("year-absent-reason", "unknown"), Tuple.Create("date-month", "1"), Tuple.Create("date-day", "1") };
            Assert.Equal(datePart[0], dr1.DateOfBirthDatePartAbsent[0]);
            Assert.Equal(datePart[1], dr1.DateOfBirthDatePartAbsent[1]);
            Assert.Equal(datePart[2], dr1.DateOfBirthDatePartAbsent[2]);
            Assert.Equal("9999-01-01", dr1.DateOfBirth);
        }
예제 #24
0
        /// <summary>Set a String value on a DeathRecord.</summary>
        private static void SetStringValueDeathRecordDictionary(DeathRecord deathRecord, string property, string key, string value)
        {
            if (String.IsNullOrWhiteSpace(value))
            {
                return;
            }
            Type         type = deathRecord.GetType();
            PropertyInfo prop = type.GetProperty(property);
            Dictionary <string, string> dict = (Dictionary <string, string>)prop.GetValue(deathRecord);

            if (dict == null)
            {
                dict = new Dictionary <string, string>();
            }
            dict[key] = value;
            prop.SetValue(deathRecord, dict, null);
        }
예제 #25
0
 /// <summary>Set a Yes/No (coded) value on a DeathRecord.</summary>
 private static void SetYesNoValueDeathRecordBool(DeathRecord deathRecord, string property, string value)
 {
     if (String.IsNullOrWhiteSpace(value))
     {
         return;
     }
     if (value.Trim().ToLower() == "yes")
     {
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, true, null);
     }
     else if (value.Trim().ToLower() == "no")
     {
         Type         type = deathRecord.GetType();
         PropertyInfo prop = type.GetProperty(property);
         prop.SetValue(deathRecord, false, null);
     }
 }
예제 #26
0
        /// <summary>
        /// Extract the business identifiers for the message from the supplied death record.
        /// </summary>
        /// <param name="from">the death record to extract the identifiers from</param>
        protected void ExtractBusinessIdentifiers(DeathRecord from)
        {
            uint certificateNumber;

            if (UInt32.TryParse(from?.Identifier, out certificateNumber))
            {
                this.CertificateNumber = certificateNumber;
            }
            this.StateAuxiliaryIdentifier = from?.StateLocalIdentifier;
            if (from?.DateOfDeath != null)
            {
                uint deathYear;
                if (from?.DateOfDeath?.Length >= 4 && UInt32.TryParse(from?.DateOfDeath?.Substring(0, 4), out deathYear))
                {
                    this.DeathYear = deathYear;
                }
            }
            this.DeathJurisdictionID = from?.DeathLocationAddress?["addressState"];
        }
예제 #27
0
        public static DeathRecord FromId(int id, int?certificateNumber = null, string state = null)
        {
            DeathRecord record = null;

            switch (id)
            {
            case 1:
                record = JanetPage();
                break;

            case 2:
                record = MadelynPatel();
                break;

            case 3:
                record = VivienneLeeWright();
                break;

            case 4:
                record = JavierLuisPerez(partialRecord: false);
                break;

            case 5:
                record = JavierLuisPerez(partialRecord: true);
                break;
            }

            if (record != null && state != null)
            {
                Dictionary <string, string> placeOfDeath = new Dictionary <string, string>();
                placeOfDeath.Add("addressState", state);
                placeOfDeath.Add("addressCountry", "United States");
                record.DeathLocationAddress = placeOfDeath;
            }

            if (record != null && certificateNumber != null)
            {
                record.Identifier = certificateNumber.ToString();
            }

            return(record);
        }
예제 #28
0
        public ActionResult DeathRecord(DeathRecord c)
        {
            HttpCookie rxgoAdminCookie = Request.Cookies["rxgoAdmin"];
            string     AddedBy         = rxgoAdminCookie.Values["Hid"];

            c.AddedBy = AddedBy;
            try
            {
                if (dl.InsertDeathRecord_Sp(c) > 0)
                {
                    TempData["MSG"] = "Death Record Added Successfully";
                }
            }
            catch (Exception ex)
            {
                TempData["MSG"] = "Something went wrong.";
                return(Redirect("/BirthDeath/DeathRecord"));
            }
            TempData["MSG"] = "Death Record Added Successfully.";
            return(Redirect("/BirthDeath/DeathRecord"));
        }
예제 #29
0
        public static DeathRecord FromId(int id, string state = null)
        {
            DeathRecord record = null;

            switch (id)
            {
            case 1:
                record = JanetPage();
                break;

            case 2:
                record = MadelynPatel();
                break;

            case 3:
                record = VivienneLeeWright();
                break;

            case 4:
                record = JavierLuisPerez(partialRecord: false);
                break;

            case 5:
                record = JavierLuisPerez(partialRecord: true);
                break;
            }

            if (record != null && state != null)
            {
                MortalityData dataHelper = MortalityData.Instance;

                Dictionary <string, string> placeOfDeath = new Dictionary <string, string>();
                placeOfDeath.Add("addressState", state);
                placeOfDeath.Add("addressCountry", "United States");
                record.DeathLocationAddress = placeOfDeath;
            }
            return(record);
        }
예제 #30
0
 public void Load(ValuesDictionary valuesDictionary)
 {
     foreach (FieldInfo stat in Stats)
     {
         if (valuesDictionary.ContainsKey(stat.Name))
         {
             object value = valuesDictionary.GetValue <object>(stat.Name);
             stat.SetValue(this, value);
         }
     }
     if (!string.IsNullOrEmpty(DeathRecordsString))
     {
         string[] array = DeathRecordsString.Split(new char[1]
         {
             ';'
         }, StringSplitOptions.RemoveEmptyEntries);
         foreach (string s in array)
         {
             DeathRecord item = default(DeathRecord);
             item.Load(s);
             m_deathRecords.Add(item);
         }
     }
 }