Exemple #1
0
 public EhrExtractContent(string archetypeNodeId, DataTypes.Text.DvText name)
     : base(archetypeNodeId, name)
 {
     // TODO: implement SetAttributeDictionary and CheckInvariant overrides
     SetAttributeDictionary();
     CheckInvariants();
 }
Exemple #2
0
        public Link(DataTypes.Text.DvText meaning, DataTypes.Text.DvText type,
            DataTypes.Uri.DvEhrUri target)
            : this()
        {
            Check.Require(meaning != null && type != null && target != null);
            this.meaning = meaning;
            this.type = type;
            this.target = target;

            CheckInvariants();
        }
Exemple #3
0
        public Link(DataTypes.Text.DvText meaning, DataTypes.Text.DvText type,
                    DataTypes.Uri.DvEhrUri target)
            : this()
        {
            Check.Require(meaning != null && type != null && target != null);
            this.meaning = meaning;
            this.type    = type;
            this.target  = target;

            CheckInvariants();
        }
Exemple #4
0
        protected ExtractLocatable(string archetypeNodeId, DataTypes.Text.DvText name)
            : this()
        {
            Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype node id must not be null or empty");
            this.archetypeNodeId = archetypeNodeId;

            Check.Require(name != null, "name must not be null");
            Check.Require(!string.IsNullOrEmpty(name.Value), "name value must not be null or empty");
            this.name = name;

            Check.Invariant(attributesDictionary != null, "Attributes diction must not be null");
        }
        protected ExtractLocatable(string archetypeNodeId, DataTypes.Text.DvText name)
            : this()
        {
            Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype node id must not be null or empty");
            this.archetypeNodeId = archetypeNodeId;

            Check.Require(name != null, "name must not be null");
            Check.Require(!string.IsNullOrEmpty(name.Value), "name value must not be null or empty");
            this.name = name;

            Check.Invariant(attributesDictionary != null, "Attributes diction must not be null");
        }
        public ExtractChapter(string archetypeNodeId, DataTypes.Text.DvText name,
                              ExtractEntityIdentifier entityIdentifer, ExtractEntityContent content)
            : base(archetypeNodeId, name)
        {
            // TODO: Set attribute values
            this.entityIdentifier = entityIdentifer;
            this.content          = content;

            // TODO: implement SetAttributeDictionary and CheckInvariant overrides
            SetAttributeDictionary();
            CheckInvariants();

            DesignByContract.Check.Ensure(EntityIdentifier != null, "EntityIdentifier must not be null");
            DesignByContract.Check.Ensure(Content != null, "Content must not be null");
        }
