示例#1
0
        public Action(DvText name, string archetypeNodeId, UidBasedId uid,
         Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
         CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
         Participation[] otherParticipations, ObjectRef workflowId, ItemStructure protocol,
         ObjectRef guidelineId, DvDateTime time, ItemStructure description,
            IsmTransition ismTransition, InstructionDetails instructionDetails)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit, language,
          encoding, subject, proider, otherParticipations, workflowId, protocol, guidelineId)
        {
            Check.Require(time != null, "time must not be null");
            Check.Require(description != null, "description must not be null");
            Check.Require(ismTransition != null, "ismTransition must not be null");

            this.time = time;
            this.description = description;
            if (this.description != null)
                this.description.Parent = this;
            this.ismTransition = ismTransition;
            if (this.ismTransition != null)
                this.ismTransition.Parent = this;
            this.instructionDetails = instructionDetails;
            if (this.instructionDetails != null)
                this.instructionDetails.Parent = this;

            SetAttributeDictionary();
            CheckInvariants();
        }
示例#2
0
 public CDvQuantity(string rmTypeName, string nodeId, AssumedTypes.Interval<int> occurrences,
     CAttribute parent, object assumedValue, List<CQuantityItem> list, CodePhrase property)
     : base(rmTypeName, nodeId, occurrences, parent, assumedValue)
 {
     this.List = list;
     this.Property = property;
 }
示例#3
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="language">Language of translation</param>
 /// <param name="author">Translator name and other demographic details</param>
 /// <param name="accreditation">Accreditation of translator, usually a national translator’s association id</param>
 /// <param name="otherDetails">Any other meta-data</param>
 public TranslationDetails(CodePhrase language, AssumedTypes.Hash<string, string> author,
     string accreditation, AssumedTypes.Hash<string, string> otherDetails)
 {
     this.language = language;
     this.author = author;
     this.accreditation = accreditation;
     this.otherDetails = otherDetails;
 }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="language">The localised language in which the items in this description item are written. Coded from
        /// openEHR Code Set “languages”.</param>
        /// <param name="purpose">Purpose of the resource.</param>
        public ResourceDescriptionItem(CodePhrase language, string purpose)
        {
            Check.Require(language != null, "language must not be null.");
            Check.Require(!string.IsNullOrEmpty(purpose), "purpose must not be null or empty.");

            this.language = language;
            this.purpose = purpose;
        }
示例#5
0
        public DvText(string value, OpenEhr.RM.DataTypes.Uri.DvUri hyperlink, string formatting,
            List<TermMapping> mappings, CodePhrase language, CodePhrase encoding)
            : this()
        {
            this.SetBaseData(value, hyperlink, formatting, mappings, language, encoding);

            this.CheckInvariants();
        }
示例#6
0
        public TermMapping(char match, DvCodedText purpose, CodePhrase target)
            : this()
        {
            this.match = match;
            this.purpose = purpose;
            this.target = target;

            this.CheckInvariants();
        }
示例#7
0
        protected AuthoredResource(CodePhrase originalLanguage, Generic.RevisionHistory revisionHistory,
            bool isControlled)
        {
            DesignByContract.Check.Require(originalLanguage!= null, "originalLanguage must not be null.");
            DesignByContract.Check.Require(!isControlled ^ revisionHistory != null, "RevisionHistory is only required if isControlled is true");

            this.originalLanguage = originalLanguage;
            this.IsControlled = isControlled;
            this.revisionHistory = revisionHistory;
        }
示例#8
0
        public DvCodedText(string value, OpenEhr.RM.DataTypes.Uri.DvUri hyperlink, string formatting,
            List<TermMapping> mappings, CodePhrase language, CodePhrase encoding, string codeString, 
            string terminologyId)
            : this()
        {
            this.SetBaseData(value, hyperlink, formatting, mappings, language, encoding);
            this.definingCode = new CodePhrase(codeString, terminologyId);

            this.CheckInvariants();
        }
示例#9
0
        public DvParsable(CodePhrase charset, CodePhrase language, string value, string formalism)
            : this()
        {
            DesignByContract.Check.Require(value != null, "value must not be null");  // can be empty
            DesignByContract.Check.Require(!string.IsNullOrEmpty(formalism), "formalism must not be null or empty");

            this.SetBaseData(charset, language);
            this.value = value;
            this.formalism = formalism;

            this.CheckInvariants();
        }
