private string GetDsioCodeSystem(CodingSystem codingSystem)
        {
            //string[] codeSystemDescription = new string[] { "NONE", "LOINC", "SNOMED" };
            string[] codeSystemDescription = new string[] { "N", "L", "S", "O" };

            return(codeSystemDescription[(int)codingSystem]);
        }
Exemplo n.º 2
0
        public static CodingSystem GetCodingSystemName(string codingSystemName)
        {
            CodingSystem returnVal = CodingSystem.None;

            switch (codingSystemName)
            {
            case "LOINC":
            case "LNC":
                returnVal = CodingSystem.Loinc;
                break;

            case "SNOMED CT":
            case "SNOMED":
            case "SNOMED-CT":
            case "SCT":
                returnVal = CodingSystem.SnomedCT;
                break;

            case "OTHER":
                returnVal = CodingSystem.Other;
                break;

            case "VHA":
                returnVal = CodingSystem.Vha;
                break;
            }

            return(returnVal);
        }
Exemplo n.º 3
0
        private int ParseFirstRawDataSegment(ProgramInfo programInfo, string input, int startIndex)
        {
            // find start and end
            int dataBeginTag = input.IndexOf(_dataBegin, startIndex);
            int dataEndTag   = input.IndexOf(_dataEnd, startIndex);

            if (dataBeginTag < 0 || dataEndTag < 0)
            {
                return(-1);
            }

            // remove the first # from each line
            string segmentRaw = input.Substring(dataBeginTag + _dataBegin.Length, dataEndTag - (dataBeginTag + _dataBegin.Length));
            string segment    = RemoveHeadCommentMarks(segmentRaw).Trim();

            // get start address
            string[] elements = segment.Split();

            RawDataSegment rawDataSegment = new RawDataSegment();

            rawDataSegment.StartAddress = uint.Parse(elements[0]);

            // get radix
            CodingSystem codingSystem = CodingSystem.Binary;

            if (elements[1] == "2")
            {
                codingSystem = CodingSystem.Binary;
            }
            else if (elements[1] == "16")
            {
                codingSystem = CodingSystem.Hex;
            }

            // get raw data
            int i;

            for (i = 2; i < elements.Length; i++)
            {
                switch (codingSystem)
                {
                case CodingSystem.Binary:
                    rawDataSegment.Data.Add(
                        Convert.ToByte(elements[i], 2)
                        );
                    break;

                case CodingSystem.Hex:
                    rawDataSegment.Data.Add(
                        Convert.ToByte(elements[i], 16)
                        );
                    break;

                default:
                    break;
                }
            }
            programInfo.RawDataSegments.Add(rawDataSegment);
            return(dataEndTag);
        }
Exemplo n.º 4
0
 public ValueSetItem(string code, CodingSystem system, string name, string category)
 {
     this.Code       = code;
     this.CodeSystem = system;
     this.ItemName   = name;
     this.Category   = category;
 }