Exemple #7
0
        public Participation(DataTypes.Text.DvText function,
            DataTypes.Quantity.DvInterval<DataTypes.Quantity.DateTime.DvDateTime> time,
            DataTypes.Text.DvCodedText mode, PartyProxy performer)
            : this()
        {
            Check.Require(function != null, "function must not be null.");
            Check.Require(mode != null, "mode must not be null");
            Check.Require(performer != null, "performer must not be null");

            this.function = function;
            this.time = time;
            this.mode = mode;
            this.performer = performer;

            this.CheckStrictInvariants();
        }
        public Participation(DataTypes.Text.DvText function,
                             DataTypes.Quantity.DvInterval <DataTypes.Quantity.DateTime.DvDateTime> time,
                             DataTypes.Text.DvCodedText mode, PartyProxy performer)
            : this()
        {
            Check.Require(function != null, "function must not be null.");
            Check.Require(mode != null, "mode must not be null");
            Check.Require(performer != null, "performer must not be null");

            this.function  = function;
            this.time      = time;
            this.mode      = mode;
            this.performer = performer;

            this.CheckStrictInvariants();
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
                                           object value)
        {
            if (value != null)
            {
                try
                {
                    if (value is string)
                    {
                        string   s     = (string)value;
                        string[] parts = s.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);

                        if (parts.Length == 3)
                        {
                            DataTypes.Text.DvCodedText codedValue
                                = new DataTypes.Text.DvCodedText(parts[2], parts[1], parts[0]);

                            return(codedValue);
                        }

                        if (parts.Length == 2 && parts[0] == "local")
                        {
                            DataTypes.Text.DvCodedText codedValue
                                = new DataTypes.Text.DvCodedText("", parts[1], parts[0]);

                            return(codedValue);
                        }

                        DesignByContract.Check.Assert(parts.Length <= 1, "Invalid text string: " + s);

                        DataTypes.Text.DvText textValue = new DataTypes.Text.DvText(s);

                        return(textValue);
                    }

                    if (value.GetType().IsAssignableFrom(typeof(DataTypes.Text.DvText)))
                    {
                        return(value);
                    }
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Can not convert '" + (string)value + "' to type DvText", ex);
                }
            }
            return(base.ConvertFrom(context, culture, value));
        }
        public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
            object value)
        {
            if (value != null)
            {
                try
                {
                    if (value is string)
                    {
                        string s = (string)value;
                        string[] parts = s.Split(new string[] { "::" }, StringSplitOptions.RemoveEmptyEntries);

                        if (parts.Length == 3)
                        {
                            DataTypes.Text.DvCodedText codedValue
                                = new DataTypes.Text.DvCodedText(parts[2], parts[1], parts[0]);

                            return codedValue;
                        }

                        if (parts.Length == 2 && parts[0] == "local")
                        {
                            DataTypes.Text.DvCodedText codedValue
                                = new DataTypes.Text.DvCodedText("", parts[1], parts[0]);

                            return codedValue;
                        }

                        DesignByContract.Check.Assert(parts.Length <= 1, "Invalid text string: " + s);

                        DataTypes.Text.DvText textValue = new DataTypes.Text.DvText(s);

                        return textValue;
                    }

                    if (value.GetType().IsAssignableFrom(typeof(DataTypes.Text.DvText)))
                    {
                        return value;
                    }
                }
                catch (Exception ex)
                {
                    throw new ArgumentException("Can not convert '" + (string)value + "' to type DvText", ex);
                }
            }
            return base.ConvertFrom(context, culture, value);
        }
Exemple #11
0
        /// <summary>Extract basic constructor</summary>
        /// <param name="systemId">System ID</param>
        protected Extract(string archetypeNodeId, DataTypes.Text.DvText name, HierObjectId systemId)
            : base(archetypeNodeId, name)
        {
            DesignByContract.Check.Require(systemId != null, "system ID must not be null");

            this.systemId = systemId;

            base.Uid         = new HierObjectId(Guid.NewGuid().ToString());
            this.timeCreated = new DataTypes.Quantity.DateTime.DvDateTime(DateTime.Now);
            this.sequenceNr  = 1;

            this.chapters = new List <ExtractChapter>();

            // TODO: implement SetAttributeDictionary and CheckInvariant overrides
            SetAttributeDictionary();
            CheckInvariants();
        }
Exemple #12
0
        public AuditDetails(string systemId, DataTypes.Quantity.DateTime.DvDateTime timeCommitted, 
            DataTypes.Text.DvCodedText changeType, PartyProxy committer, DataTypes.Text.DvText description)
            : this()
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(systemId), "systemId must not be null or empty");
            DesignByContract.Check.Require(timeCommitted != null, "timeCommitted must not be null");
            DesignByContract.Check.Require(changeType != null, "changeType must not be null");
            DesignByContract.Check.Require(committer != null, "committer must not be null");

            this.systemId = systemId;
            this.timeCommitted = timeCommitted;
            this.changeType = changeType;
            this.committer = committer;
            this.description = description;

            this.CheckDefaultInvariants();
        }