示例#10
0
        protected AuthoredResource(CodePhrase originalLanguage, AssumedTypes.Hash<TranslationDetails, string> translations,
           ResourceDescription description, Generic.RevisionHistory revisionHistory, bool isControlled)
            : this(originalLanguage, revisionHistory, isControlled)
        {
            DesignByContract.Check.Require(translations == null ^
                (translations.Keys.Count>0 && !translations.HasKey(this.originalLanguage.CodeString)),
                "translations is not null means it must not be empty and it must not contains original language.");
            DesignByContract.Check.Require(translations == null ^ (description != null && translations != null),
               "if translations !=null, descriptions must not be null");

            this.translations = translations;
            this.description = description;
        }
示例#11
0
        public Archetype(ArchetypeId archetypeId, string concept, CComplexObject definition,
            ArchetypeOntology ontology, CodePhrase originalLanguage, RevisionHistory revisionHistory,
            bool isControlled)
            : base(originalLanguage, revisionHistory, isControlled)
        {
            Check.Require(archetypeId != null, string.Format(CommonStrings.XMustNotBeNull, "archetypeId"));
            Check.Require(!string.IsNullOrEmpty(concept) != null, string.Format(CommonStrings.XMustNotBeNullOrEmpty, "concept"));
            Check.Require(definition != null, string.Format(CommonStrings.XMustNotBeNull, "definition"));
            Check.Require(ontology != null, string.Format(CommonStrings.XMustNotBeNull, "ontology"));

            this.archetypeId = archetypeId;
            this.definition = definition;
            this.ontology = ontology;
        }
示例#12
0
        public AdminEntry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
           Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
            CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
            Participation[] otherParticipations, ObjectRef workflowId,
            ItemStructure data)
            : base(name, archetypeNodeId, uid, links, archetypeDetails,
            feederAudit, language, encoding, subject, proider, otherParticipations, workflowId)
        {
            Check.Require(data != null, "data must not be null");

            this.data = data;
            this.data.Parent = this;

            SetAttributeDictionary();
            this.CheckInvariants();
        }
示例#13
0
文件: Entry.cs 项目: nickvane/OpenEHR
        protected Entry(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
           Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
            CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
            Participation[] otherParticipations, ObjectRef workflowId)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit)
        {
            Check.Require(language != null, "language must not be null");
            Check.Require(encoding != null, "encoding must not be null");
            Check.Require(subject != null, "subject must not be null");

            this.language = language;
            this.encoding = encoding;
            this.subject = subject;
            this.provider = proider;
            if (otherParticipations != null)
                this.otherParticipations = new OpenEhr.AssumedTypes.List<Participation>(otherParticipations);
            this.workflowId = workflowId;
        }
示例#14
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="language">The localised language in which the items in this description item are written. Coded from
        /// openEHR Code Set “languages”.</param>
        /// <param name="purpose">Purpose of the resource.</param>
        /// <param name="keywords">Keywords which characterise this resource, used e.g. for indexing and searching.</param>
        /// <param name="use">Description of the uses of the resource, i.e. contexts in which it could be used.</param>
        /// <param name="misuse">Description of any misuses of the resource, i.e. contexts in which it should not be used.</param>
        /// <param name="copyright">Optional copyright statement for the resource as a knowledge resource.</param>
        /// <param name="originalResourceUri">URIs of original clinical document(s) or description of which resource is a formalisation,
        /// in the language of this description item; keyed by meaning.</param>
        /// <param name="otherDetails">Additional language-senstive resource metadata, as a list of name/value pairs.</param>
        public ResourceDescriptionItem(CodePhrase language, string purpose, AssumedTypes.List<string> keywords,
            string use, string misuse, string copyright, AssumedTypes.Hash<string, string> originalResourceUri,
            AssumedTypes.Hash<string, string> otherDetails)
            : this(language, purpose)
        {
            Check.Require(use == null || use != string.Empty, "if use is not null, it must not be empty");
            Check.Require(misuse == null || misuse != string.Empty, "if misuse is not null, it must not be empty");
            Check.Require(copyright == null || copyright != string.Empty, "if copyright is not null, it must not be empty");

            this.language = language;
            this.purpose = purpose;
            this.purpose = purpose;
            this.keywords = keywords;
            this.use = use;
            this.misuse = misuse;
            this.copyright = copyright;
            this.originalResourceUri = originalResourceUri;
            this.otherDetails = otherDetails;
        }
