Example #1
0
        /// <summary>
        /// Parse a single line of snomed concept rf2 file.
        /// </summary>
        /// <param name="parser"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        public static RF2Concept Parse(RF2Parser parser, String line)
        {
            String[] parts = line.Split('\t');
            if (parts.Length != 5)
            {
                throw new ApplicationException("Invalid concept line");
            }

            return(new RF2Concept()
            {
                Parser = parser,
                Id = Int64.Parse(parts[0]),
                EffectiveTime = ParseEffectiveTime(parts[1]),
                Active = ParseBool(parts[2]),
                ModuleId = Int64.Parse(parts[3]),
                DefinitionStatusId = Int64.Parse(parts[4])
            });
        }
Example #2
0
        /// <summary>
        /// Parse line of input into new RF2Description and return it.
        /// </summary>
        /// <param name="parser"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        public static RF2Description Parse(RF2Parser parser, String line)
        {
            String[] parts = line.Split('\t');
            if (parts.Length != 9)
            {
                throw new ApplicationException("Invalid Description line");
            }

            return(new RF2Description()
            {
                Parser = parser,
                Id = Int64.Parse(parts[0]),
                EffectiveTime = ParseEffectiveTime(parts[1]),
                Active = ParseBool(parts[2]),
                ModuleId = Int64.Parse(parts[3]),
                ConceptId = Int64.Parse(parts[4]),
                LanguageCode = parts[5],
                TypeId = Int64.Parse(parts[6]),
                Term = parts[7],
                CaseSignificanceId = Int64.Parse(parts[8])
            });
        }
Example #3
0
        /// <summary>
        /// Parse single line from relationship rf2 file.
        /// </summary>
        /// <param name="parser"></param>
        /// <param name="line"></param>
        /// <returns></returns>
        public static RF2Relationship Parse(RF2Parser parser, String line)
        {
            String[] parts = line.Split('\t');
            if (parts.Length != 10)
            {
                throw new ApplicationException("Invalid Relationship line");
            }

            return(new RF2Relationship()
            {
                Parser = parser,
                Id = Int64.Parse(parts[0]),
                EffectiveTime = ParseEffectiveTime(parts[1]),
                Active = ParseBool(parts[2]),
                ModuleId = Int64.Parse(parts[3]),
                SourceId = Int64.Parse(parts[4]),
                DestinationId = Int64.Parse(parts[5]),
                RelationshipGroup = Int32.Parse(parts[6]),
                TypeId = Int64.Parse(parts[7]),
                CharacteristicTypeId = Int64.Parse(parts[8]),
                ModifierId = Int64.Parse(parts[9])
            });
        }
Example #4
0
        /// <summary>
        /// Parse and serialize Snomed.
        /// </summary>
        public void ParseAndSerialize()
        {
            String baseDir = Path.Combine(Assembly.GetExecutingAssembly().Location,
                                          "..",
                                          "..",
                                          "..",
                                          "..",
                                          "Data");

            this.modelManager = new SnomedModelManager(baseDir);

            this.rf2Parser = new RF2Parser();
            this.rf2Parser.Load(this.SnomedConceptFile, this.SnomedRelationshipFile, this.SnomedDescriptionFile);

            Console.WriteLine("Creating concept records");
            this.CreateConceptRecords();

            Console.WriteLine("Creating relationship records");
            this.CreateRelationships();

            this.modelManager.Serialize();
            this.rf2Parser = null;
        }