Exemple #13
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            DesignByContract.Check.Assert(reader.LocalName == "narrative",
                                          "Expected LocalName is 'narrative', but it is " + reader.LocalName);
            string narrativeType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

            if (narrativeType != null)
            {
                this.narrative = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            }
            else
            {
                this.narrative = new OpenEhr.RM.DataTypes.Text.DvText();
            }
            this.narrative.ReadXml(reader);

            if (reader.LocalName == "expiry_time")
            {
                this.expiryTime = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
                this.expiryTime.ReadXml(reader);
            }

            if (reader.LocalName == "wf_definition")
            {
                this.wfDefinition = new OpenEhr.RM.DataTypes.Encapsulated.DvParsable();
                this.wfDefinition.ReadXml(reader);
            }

            if (reader.LocalName == "activities")
            {
                AssumedTypes.Impl.LocatableList <Activity> activities = new OpenEhr.AssumedTypes.Impl.LocatableList <Activity>();
                do
                {
                    Activity activity = new Activity();
                    activity.ReadXml(reader);

                    activity.Parent = this;
                    activities.Add(activity);
                } while (reader.LocalName == "activities" && reader.NodeType == System.Xml.XmlNodeType.Element);

                this.activities = activities;
            }
        }
Exemple #14
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "meaning", "Expected local name is 'meaning', not " + reader.LocalName);
            string meaningType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

            if (meaningType != null && meaningType.IndexOf("DV_CODED_TEXT") >= 0)
            {
                this.meaning = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            }
            else
            {
                this.meaning = new OpenEhr.RM.DataTypes.Text.DvText();
            }
            this.meaning.ReadXml(reader);

            Check.Assert(reader.LocalName == "type", "Expected local name is 'type', not " + reader.LocalName);
            string typeType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);

            if (typeType != null && typeType.IndexOf("DV_CODED_TEXT") >= 0)
            {
                this.type = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            }
            else
            {
                this.type = new OpenEhr.RM.DataTypes.Text.DvText();
            }
            this.type.ReadXml(reader);

            Check.Assert(reader.LocalName == "target", "Expected local name is 'target', not " + reader.LocalName);
            this.target = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
            this.target.ReadXml(reader);

            reader.MoveToContent();

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }

            CheckInvariants();
        }
Exemple #15
0
        public Attestation(string systemId, DataTypes.Quantity.DateTime.DvDateTime timeCommitted,
                           DataTypes.Text.DvCodedText changedType, PartyProxy committer, DataTypes.Text.DvText description,
                           DataTypes.Encapsulated.DvMultimedia attestedView, string proof,
                           AssumedTypes.List <DataTypes.Uri.DvEhrUri> items, DataTypes.Text.DvText reason, bool isPending)
            : base(systemId, timeCommitted, changedType, committer, description)
        {
            Check.Require(items == null | items.Count > 0, "if items is not null, it must not be empty.");
            Check.Require(reason != null, "reason must not be null.");

            this.attestedView = attestedView;
            this.proof        = proof;
            this.items        = items;
            this.reason       = reason;
            this.isPending    = isPending;
            this.isPendingSet = true;

            this.CheckDefaultInvariants();
        }
Exemple #16
0
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "function",
                         "Expected LocalName is 'function' not " + reader.LocalName);
            string functionType = RmXmlSerializer.ReadXsiType(reader);

            if (!string.IsNullOrEmpty(functionType))
            {
                this.function = RmFactory.DataValue(functionType) as DataTypes.Text.DvText;
            }
            else
            {
                this.function = new OpenEhr.RM.DataTypes.Text.DvText();
            }
            this.function.ReadXml(reader);
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "performer",
                         "Expected LocalName is 'performer' not " + reader.LocalName);
            string performerType = RmXmlSerializer.ReadXsiType(reader);

            this.performer = RmFactory.PartyProxy(performerType);

            this.performer.ReadXml(reader);

            if (reader.LocalName == "time")
            {
                this.time = new OpenEhr.RM.DataTypes.Quantity.DvInterval <OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime>();
                this.time.ReadXml(reader);
            }

            Check.Assert(reader.LocalName == "mode", "Expected LocalName is 'mode' not " + reader.LocalName);
            this.mode = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.mode.ReadXml(reader);

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement,
                                          "Expected endElement of PartyIdentified.");
            reader.ReadEndElement();
            reader.MoveToContent();
        }