示例#15
0
        public Observation(DvText name, string archetypeNodeId, Support.Identification.UidBasedId uid,
           Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
           CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
           Participation[] otherParticipations, ObjectRef workflowId, ItemStructure protocol,
           ObjectRef guidelineId, History<ItemStructure> data, History<ItemStructure> state)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit, language,
            encoding, subject, proider, otherParticipations, workflowId, protocol, guidelineId)
        {
            Check.Require(data != null, "data must not be null");

            this.data = data;
            if (this.data != null)
                this.data.Parent = this;
            this.state = state;
            if (this.state != null)
                this.state.Parent = this;

            SetAttributeDictionary();
            CheckInvariants();
        }
示例#16
0
        public Instruction(DvText name, string archetypeNodeId, UidBasedId uid,
         Link[] links, Archetyped archetypeDetails, FeederAudit feederAudit,
         CodePhrase language, CodePhrase encoding, PartyProxy subject, PartyProxy proider,
         Participation[] otherParticipations, ObjectRef workflowId, ItemStructure protocol,
         ObjectRef guidelineId, DvText narrative, DvDateTime expiryTime,
         Activity[] activities, DvParsable wfDefinition)
            : base(name, archetypeNodeId, uid, links, archetypeDetails, feederAudit, language,
          encoding, subject, proider, otherParticipations, workflowId, protocol, guidelineId)
        {
            Check.Require(narrative != null, "narrative must not be null");

            this.narrative = narrative;
            this.expiryTime = expiryTime;
            if (activities != null)
            {
                this.activities = RmFactory.LocatableList<Activity>(this, activities);
            }
            this.wfDefinition = wfDefinition;

            SetAttributeDictionary();
            CheckInvariants();
        }
示例#17
0
        public List<CodePhrase> GetAllCodes(string name)
        {
            var results = new List<CodePhrase>();
            try
            {
                var navigator = _termDocument.Value.CreateNavigator();
                foreach (XPathNavigator codeNav in navigator.Select("/terminology/codeset[@external_id='" + name + "']/*"))
                {
                    var selectSingleNode = codeNav.SelectSingleNode("@value");
                    if (selectSingleNode == null) continue;
                    var code = selectSingleNode.Value;

                    var codePhrase = new CodePhrase(code, name);

                    results.Add(codePhrase);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(string.Format("Could not read codes for {0} \n {1}", name, ex.Message));
            }

            return results;
        }
示例#18
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "original_language", "Expected LocalName is 'original_language' rather than " + reader.LocalName);
            this.originalLanguage = new CodePhrase();
            this.OriginalLanguage.ReadXml(reader);

            if (reader.LocalName == "is_controlled")
            {
                this.IsControlled = reader.ReadElementContentAsBoolean("is_controlled", RmXmlSerializer.OpenEhrNamespace);

            }
            if (reader.LocalName == "description")
            {
                this.description = new ResourceDescription();
                this.description.ReadXml(reader);
            }

            string translationsNodeName = "translations";
            if (reader.LocalName == translationsNodeName)
            {
                System.Collections.Generic.Dictionary<string, TranslationDetails> translationDic = new Dictionary<string, TranslationDetails>();
                do
                {
                    TranslationDetails transDetails = new TranslationDetails();
                    transDetails.ReadXml(reader);

                    translationDic.Add(transDetails.Language.CodeString, transDetails);
                } while (reader.LocalName == translationsNodeName);

                if (translationDic.Count > 0)
                    this.translations = new OpenEhr.AssumedTypes.Hash<TranslationDetails, string>(translationDic);
            }

            if (reader.LocalName == "revision_history")
            {
                this.revisionHistory = new OpenEhr.RM.Common.Generic.RevisionHistory();
                this.revisionHistory.ReadXml(reader);
            }
        }
示例#19
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="language">Language of translation</param>
 /// <param name="author">Translator name and other demographic details</param>
 public TranslationDetails(CodePhrase language, AssumedTypes.Hash<string, string> author)
 {
     this.language = language;
     this.author = author;
 }