Exemplo n.º 5
0
        private void AddPhysicalExamSubsection(CodingSystem codingSys, string code, string displayName, string templateId, string sectionTitle)
        {
            // *** Adds a subsection to the list ***

            PhysicalExamSubsection tempSubsection = PhysicalExamSubsectionFactory.CreateSubsection(codingSys, code, displayName, templateId, sectionTitle);

            this.Subsections.Add(code, tempSubsection);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Sets code information
 /// </summary>
 /// <param name="codeSysNm">The coding system name</param>
 /// <param name="sysId">The coding system id</param>
 /// <param name="cd">The code</param>
 /// <param name="dispName">The display name of the code</param>
 /// <param name="cdSys">The coding system</param>
 public void SetCode(string codeSysNm, string sysId, string cd, string dispName, CodingSystem cdSys)
 {
     this.codeSystemName = codeSysNm;
     this.codeSystemId   = sysId;
     this.code           = cd;
     this.displayName    = dispName;
     this.codeSystem     = cdSys;
 }
Exemplo n.º 7
0
 public CdaProcedure(DateTime dateTime, CodingSystem codingSystem, string code, string displayName)
 {
     this.Id            = Guid.NewGuid().ToString();
     this.EffectiveTime = new CdaEffectiveTime()
     {
         High = dateTime
     };
     this.Code = new CdaCode()
     {
         CodeSystem = codingSystem, Code = code, DisplayName = displayName
     };
 }
        public EducationItemsResult LoadDefaults()
        {
            EducationItemsResult returnResult = new EducationItemsResult();

            bool ok = false;

            EducationItemsResult result = this.GetEducationItems("", "", EducationItemType.Unknown, 0, 0, EducationItemSort.Type);

            if (result.Success)
            {
                if (result.EducationItems == null)
                {
                    ok = true;
                }
                else if (result.EducationItems.Count == 0)
                {
                    ok = true;
                }
            }

            if (ok)
            {
                AntepartumEducationValueSet valueSet = new AntepartumEducationValueSet();

                foreach (ValueSetItem item in valueSet.Items)
                {
                    //    public enum CodingSystem {None, Loinc, SnomedCT}

                    CodingSystem[] translation = new CodingSystem[] { CodingSystem.None, CodingSystem.Loinc, CodingSystem.SnomedCT };

                    EducationItem edItem = new EducationItem();
                    edItem.Description  = item.ItemName;
                    edItem.Category     = item.Category;
                    edItem.Code         = item.Code;
                    edItem.CodingSystem = translation[(int)item.CodeSystem];
                    edItem.ItemType     = EducationItemType.DiscussionTopic;

                    IenResult saveResult = this.SaveEducationItem(edItem);

                    returnResult.SetResult(saveResult.Success, saveResult.Message);

                    if (!saveResult.Success)
                    {
                        break;
                    }
                }
            }

            return(returnResult);
        }
        public static CdaCodeObservation CreateCodeObservation(CodingSystem codeSystem, string code, string description)
        {
            CdaCodeObservation returnVal = new CdaCodeObservation();

            // *** Add Id, status ***
            returnVal.Id     = Guid.NewGuid().ToString(); //observation.Ien;
            returnVal.Status = Hl7ProblemActStatus.completed;

            // *** Add code ***
            returnVal.Value = new CdaCode()
            {
                CodeSystem = codeSystem, Code = code, DisplayName = description
            };

            return(returnVal);
        }
        private CodingSystem GetCodingSystem(string dsioCodeSystem)
        {
            CodingSystem returnVal = CodingSystem.None;

            switch (dsioCodeSystem)
            {
            case "LOINC":
                returnVal = CodingSystem.Loinc;
                break;

            case "SNOMED":
                returnVal = CodingSystem.SnomedCT;
                break;
            }

            return(returnVal);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Creates a Physical Exam Subsection using initial values that are required
        /// </summary>
        /// <param name="codingSys">The system of coding</param>
        /// <param name="code">The code used</param>
        /// <param name="displayName">The name associated with the code</param>
        /// <param name="templateId">The template id of the sub-section</param>
        /// <param name="sectionTitle">The title of the section</param>
        /// <returns>A new PhysicalExamSubsection</returns>
        public static PhysicalExamSubsection CreateSubsection(CodingSystem codingSys, string code, string displayName, string templateId, string sectionTitle)
        {
            PhysicalExamSubsection returnVal = new PhysicalExamSubsection();

            // *** Get system info ***
            string codeSysName = CodingSystemUtility.GetDescription(codingSys);
            string codeSysId   = CodingSystemUtility.GetSystemId(codingSys);

            // *** Set the code ***
            returnVal.SetCode(codeSysName, codeSysId, code, displayName, codingSys);

            // *** Set the template id ***
            returnVal.SetTemplateIds(templateId);

            // *** Set the section title ***
            returnVal.SetSectionTitle(sectionTitle);

            return(returnVal);
        }
Exemplo n.º 12
0
        public MachineCodePack(string fullMachingCode, CodingSystem coding)
        {
            List <Word32b> code = new List <Word32b>();

            fullMachingCode = fullMachingCode.Replace(" ", "");
            fullMachingCode = fullMachingCode.Replace("\n", "");

            int cursor = 0;

            while (cursor < fullMachingCode.Length)
            {
                // get sub string
                string subString = "";
                switch (coding)
                {
                case CodingSystem.Binary:
                    subString = fullMachingCode.Substring(cursor, 32);
                    break;

                case CodingSystem.Hex:
                    subString = fullMachingCode.Substring(cursor, 8);
                    break;
                }
                // pack up word
                Word32b word = new Word32b(subString, coding);
                code.Add(word);
                // find next word
                switch (coding)
                {
                case CodingSystem.Binary:
                    cursor += 32;
                    break;

                case CodingSystem.Hex:
                    cursor += 8;
                    break;
                }
            }
            AddCode(code);
        }
Exemplo n.º 13
0
        public Word32b(string value, CodingSystem system)
        {
            switch (system)
            {
            case CodingSystem.Binary:
                if (value.Length < 32)
                {
                    throw new Exception("Length of binary string should be 32");
                }
                break;

            case CodingSystem.Hex:
                if (value.Length < 8)
                {
                    throw new Exception("Length of Hex string should be 8");
                }
                break;

            default:
                break;
            }
            int i;

            for (i = 0; i < 4; i++)
            {
                switch (system)
                {
                case CodingSystem.Binary:
                    this.Value[3 - i] = Convert.ToByte(value.Substring(i * 8, 8), 2);
                    break;

                case CodingSystem.Hex:
                    this.Value[3 - i] = Convert.ToByte(value.Substring(i * 2, 2), 16);
                    break;

                default:
                    break;
                }
            }
        }
Exemplo n.º 14
0
        private static void WriteRawTextCodeToRam(string filePath, MipsMachine vm, CodingSystem coding)
        {
            string rawTextCode;

            try
            {
                rawTextCode = File.ReadAllText(filePath);
            }
            catch (Exception)
            {
                Console.WriteLine("[Error] Invalid file");
                return;
            }
            MachineCodePack machineCode = new MachineCodePack(rawTextCode, coding);

            vm.Reset(machineCode);

            // print the next instructions
            PrintNextInstructions(vm, 16);
            // // print changes
            // PrintChanges(vm);
            vm.CleanLog();
        }
Exemplo n.º 15
0
 public static string GetSystemId(CodingSystem codingSystem)
 {
     return(ids[(int)codingSystem]);
 }
Exemplo n.º 16
0
 public static string GetDescription(CodingSystem codingSystem)
 {
     return(descriptions[(int)codingSystem]);
 }