Exemple #17
0
        protected virtual void ReadXmlBase(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "system_id",
                         "Expected LocalName is 'system_id' not " + reader.LocalName);
            this.systemId = reader.ReadElementString("system_id", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "committer",
                         "Expected LocalName is 'committer' not " + reader.LocalName);
            string committerType = RmXmlSerializer.ReadXsiType(reader);

            this.committer = RmFactory.PartyProxy(committerType);

            this.committer.ReadXml(reader);

            Check.Assert(reader.LocalName == "time_committed",
                         "Expected LocalName is 'time_committed' not " + reader.LocalName);
            this.timeCommitted = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
            this.timeCommitted.ReadXml(reader);

            Check.Assert(reader.LocalName == "change_type",
                         "Expected LocalName is 'change_type' not " + reader.LocalName);
            this.changeType = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.changeType.ReadXml(reader);

            if (reader.LocalName == "description")
            {
                string descriptionType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                if (descriptionType == null)
                {
                    this.description = new OpenEhr.RM.DataTypes.Text.DvText();
                }
                else
                {
                    this.description = new OpenEhr.RM.DataTypes.Text.DvCodedText();
                }

                this.description.ReadXml(reader);
            }
        }
Exemple #18
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();
        }
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture,
                                         object value, Type destinationType)
        {
            DataTypes.Text.DvText textValue = value as DataTypes.Text.DvText;
            if (textValue != null)
            {
                if (destinationType == typeof(string))
                {
                    DataTypes.Text.DvCodedText codedValue = textValue as DataTypes.Text.DvCodedText;

                    if (codedValue == null)
                    {
                        return(textValue.Value);
                    }

                    else
                    {
                        string s = codedValue.DefiningCode.TerminologyId.Value + "::" + codedValue.DefiningCode.CodeString
                                   + "::" + codedValue.Value;

                        s = s.TrimEnd(':');

                        return(s);
                    }
                }

                if (destinationType == typeof(System.Object))
                {
                    return(textValue as object);
                }

                if (destinationType == textValue.GetType())
                {
                    return(textValue);
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Exemple #20
0
        protected override void ReadXmlBase(System.Xml.XmlReader reader)
        {
            base.ReadXmlBase(reader);

            DesignByContract.Check.Assert(reader.LocalName == "narrative",
                "Expected LocalName is 'narrative', but it is " + reader.LocalName);
            string narrativeType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
            if (narrativeType != null)
                this.narrative = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            else
                this.narrative = new OpenEhr.RM.DataTypes.Text.DvText();
            this.narrative.ReadXml(reader);

            if (reader.LocalName == "expiry_time")
            {
                this.expiryTime = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
                this.expiryTime.ReadXml(reader);
            }

            if (reader.LocalName == "wf_definition")
            {
                this.wfDefinition = new OpenEhr.RM.DataTypes.Encapsulated.DvParsable();
                this.wfDefinition.ReadXml(reader);
            }

            if (reader.LocalName == "activities")
            {
                AssumedTypes.Impl.LocatableList<Activity> activities = new OpenEhr.AssumedTypes.Impl.LocatableList<Activity>();
                do
                {
                    Activity activity = new Activity();
                    activity.ReadXml(reader);

                    activity.Parent = this;
                    activities.Add(activity);

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

                this.activities = activities;
            }
        }
Exemple #21
0
        protected virtual void ReadXmlBase(System.Xml.XmlReader reader)
        {
            Check.Assert(reader.LocalName == "system_id",
                "Expected LocalName is 'system_id' not " + reader.LocalName);
            this.systemId = reader.ReadElementString("system_id", RmXmlSerializer.OpenEhrNamespace);
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "committer",
                "Expected LocalName is 'committer' not " + reader.LocalName);
            string committerType = RmXmlSerializer.ReadXsiType(reader);
            this.committer = RmFactory.PartyProxy(committerType);

            this.committer.ReadXml(reader);

            Check.Assert(reader.LocalName == "time_committed",
                "Expected LocalName is 'time_committed' not " + reader.LocalName);
            this.timeCommitted = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
            this.timeCommitted.ReadXml(reader);

            Check.Assert(reader.LocalName == "change_type",
                            "Expected LocalName is 'change_type' not " + reader.LocalName);
            this.changeType = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.changeType.ReadXml(reader);

            if (reader.LocalName == "description")
            {
                string descriptionType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
                if (descriptionType == null)
                    this.description = new OpenEhr.RM.DataTypes.Text.DvText();
                else
                    this.description = new OpenEhr.RM.DataTypes.Text.DvCodedText();

                this.description.ReadXml(reader);
            }
        }
Exemple #22
0
        internal void ReadXml(XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "function",
                "Expected LocalName is 'function' not " + reader.LocalName);
            string functionType = RmXmlSerializer.ReadXsiType(reader);
            if (!string.IsNullOrEmpty(functionType))
            {
                this.function = RmFactory.DataValue(functionType) as DataTypes.Text.DvText;
            }
            else
                this.function = new OpenEhr.RM.DataTypes.Text.DvText();
            this.function.ReadXml(reader);
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "performer",
                "Expected LocalName is 'performer' not " + reader.LocalName);
            string performerType = RmXmlSerializer.ReadXsiType(reader);
            this.performer = RmFactory.PartyProxy(performerType);

            this.performer.ReadXml(reader);

            if (reader.LocalName == "time")
            {
                this.time = new OpenEhr.RM.DataTypes.Quantity.DvInterval<OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime>();
                this.time.ReadXml(reader);
            }

            Check.Assert(reader.LocalName == "mode", "Expected LocalName is 'mode' not " + reader.LocalName);
            this.mode = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            this.mode.ReadXml(reader);

            DesignByContract.Check.Assert(reader.NodeType == System.Xml.XmlNodeType.EndElement,
                "Expected endElement of PartyIdentified.");
            reader.ReadEndElement();
            reader.MoveToContent();
        }
 protected ExtractEntityContent(string archetypeNodeId, DataTypes.Text.DvText name)
     : base(archetypeNodeId, name)
 {
     // TODO: call SetAttributeDictionary and CheckInvariants from sub-type
     //       after setting attribute values
 }
Exemple #24
0
        public AuditDetails(string systemId, DataTypes.Quantity.DateTime.DvDateTime timeCommitted,
                            DataTypes.Text.DvCodedText changeType, PartyProxy committer, DataTypes.Text.DvText description)
            : this()
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(systemId), "systemId must not be null or empty");
            DesignByContract.Check.Require(timeCommitted != null, "timeCommitted must not be null");
            DesignByContract.Check.Require(changeType != null, "changeType must not be null");
            DesignByContract.Check.Require(committer != null, "committer must not be null");

            this.systemId      = systemId;
            this.timeCommitted = timeCommitted;
            this.changeType    = changeType;
            this.committer     = committer;
            this.description   = description;

            this.CheckDefaultInvariants();
        }