示例#20
0
        protected void SetBaseData(string value, OpenEhr.RM.DataTypes.Uri.DvUri hyperlink, string formatting,
            List<TermMapping> mappings, CodePhrase language, CodePhrase encoding)
        {
            this.value = value;
            this.hyperlink = hyperlink;
            this.formatting = formatting;

            if (mappings != null && mappings.Count > 0)
            {
                if (this.mappings == null)
                    this.mappings = new OpenEhr.AssumedTypes.List<TermMapping>();
                foreach (TermMapping mapping in mappings)
                {
                    this.mappings.Add(mapping);
                }
            }
            this.language = language;
            this.encoding = encoding;
        }
示例#21
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            //reader.ReadStartElement();
            //reader.MoveToContent();

            string openEhrNamespace = RmXmlSerializer.OpenEhrNamespace;

            Check.Assert(reader.LocalName == "value", "reader.LocalName must be 'value'");
            //this.value = reader.ReadElementString("value", openEhrNamespace);
            //this.valueSet = true;
            SetValue(reader.ReadElementString("value", openEhrNamespace));

            reader.MoveToContent();

            if (reader.LocalName == "hyperlink")
            {
                string linkType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                if (linkType != null)
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
                else
                    this.hyperlink = new OpenEhr.RM.DataTypes.Uri.DvUri();
                this.hyperlink.ReadXml(reader);
            }

            if (reader.LocalName == "formatting")
            {
                this.formatting = reader.ReadElementString("formatting", openEhrNamespace);
                //this.formattingSet = true;
            }

               // TODO: TermMapping
            if (reader.LocalName == "mappings")
            {
                this.mappings = new OpenEhr.AssumedTypes.List<TermMapping>(); //new List<TermMapping>();
                do
                {
                    TermMapping mapping = new TermMapping();
                    mapping.ReadXml(reader);
                    this.mappings.Add(mapping);

                } while (reader.LocalName == "mapping" && reader.NodeType == System.Xml.XmlNodeType.Element);
            }

            // language
            if (reader.LocalName == "language")
            {
                if (this.language == null)
                    this.language = new CodePhrase();
                this.language.ReadXml(reader);
                //this.languageSet = true;
            }

            // encoding
            if (reader.LocalName == "encoding")
            {
                if (this.encoding == null)
                    this.encoding = new CodePhrase();
                this.encoding.ReadXml(reader);
                //this.encodingSet = true;
            }
        }
示例#22
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "match", "local name must be 'match' rather than "+reader.LocalName);
            this.match = reader.ReadElementString("match", RmXmlSerializer.OpenEhrNamespace).ToCharArray()[0];
            reader.MoveToContent();

            if (reader.LocalName == "purpose")
            {
                this.purpose = new DvCodedText();
                this.purpose.ReadXml(reader);
            }

            Check.Assert(reader.LocalName == "target", "Expected localName is 'target' not "+reader.LocalName);
            this.target = new CodePhrase();
            this.target.ReadXml(reader);

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement,
                "Expected endElement of TermMapping");
            reader.ReadEndElement();
            reader.MoveToContent();

            this.CheckInvariants();
        }
示例#23
0
 public DvCodedText(string value, string codeString, string terminologyId)
     : this()
 {
     this.SetValue(value);
     this.definingCode = new CodePhrase(codeString, terminologyId);
 }
示例#24
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "language", "Expected local name is 'language', not " + reader.LocalName);
            this.language = new CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "author", "Expected local name is 'author', not " + reader.LocalName);

            System.Collections.Generic.Dictionary<string, string> authorDic
                = new System.Collections.Generic.Dictionary<string, string>();
            while (reader.LocalName == "author")
            {
                string id = reader.GetAttribute("id");
                Check.Assert(!string.IsNullOrEmpty(id), "attribute 'id' must not be null or empty for author");
                string value = reader.ReadElementContentAsString();

                authorDic.Add(id, value);

            }
            Check.Assert(authorDic.Count>0, "Expected at least one author item in the dictionary.");
            this.author = new OpenEhr.AssumedTypes.Hash<string, string>(authorDic);

            if (reader.LocalName == "accreditation")
            {
                this.accreditation = reader.ReadElementString("accreditation", RmXmlSerializer.OpenEhrNamespace);
            }

            System.Collections.Generic.Dictionary<string, string> otherDetailsDic
                = new System.Collections.Generic.Dictionary<string,string>();
            while (reader.LocalName == "other_details")
            {
                string id = reader.GetAttribute("id");
                Check.Assert(!string.IsNullOrEmpty(id), "attribute 'id' must not be null or empty for other_details");
                string value = reader.ReadElementString("other_details", RmXmlSerializer.OpenEhrNamespace);

                otherDetailsDic.Add(id, value);

            }
            if (otherDetailsDic.Count > 0)
                this.otherDetails = new OpenEhr.AssumedTypes.Hash<string, string>(otherDetailsDic);

            reader.MoveToContent();

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
示例#25
0
        private void ReadXml(CCodePhrase cDomainType)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            this.ReadXmlBase((CObject)cDomainType);

            if (reader.LocalName == "assumed_value")
            {
                CodePhrase assumedValue = new CodePhrase();
                assumedValue.ReadXml(reader);
                cDomainType.AssumedValue = assumedValue;
            }

            if (reader.LocalName == "terminology_id")
            {
                cDomainType.TerminologyId = new TerminologyId();
                cDomainType.TerminologyId.ReadXml(reader);
            }

            if (reader.LocalName == "code_list")
            {
                OpenEhr.AssumedTypes.List<string> codeList = new OpenEhr.AssumedTypes.List<string>();
                do
                {
                    string codeString = reader.ReadElementContentAsString("code_list", OpenEhrNamespace);
                    reader.MoveToContent();
                    codeList.Add(codeString);
                } while (reader.LocalName == "code_list");

                Check.Assert(!codeList.IsEmpty(), "codeList must not be empty.");

                cDomainType.CodeList = codeList;
            }

            reader.ReadEndElement();
            reader.MoveToContent();
        }
示例#26
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "language", "Expected local name is 'language', not " + reader.LocalName);
            this.language = new CodePhrase();
            this.language.ReadXml(reader);

            Check.Assert(reader.LocalName == "purpose", "Expected local name is 'purpose', not " + reader.LocalName);
            this.purpose = reader.ReadElementString("purpose", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            while (reader.LocalName == "keywords")
            {
                if (this.keywords == null)
                    this.keywords = new OpenEhr.AssumedTypes.List<string>();
                this.keywords.Add(reader.ReadElementString("keywords", RmXmlSerializer.OpenEhrNamespace));
                reader.MoveToContent();
            }

            if (reader.LocalName == "use")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.use = reader.ReadElementString("use", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "misuse")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.misuse = reader.ReadElementString("misuse", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "copyright")
            {
                // TODO don't need this when the xml instance is fixed
                if (reader.IsEmptyElement)
                    reader.Skip();
                else
                    this.Copyright = reader.ReadElementString("copyright", RmXmlSerializer.OpenEhrNamespace);
                reader.MoveToContent();
            }

            if (reader.LocalName == "original_resource_uri")
            {
                System.Collections.Generic.Dictionary<string, string> originalResourceUriDic =
                    new System.Collections.Generic.Dictionary<string, string>();
                while (reader.LocalName == "original_resource_uri")
                {
                    string id = reader.GetAttribute("id");
                    if (string.IsNullOrEmpty(id))
                        throw new ValidationException("original_resource_uri must have id attribute and its value must not be null or empty.");
                    string value = reader.ReadElementString("original_resource_uri", RmXmlSerializer.OpenEhrNamespace);
                    reader.MoveToContent();
                    if (string.IsNullOrEmpty(value))
                        throw new ValidationException("original_resource_uri value must not be null or empty.");

                    originalResourceUriDic.Add(id, value);
                }
                if (originalResourceUriDic.Count <= 0)
                    throw new ValidationException("originalResourceUriDic must not be empty.");

                this.originalResourceUri = new OpenEhr.AssumedTypes.Hash<string, string>(originalResourceUriDic);
            }

            if (reader.LocalName == "other_details")
            {
                System.Collections.Generic.Dictionary<string, string> otherDetailsUriDic =
                    new System.Collections.Generic.Dictionary<string, string>();
                while (reader.LocalName == "other_details")
                {
                    string id = reader.GetAttribute("id");
                    if (string.IsNullOrEmpty(id))
                        throw new ValidationException("original_resource_uri must have id attribute and its value must not be null or empty.");
                    string value = reader.ReadElementString("original_resource_uri", RmXmlSerializer.OpenEhrNamespace);
                    reader.MoveToContent();
                    if (string.IsNullOrEmpty(value))
                        throw new ValidationException("original_resource_uri value must not be null or empty.");

                    otherDetailsUriDic.Add(id, value);
                }
                if (otherDetailsUriDic.Count <= 0)
                    throw new ValidationException("originalResourceUriDic must not be empty.");

                this.otherDetails = new OpenEhr.AssumedTypes.Hash<string, string>(otherDetailsUriDic);
            }

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }
        }