Exemple #25
0
        internal void ReadXml(System.Xml.XmlReader reader)
        {
            reader.ReadStartElement();
            reader.MoveToContent();

            Check.Assert(reader.LocalName == "meaning", "Expected local name is 'meaning', not "+reader.LocalName);
            string meaningType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
            if (meaningType != null && meaningType.IndexOf("DV_CODED_TEXT") >= 0)
                this.meaning = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            else
                this.meaning = new OpenEhr.RM.DataTypes.Text.DvText();
            this.meaning.ReadXml(reader);

            Check.Assert(reader.LocalName == "type", "Expected local name is 'type', not " + reader.LocalName);
            string typeType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace);
            if (typeType != null && typeType.IndexOf("DV_CODED_TEXT") >= 0)
                this.type = new OpenEhr.RM.DataTypes.Text.DvCodedText();
            else
                this.type = new OpenEhr.RM.DataTypes.Text.DvText();
            this.type.ReadXml(reader);

            Check.Assert(reader.LocalName == "target", "Expected local name is 'target', not " + reader.LocalName);
            this.target = new OpenEhr.RM.DataTypes.Uri.DvEhrUri();
            this.target.ReadXml(reader);

            reader.MoveToContent();

            if (!reader.IsStartElement())
            {
                reader.ReadEndElement();
                reader.MoveToContent();
            }

            CheckInvariants();
        }