示例#27
0
        private void ReadXml(ArchetypeOntology archetypeOntology)
        {
            Check.Require(archetypeOntology!= null, "archetypeOntology must not be null.");

            reader.ReadStartElement();
            reader.MoveToContent();

            if (reader.LocalName == "term_definitions")
            {

                System.Collections.Generic.Dictionary<string, AssumedTypes.Hash<ArchetypeTerm, string>> termDefinitionsDic =
                    new Dictionary<string, OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>>();
                do
                {
                    string language = reader.GetAttribute("language");

                    reader.ReadStartElement();
                    reader.MoveToContent();

                    Dictionary<string, ArchetypeTerm> termDefimitionItemDic = new Dictionary<string, ArchetypeTerm>();

                    while (reader.LocalName == "items")
                    {
                        ArchetypeTerm archetypeTerm = new ArchetypeTerm();
                        this.ReadXml(archetypeTerm);

                        termDefimitionItemDic.Add(archetypeTerm.Code, archetypeTerm);
                    }

                    reader.ReadEndElement();
                    reader.MoveToContent();

                    AssumedTypes.Hash<ArchetypeTerm, string> archetypeTermHash = new OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>(termDefimitionItemDic);

                    termDefinitionsDic.Add(language, archetypeTermHash);

                } while (reader.LocalName == "term_definitions");

                DesignByContract.Check.Assert(termDefinitionsDic.Count > 0, "termDefinitionDic must not be emppty.");

                archetypeOntology.TermDefinitions = new OpenEhr.AssumedTypes.Hash<OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>, string>(termDefinitionsDic);
            }

            if (reader.LocalName == "constraint_definitions")
            {

                System.Collections.Generic.Dictionary<string, AssumedTypes.Hash<ArchetypeTerm, string>> constraintDefinitionsDic =
                    new Dictionary<string, OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>>();
                do
                {
                    string language = reader.GetAttribute("language");

                    Dictionary<string, ArchetypeTerm> constraintDefItemDic = new Dictionary<string, ArchetypeTerm>();
                    reader.ReadStartElement();
                    reader.MoveToContent();

                    while (reader.LocalName == "items")
                    {
                        ArchetypeTerm archetypeTerm = new ArchetypeTerm();
                        this.ReadXml(archetypeTerm);

                        constraintDefItemDic.Add(archetypeTerm.Code, archetypeTerm);
                    }

                    reader.ReadEndElement();
                    reader.MoveToContent();

                    AssumedTypes.Hash<ArchetypeTerm, string> constraintDefItemHash =
                        new OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>(constraintDefItemDic);

                    constraintDefinitionsDic.Add(language, constraintDefItemHash);

                } while (reader.LocalName == "constraint_definitions");

                DesignByContract.Check.Assert(constraintDefinitionsDic.Count > 0, "termDefinitionDic must not be emppty.");

                archetypeOntology.ConstraintDefinitions = new OpenEhr.AssumedTypes.Hash<OpenEhr.AssumedTypes.Hash<ArchetypeTerm, string>, string>(constraintDefinitionsDic);
            }

            if (reader.LocalName == "term_bindings")
            {
                if (reader.IsEmptyElement)
                {
                    reader.Skip();
                    reader.MoveToContent();
                }
                else
                {
                    System.Collections.Generic.Dictionary<string, AssumedTypes.Hash<CodePhrase, string>> termBindingDic =
                        new Dictionary<string, OpenEhr.AssumedTypes.Hash<CodePhrase, string>>();
                    do
                    {
                        Dictionary<string, CodePhrase> termBindingItemDic = new Dictionary<string, CodePhrase>();

                        string terminologyString = reader.GetAttribute("terminology");
                        DesignByContract.Check.Assert(!string.IsNullOrEmpty(terminologyString), "terminologyString must not be null or empty.");

                        reader.ReadStartElement();
                        reader.MoveToContent();

                        while (reader.LocalName == "items")
                        {
                            string hashId = reader.GetAttribute("code");

                            reader.ReadStartElement();
                            reader.MoveToContent();

                            CodePhrase codePhrase = new CodePhrase();
                            codePhrase.ReadXml(reader);

                            reader.ReadEndElement();
                            reader.MoveToContent();

                            termBindingItemDic.Add(hashId, codePhrase);
                        }

                        reader.ReadEndElement();
                        reader.MoveToContent();

                        DesignByContract.Check.Assert(termBindingItemDic.Count > 0, "termBindingItemDic must not be empty.");

                        AssumedTypes.Hash<CodePhrase, string> termBindingItemHash =
                            new OpenEhr.AssumedTypes.Hash<CodePhrase, string>(termBindingItemDic);

                        termBindingDic.Add(terminologyString, termBindingItemHash);
                    } while (reader.LocalName == "term_bindings");

                    DesignByContract.Check.Assert(termBindingDic.Count > 0, "termBindingDic must not be empty.");

                    archetypeOntology.TermBindings = new OpenEhr.AssumedTypes.Hash<OpenEhr.AssumedTypes.Hash<CodePhrase, string>, string>(termBindingDic);
                }
            }

            if (reader.LocalName == "constraint_bindings")
            {
                System.Collections.Generic.Dictionary<string, AssumedTypes.Hash<DvUri, string>> constraintBindingDic =
                    new Dictionary<string, OpenEhr.AssumedTypes.Hash<DvUri, string>>();
                do
                {
                    Dictionary<string, DvUri> constraintBindingItemDic = new Dictionary<string, DvUri>();

                    string terminologyString = reader.GetAttribute("terminology");
                    DesignByContract.Check.Assert(!string.IsNullOrEmpty(terminologyString), "terminologyString must not be null or empty.");

                    reader.ReadStartElement();
                    reader.MoveToContent();

                    while (reader.LocalName == "items")
                    {

                        string hashId = reader.GetAttribute("code");
                        DvUri dvUri = new DvUri();
                        dvUri.ReadXml(reader);

                        constraintBindingItemDic.Add(hashId, dvUri);
                    }

                    reader.ReadEndElement();
                    reader.MoveToContent();

                    DesignByContract.Check.Assert(constraintBindingItemDic.Count > 0, "constraintBindingItemDic must not be empty.");

                    AssumedTypes.Hash<DvUri, string> constraintBindingItemHash =
                        new OpenEhr.AssumedTypes.Hash<DvUri, string>(constraintBindingItemDic);

                    constraintBindingDic.Add(terminologyString, constraintBindingItemHash);
                } while (reader.LocalName == "constraint_bindings");

                DesignByContract.Check.Assert(constraintBindingDic.Count > 0, "termBindingDic must not be empty.");

                archetypeOntology.ConstraintBindings = new OpenEhr.AssumedTypes.Hash<OpenEhr.AssumedTypes.Hash<DvUri, string>, string>(constraintBindingDic);
            }

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement,
              "Expected endElement");
            reader.ReadEndElement();
            reader.MoveToContent();
        }
示例#28
0
        protected override void ReadXmlBase(XmlReader reader)
        {
            // Get DV_TEXT data
            base.ReadXmlBase(reader);

            // Get defining_code data
            Check.Assert(reader.LocalName == "defining_code", "reader.LocalName must be 'defining_code'");
            if (this.definingCode == null)
                this.definingCode = new CodePhrase();
            this.definingCode.ReadXml(reader);
        }
示例#29
0
 protected void SetBaseData(CodePhrase charset, CodePhrase language)
 {
     this.charset = charset;
     this.language = language;
 }
示例#30
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="groupId"></param>
 /// <param name="code"></param>
 /// <returns></returns>
 public bool HasCodeForGroupId(string groupId, CodePhrase code)
 {
     if (code.TerminologyId.Value != OpenEhrTerminologyIdentifiers.TerminologyIdOpenehr) return false;
     return TerminologyDoc.CreateNavigator().Select("/terminology/group[@name='" + groupId + "']/concept[@id='" + code.CodeString + "']").Count > 0;
 }