Example #1
0
        /// <summary>
        /// Deserialize JSON into a FHIR Narrative
        /// </summary>
        public static void DeserializeJson(this Narrative current, ref Utf8JsonReader reader, JsonSerializerOptions options)
        {
            string propertyName;

            while (reader.Read())
            {
                if (reader.TokenType == JsonTokenType.EndObject)
                {
                    return;
                }

                if (reader.TokenType == JsonTokenType.PropertyName)
                {
                    propertyName = reader.GetString();
                    if (Hl7.Fhir.Serialization.FhirSerializerOptions.Debug)
                    {
                        Console.WriteLine($"Narrative >>> Narrative.{propertyName}, depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
                    }
                    reader.Read();
                    current.DeserializeJsonProperty(ref reader, options, propertyName);
                }
            }

            throw new JsonException($"Narrative: invalid state! depth: {reader.CurrentDepth}, pos: {reader.BytesConsumed}");
        }
Example #2
0
        /// <summary>
        ///     Returns true if the transfer is valid.
        /// </summary>
        public bool IsValid()
        {
            var valid = Narrative.IsSomething() &&
                        FromLedger != null &&
                        ToLedger != null &&
                        FromLedger != ToLedger &&
                        TransferAmount > 0.0001M;

            if (!valid)
            {
                return(false);
            }

            if (BankTransferRequired)
            {
                valid = AutoMatchingReference.IsSomething();
            }

            if (FromLedger.BudgetBucket is SurplusBucket &&
                ToLedger.BudgetBucket is SurplusBucket &&
                FromLedger.StoredInAccount == ToLedger.StoredInAccount)
            {
                valid = false;
            }

            return(valid);
        }
Example #3
0
    // Use this for initialization
    void Start()
    {
        Grammar grammar = new Grammar();

        grammar.PushRules("mensagem", "mensagem,mensaginha,mensajona,bagaça".Split(','));
        grammar.PushRules("coisas", "coisas,trens,bagulhos,trambolhos".Split(','));
        grammar.PushRules("sujeira", "porra,chocolate,terra,sujeira,gosma #cor#,tinta #cor#".Split(','));
        grammar.PushRules("origin", new string[] { "Essa é uma #mensagem# gerada pelo Tracery, aqui veremos #coisas# cobertos por #sujeira#!" });
        grammar.PushRules("cor", "verde,vermelha,azul,preta,roxa".Split(','));
        string expanded = grammar.Flatten("#origin#");

        print(expanded);

        string path = Application.streamingAssetsPath + "/JSON/gameData.json";

        Debug.Log(path);

        //---------------------------

        Narrative thisLevel = new Narrative();

        thisLevel.expanded = expanded;
        thisLevel.name     = "Teste JSON";
        thisLevel.id       = 1;

        File.WriteAllText(path, JsonUtility.ToJson(thisLevel));
    }
	void Start () {
		// We assume that the Aspect Configurator always shares some kind of
		// "Controller" object with the Narrative Script
		narrative = this.GetComponent<Narrative>();
		spatializedAudioSources = UnityEngine.Object.FindObjectsOfType<ONSPAudioSource>();

		aspectChangers = new Dictionary<string, ChangeSetting>();
		aspectValues = new Dictionary<string, bool> ();

		// We queue changes so we can execute them in the main thread
		// via the Update() method
		upcomingChanges = new Queue ();
		upcomingValues = new Queue ();

		aspectChangers.Add("enhancedGraphics", new ChangeSetting(SetEnhancedGraphics));
		aspectChangers.Add("snakes", new ChangeSetting(SetSnakes));
		aspectChangers.Add("enhancedAudio", new ChangeSetting(SetEnhancedAudio));
		aspectChangers.Add ("gamePlaying", new ChangeSetting (SetGamePlaying));

        // Default settings
        SetAspect("enhancedGraphics", true);
        SetAspect("snakes", true);
        SetAspect("enhancedAudio", true);
        SetAspect("gamePlaying", false);
	}
Example #5
0
        void InternalizeReferences(Resource resource)
        {
            Visitor action = (element, name) =>
            {
                if (element == null)
                {
                    return;
                }

                if (element is ResourceReference)
                {
                    ResourceReference reference = (ResourceReference)element;
                    reference.Url = InternalizeReference(reference.Url);
                }
                else if (element is FhirUri)
                {
                    FhirUri uri = (FhirUri)element;
                    uri.Value = InternalizeReference(uri.Value);
                    //((FhirUri)element).Value = LocalizeReference(new Uri(((FhirUri)element).Value, UriKind.RelativeOrAbsolute)).ToString();
                }
                else if (element is Narrative)
                {
                    Narrative n = (Narrative)element;
                    n.Div = FixXhtmlDiv(n.Div);
                }
            };

            Type[] types = { typeof(ResourceReference), typeof(FhirUri), typeof(Narrative) };

            Engine.Auxiliary.ResourceVisitor.VisitByType(resource, action, types);
        }
Example #6
0
    void Start()
    {
        _dialogueView = Game.Instance.UI.DialogueView;
        _narrative    = Game.Instance.Narrative;

        var lines = script.text.Split('\n');

        print("parsed " + lines.Length + " lines of dialogue");
        _lines = new DialogueLine[lines.Length];

        for (int i = 0; i < _lines.Length; i++)
        {
            var parts = lines[i].Split('\t');
            if (parts.Length != 3)
            {
                throw new System.Exception("can't parse line: " + lines[i]);
            }

            _lines[i] = new DialogueLine()
            {
                index   = int.Parse(parts[0]),
                speaker = parts[1],
                text    = parts[2]
            };
        }
        _lastIndex = _lines.Select(l => l.index).Max();

        _narrative.StoryProgressed.AddListener(ShowLine);
    }
Example #7
0
        public override void OnPush(IWorld world, IUserinterface ui, ActionStack stack, Frame frame)
        {
            base.OnPush(world, ui, stack, frame);

            var coerceFrame = Coerced.CoercedFrame;

            //if the coerced frame has had all it's decisions made and is about to be pushed onto the stack
            if (ReferenceEquals(frame.Action, coerceFrame.CoerceAction))
            {
                var args = new NegotiationSystemArgs(world, ui, coerceFrame.PerformedBy.GetFinalStats()[Stat.Coerce],
                                                     coerceFrame.PerformedBy, coerceFrame.TargetIfAny, stack.Round);

                //the final frame that is being pushed is what we are proposing they do
                args.Proposed = frame;

                //Check with the negotiation system to see if the actor is still willing to go ahead
                //with the action as configured
                Coerced.CoercedFrame.NegotiationSystem.Apply(args);

                //if not then cancel
                if (!args.Willing)
                {
                    var narrative = new Narrative(coerceFrame.PerformedBy, "Coerce Failed",
                                                  $"{coerceFrame.TargetIfAny} refused to perform action",
                                                  $"{coerceFrame.PerformedBy} failed to coerce {coerceFrame.TargetIfAny} - {args.WillingReason}", stack.Round);

                    narrative.Show(ui);

                    frame.Cancelled = true;
                }
            }
        }
Example #8
0
        /// <summary>
        /// Deserialize JSON into a FHIR Narrative
        /// </summary>
        public static void DeserializeJsonProperty(this Narrative current, ref Utf8JsonReader reader, JsonSerializerOptions options, string propertyName)
        {
            switch (propertyName)
            {
            case "status":
                if (reader.TokenType == JsonTokenType.Null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Narrative.NarrativeStatus>();
                    reader.Skip();
                }
                else
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Narrative.NarrativeStatus>(Hl7.Fhir.Utility.EnumUtility.ParseLiteral <Hl7.Fhir.Model.Narrative.NarrativeStatus>(reader.GetString()));
                }
                break;

            case "_status":
                if (current.StatusElement == null)
                {
                    current.StatusElement = new Code <Hl7.Fhir.Model.Narrative.NarrativeStatus>();
                }
                ((Hl7.Fhir.Model.Element)current.StatusElement).DeserializeJson(ref reader, options);
                break;

            case "div":
                current.Div = reader.GetString();
                break;

            // Complex: Narrative, Export: Narrative, Base: Element
            default:
                ((Hl7.Fhir.Model.Element)current).DeserializeJsonProperty(ref reader, options, propertyName);
                break;
            }
        }
Example #9
0
    void Start()
    {
        _questView    = Game.Instance.UI.QuestView;
        _dialogueView = Game.Instance.UI.DialogueView;

        _narrative = Game.Instance.Narrative;
        _narrative.StoryProgressed.AddListener(OnProgress);
    }
Example #10
0
 void Start()
 {
     _image     = gameObject.GetComponent <Image>();
     _narrative = Game.Instance.Narrative;
     _endPoint  = _narrative.end;
     Debug.Log(_endPoint);
     _fadeAmt = 0f;
 }
Example #11
0
    void Start()
    {
        _questView    = Game.Instance.UI.QuestView;
        _dialogueView = Game.Instance.UI.DialogueView;

        _narrative = Game.Instance.Narrative;
        _narrative.StoryProgressed.AddListener(OnProgress);

        _soundEngine = GameObject.FindGameObjectWithTag(GameConstants.Persistent).GetComponentInChildren <SoundEngine>();
    }
Example #12
0
        override protected void Page_Load(object sender, EventArgs e)
        {
            int _patientId = int.Parse(Session[SessionKey.PatientId].ToString());

            if (PermissionManager.HasPermission(PermissionManager.EditNarrative) == false)
            {
                // always display other comments, but only allow users to add if their group permission

                submit.Enabled = false;
                NewComment.Attributes.Add("ReadOnly", "True");
                NewComment.Attributes.Add("onClick", "alert('Sorry. Your user group has not been granted permission to add comments.')");
            }

            if (Page.IsPostBack && NewComment.Value != "")
            {
                // TODO: Should we add the permission?
                Security.SecurityController sc = new Caisis.Security.SecurityController();

                Narrative narrative = new Narrative();
                //narrative.NewRow();

                narrative[Narrative.PatientId]       = _patientId;
                narrative[Narrative.Narrative_Field] = NewComment.Value.Trim();
                narrative[Narrative.EnteredTime]     = DateTime.Now.ToString();
                narrative[Narrative.EnteredBy]       = sc.GetUserName();
                narrative[Narrative.NarratedBy]      = sc.GetUserName();

                narrative.Save();

                NewComment.Value           = "";
                commentDiv.Visible         = true;
                NarrativeTitle.Visible     = true;
                NewComment.Style["height"] = "40px";
            }

            //Narrative ptNarratives = new Narrative();
            //ptNarratives.GetByParent(_patientId);
            //ptNarratives.DataSourceView.Sort = "EnteredTime DESC";
            DataView narratives = BusinessObject.GetByParentAsDataView <Narrative>(_patientId);

            narratives.Sort = "EnteredTime DESC";
            //if (ptNarratives.RecordCount > 0)
            if (narratives.Count > 0)
            {
                //RptComments.DataSource = ptNarratives.DataSourceView;
                RptComments.DataSource = narratives;
                RptComments.DataBind();
            }
            else
            {
                commentDiv.Visible         = false;
                NarrativeTitle.Visible     = false;
                NewComment.Style["height"] = "100px";
            }
        }
Example #13
0
 public NarrativeComponentAdapt(string parentId, Narrative inputComponent) : base(parentId, inputComponent)
 {
     Body            = inputComponent.Intro;
     SetCompletionOn = GetCompletion(YesOptionHelper.IsYesOptionChecked(inputComponent.RequireAllItemsBeSeen));
     Items           = inputComponent?.NarrativeItems.Select(m => new NarrativeComponentItem()
     {
         Title   = m.Title,
         Body    = m.Text,
         Graphic = GraphicHelper.GetSimpleGraphic(m.Image)
     }).ToList();
 }
Example #14
0
        public override void Kill(IUserinterface ui, Guid round, string reason)
        {
            //although you might get double dead in a round.  Only show the message once
            if (!Dead)
            {
                var narrative = new Narrative(this, "Dead",
                                              $"You have tragically met your end.  Don't worry, many of your comrades will benefit from you sacrifice (at breakfast tomorrow).", $"You died of {reason}", round);
                narrative.Show(ui, true);
            }

            Dead = true;
        }
Example #15
0
    public void StartNarrative(Narrative narrative)
    {
        animator.SetBool("IsOpen", true);

        sentences.Clear();

        foreach (string sentence in narrative.sentences)
        {
            sentences.Enqueue(sentence);
        }
        DisplayNextSentence();
    }
        public bool Equals(DestinyItemObjectiveBlockDefinition input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     ObjectiveHashes == input.ObjectiveHashes ||
                     (ObjectiveHashes != null && ObjectiveHashes.SequenceEqual(input.ObjectiveHashes))
                     ) &&
                 (
                     DisplayActivityHashes == input.DisplayActivityHashes ||
                     (DisplayActivityHashes != null && DisplayActivityHashes.SequenceEqual(input.DisplayActivityHashes))
                 ) &&
                 (
                     RequireFullObjectiveCompletion == input.RequireFullObjectiveCompletion ||
                     (RequireFullObjectiveCompletion != null && RequireFullObjectiveCompletion.Equals(input.RequireFullObjectiveCompletion))
                 ) &&
                 (
                     QuestlineItemHash == input.QuestlineItemHash ||
                     (QuestlineItemHash.Equals(input.QuestlineItemHash))
                 ) &&
                 (
                     Narrative == input.Narrative ||
                     (Narrative != null && Narrative.Equals(input.Narrative))
                 ) &&
                 (
                     ObjectiveVerbName == input.ObjectiveVerbName ||
                     (ObjectiveVerbName != null && ObjectiveVerbName.Equals(input.ObjectiveVerbName))
                 ) &&
                 (
                     QuestTypeIdentifier == input.QuestTypeIdentifier ||
                     (QuestTypeIdentifier != null && QuestTypeIdentifier.Equals(input.QuestTypeIdentifier))
                 ) &&
                 (
                     QuestTypeHash == input.QuestTypeHash ||
                     (QuestTypeHash.Equals(input.QuestTypeHash))
                 ) &&
                 (
                     PerObjectiveDisplayProperties == input.PerObjectiveDisplayProperties ||
                     (PerObjectiveDisplayProperties != null && PerObjectiveDisplayProperties.SequenceEqual(input.PerObjectiveDisplayProperties))
                 ) &&
                 (
                     DisplayAsStatTracker == input.DisplayAsStatTracker ||
                     (DisplayAsStatTracker != null && DisplayAsStatTracker.Equals(input.DisplayAsStatTracker))
                 ));
        }
Example #17
0
    void Start()
    {
        if (!books.Any())
        {
            throw new System.Exception();
        }

        _questView    = Game.Instance.UI.QuestView;
        _dialogueView = Game.Instance.UI.DialogueView;

        _narrative = Game.Instance.Narrative;
        _narrative.StoryProgressed.AddListener(OnProgress);

        _storage = Game.Instance.Storage;
    }
Example #18
0
    public static Narrative Load(string path)
    {
        Narrative narrative = new Narrative();

        if (File.Exists(path))
        {
            XmlSerializer serializer = new XmlSerializer(typeof(Narrative));

            using (var stream = new FileStream(path, FileMode.OpenOrCreate))
            {
                narrative = serializer.Deserialize(stream) as Narrative;
            }
        }
        return(narrative);
    }
Example #19
0
    void Awake()
    {
        string filePath = Application.persistentDataPath + @"\" + narrativeFileName;

        Debug.Log(filePath);
        narrative = Narrative.Load(filePath);

        Station  item = new Station();
        Artefact art  = new Artefact();

        art.Name = "ART";

        item.Name = "station";
        item.Artefacts.Add(art);
        narrative.StationCollection.Add(item);
    }
Example #20
0
        public void NarrativeParsing()
        {
            string xmlString = @"<testNarrative xmlns='http://hl7.org/fhir'>
                                    <status value='generated' />
                                    <div xmlns='http://www.w3.org/1999/xhtml'>Whatever</div>
                                 </testNarrative>";

            ErrorList errors = new ErrorList();
            Narrative result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);

            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            xmlString = @"<testNarrative xmlns='http://hl7.org/fhir'>
                             <status value='generated' />
                             <xhtml:div xmlns:xhtml='http://www.w3.org/1999/xhtml'>Whatever</xhtml:div>
                          </testNarrative>";
            errors.Clear();

            result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            xmlString = @"<testNarrative xmlns='http://hl7.org/fhir' xmlns:xhtml='http://www.w3.org/1999/xhtml'>
                              <status value='generated' />
                              <xhtml:div>Whatever</xhtml:div>
                          </testNarrative>";
            errors.Clear();

            result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            string jsonString = "{ \"testNarrative\" : {" +
                                "\"status\" : { \"value\" : \"generated\" }, " +
                                "\"div\" : " +
                                "\"<div xmlns='http://www.w3.org/1999/xhtml'>Whatever</div>\" } }";

            errors.Clear();
            result = (Narrative)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);
        }
Example #21
0
    // Use this for initialization
    void Start()
    {
        string    path      = Application.streamingAssetsPath + "/_GameManager_/Resources/gameData.json";
        Narrative thisLevel = new Narrative();

        thisLevel.expanded = this.expanded;
        thisLevel.name     = "Teste JSON";
        thisLevel.id       = 1;

        string json = JsonUtility.ToJson(thisLevel);

        File.WriteAllText(path, json);

        //thisLevel = JsonUtility.FromJson<Narrative> ();
        //JsonUtility.FromJsonOverwrite (json, thisLevel);
        //json = File.ReadAllText (Path);
    }
Example #22
0
        protected override void PopImpl(IWorld world, IUserinterface ui, ActionStack stack, Frame frame)
        {
            var narrative = new Narrative(frame.PerformedBy, "Load Guns", "You spend several hours pushing overloaded gun carriages in the sweat and smoke filled confines of the loading bay.", null, stack.Round);

            if (frame.PerformedBy.BaseStats[Stat.Coerce] > 0 && frame.PerformedBy.BaseStats[Stat.Coerce] < 30)
            {
                frame.PerformedBy.BaseStats[Stat.Coerce]++;
                narrative.Changed("The Emperor's grace fills your heart", Stat.Coerce, 1);
            }

            if (frame.PerformedBy.BaseStats[Stat.Fight] > 20)
            {
                frame.PerformedBy.BaseStats[Stat.Fight]--;
                narrative.Changed("Aches and pains sap your strength", Stat.Fight, -1);
            }

            narrative.Show(ui, false);
        }
Example #23
0
        /// <summary>
        /// Serialize a FHIR Narrative into JSON
        /// </summary>
        public static void SerializeJson(this Narrative current, Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }
            // Complex: Narrative, Export: Narrative, Base: Element (Element)
            ((Hl7.Fhir.Model.Element)current).SerializeJson(writer, options, false);

            writer.WriteString("status", Hl7.Fhir.Utility.EnumUtility.GetLiteral(current.StatusElement.Value));

            writer.WriteString("div", current.Div.Trim());

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
        /// <summary>
        /// Update all referances found in the Resource narrative
        /// </summary>
        /// <param name="Narrative"></param>
        /// <param name="ReferanceMap"> Key: Old Referance, Value: New Referance</param>
        /// <returns>True if an referance was updated, False if none updated</returns>
        public static bool UpdateAllReferances(this Narrative Narrative, IDictionary <string, string> ReferanceMap)
        {
            bool HasUpdated = false;

            if (Narrative != null)
            {
                var xDoc = XElement.Parse(Narrative.Div);

                //Find and update all <a href=""/> referances
                List <XElement> LinkList = xDoc.Descendants().Where(x => x.Name.LocalName == "a").ToList();
                foreach (var Link in LinkList)
                {
                    var href = Link.Attributes().FirstOrDefault(x => x.Name.LocalName == "href");
                    if (href != null)
                    {
                        if (ReferanceMap.ContainsKey(href.Value))
                        {
                            href.Value = ReferanceMap[href.Value];
                            HasUpdated = true;
                        }
                    }
                }

                //Find and update all <img src=""/> referances
                List <XElement> LinkListImg = xDoc.Descendants().Where(x => x.Name.LocalName == "img").ToList();
                foreach (var Link in LinkListImg)
                {
                    var src = Link.Attributes().FirstOrDefault(x => x.Name.LocalName == "src");
                    if (src != null)
                    {
                        if (ReferanceMap.ContainsKey(src.Value))
                        {
                            src.Value  = ReferanceMap[src.Value];
                            HasUpdated = true;
                        }
                    }
                }

                Narrative.Div = xDoc.ToString();
            }
            return(HasUpdated);
        }
    public void ParseXML(string narrativeName)
    {
        TextAsset textAsset = (TextAsset)Resources.Load("Narratives/" + narrativeName);

        XDocument doc = XDocument.Parse(textAsset.text);

        XElement narrXml   = doc.Element("Narrative");
        string   introText = narrXml.Element("IntroText").Value;
        string   period    = narrXml.Element("IntroText").Value;

        narr = narrObject.GetComponent <Narrative>();

        foreach (XElement xe in narrXml.Descendants("Object"))
        {
            int    id          = Int32.Parse(xe.Attribute("id").Value);
            string name        = xe.Element("Name").Value;
            string objFileName = xe.Element("FileName").Value;
            string summary     = xe.Element("Summary").Value;
            string text        = xe.Element("Text").Value;

            GameObject g = CreateObject(objFileName);

            g.AddComponent <MuseumObject>();
            g.GetComponent <MuseumObject>().Init(id, name, objFileName, summary, text);
            g.SetActive(false);

            foreach (XElement el in xe.Descendants("Link"))
            {
                Debug.Log(el.Element("ObjectId").Value);
                Debug.Log(el.Element("LinkType").Value);
                Link link = new Link(Int32.Parse(el.Element("ObjectId").Value), el.Element("ObjectName").Value, el.Element("LinkType").Value);
                g.GetComponent <MuseumObject>().AddLink(link);
            }

            narr.AddObject(g);
        }

        narr.Init(introText, period);
        Debug.Log("Narrative loaded");
    }
Example #26
0
    public StatementLine(string nar, string rest, int index, int pageNum, DateTime statementDate, int previousMonth, string Language)
    {
        this.Language     = Language;
        this.isServiceFee = false;
        this.Narrative    = nar;
        this.text         = rest;
        this.Index        = index;
        this.PageNumber   = pageNum;
        this.Ref          = 0;


        string value = Microsoft.VisualBasic.Strings.Right(text, 9);

        this.Ref = Int64.Parse(value);

        // remove last 9 characters from text (ref)
        this.text = text.Substring(0, text.Length - 9);

        //"029118:025397 17,50 489,06- 04 25 8.629,64-    SF
        //"@11,300% 17.646,58- 06 26 6.580.516,04-
        string neg = Microsoft.VisualBasic.Strings.Right(text, 1);

        //-
        //-
        this.text = text.Substring(0, text.Length - 1);
        int lPos = text.LastIndexOf(" ");

        this.Balance = pdfUtility.getDecimal(text.Substring(lPos).Trim());
        //6.580.516,04
        //8.629,64
        if (neg == "-")
        {
            this.Balance = this.Balance * -1;
        }
        // remove balance
        //-6.580.516,04
        text = text.Substring(0, lPos).Trim();
        // day
        lPos     = text.LastIndexOf(" ");
        this.Day = int.Parse(text.Substring(lPos).Trim());
        //26
        // remove day
        text = text.Substring(0, lPos).Trim();
        // Month
        // 06
        lPos       = text.LastIndexOf(" ");
        this.Month = int.Parse(text.Substring(lPos).Trim());
        // remove month
        text = text.Substring(0, lPos).Trim();
        // amount

        decimal amount = 0;

        //"029118:025397 17,50 489,06-   SF
        //"@11,300% 17.646,58-
        lPos = text.LastIndexOf(" ");
        if (lPos != -1)
        {
            //17.646,58-
            //489,06-     SF
            amount = pdfUtility.getDecimal(text.Substring(lPos).Trim());
            text   = text.Substring(0, lPos).Trim();
        }
        else
        {
            amount = pdfUtility.getDecimal(text.Trim());
        }
        // remove amount

        if (amount < 0)
        {
            this.Debit = amount;
        }
        else
        {
            this.Credit = amount;
        }

        //"029118:025397 17,50   SF
        //"@11,300%
        // get next word
        lPos = text.LastIndexOf(" ");
        if (lPos != -1)
        {
        }
        // check for interest payment
        if (Ref == 93)
        {
            //INTEREST ON OVERDRAFT UP~
            //TO 02 24 LIMIT 1~
            //280065019 @10,500 %

            //INTEREST ON OVERDRAFT UP~
            //TO 02 24 280065019~
            //@10,500 %

            //RENTE OP OORTREKKING TOT
            //OP 01 24 LIMIET 1
            //370602145 @11,450 % 106.432,84 - 01 25 1.905.875,05 - 000000093

            //RENTE OP OORTREKKING TOT
            //OP 01 24 OOR LIMIET 1
            //370602145 @13,950% 83,24- 01 25 1.906.935,02-000000093

            //RENTE OP OORTREKKING TOT
            //OP 02 24 370604946
            //@11,200% 54.772,60- 02 25 3.290.978,48-000000093

            if (text.Contains("@") && (text.Contains("%")))
            {
                // get full narrative
                string tmp = Narrative += text;
                tmp = tmp.Replace("~", " ");
                while (tmp.Contains("  "))
                {
                    tmp = tmp.Replace("  ", " ");
                }
                string[] parts = tmp.Split(new char[] { ' ' });
                InterestAccountNumber = parts[parts.Length - 2];
            }
        }


        Narrative += text;

        if (!Narrative.StartsWith(getResX("BalanceBroughtForward")))
        {
            // transaction Date
            int Year = statementDate.Year;
            if (this.Month == 1 && previousMonth == 12)
            {
                Year++;
            }
            transactionDate = new DateTime(Year, Month, Day);
        }
        else
        {
            transactionDate = DateTime.MinValue;
        }
    }
Example #27
0
    public override string ToString()
    {
        bool deb = false;

        if (Narrative.StartsWith("INTEREST ON OVERDRAFT"))
        {
            //deb = true;
        }
        // DEBUG DUMP =========================================
        Debug.WriteLineIf(deb, "---------------------------------------------------------------------");
        Debug.WriteLineIf(deb, "Balance : " + this.Balance);
        Debug.WriteLineIf(deb, "Credit : " + this.Credit);
        Debug.WriteLineIf(deb, "Day : " + this.Day);
        Debug.WriteLineIf(deb, "Debit  : " + this.Debit);
        Debug.WriteLineIf(deb, "Index : " + this.Index);
        Debug.WriteLineIf(deb, "InterestAccountNumber : " + this.InterestAccountNumber);
        Debug.WriteLineIf(deb, "isServiceFee : " + this.isServiceFee);
        Debug.WriteLineIf(deb, "Language : " + this.Language);
        Debug.WriteLineIf(deb, "Month : " + this.Month);
        Debug.WriteLineIf(deb, "Narrative : " + this.Narrative);
        Debug.WriteLineIf(deb, "Page Number : " + this.PageNumber);
        Debug.WriteLineIf(deb, "Ref : " + this.Ref);
        Debug.WriteLineIf(deb, "Service Amount : " + this.ServiceAmount);
        Debug.WriteLineIf(deb, "Text : " + this.text);
        Debug.WriteLineIf(deb, "Transaction date : " + this.transactionDate);
        // DEBUG DUMP =========================================
        Debug.WriteLineIf(deb, "---------------------------------------------------------------------");

        int    lnarLen = 0;
        string retVal  = "";
        int    nar_len = Narrative.Length;

        Debug.WriteLineIf(deb, "Narrative Length : " + nar_len);
        int lpos = Narrative.LastIndexOf("~");

        Debug.WriteLineIf(deb, "Last Pos of ~ : " + lpos);
        if (lpos == -1)
        {
            lnarLen = Narrative.Length;
        }
        else
        {
            lnarLen = nar_len - lpos - 1;
        }
        Debug.WriteLineIf(deb, "Adjusted narrative len : " + lnarLen);

        if (lnarLen < 30)
        {
            retVal = Narrative + "".PadRight(30 - lnarLen, ' ');
            //retVal = Narrative.Replace("~", System.Environment.NewLine) + "".PadRight(30 - lnarLen, ' ');
        }
        else
        {
            retVal = Narrative;
            //retVal = Narrative.Replace("~", System.Environment.NewLine);
        }
        Debug.WriteLineIf(deb, "After Replacement of ~ to newLine : " + retVal);


        if (isServiceFee)
        {
            retVal += "     ## ";
        }
        if (ServiceAmount > 0)
        {
            retVal += string.Format("{0:N2}", ServiceAmount).PadLeft(8, ' ');
        }
        if (!isServiceFee && ServiceAmount == 0)
        {
            retVal += "".PadRight(8, ' ');
        }
        if (Debit < 0)
        {
            retVal += string.Format("{0:N2}", Debit).PadLeft(15, ' ');
        }
        else
        {
            retVal += "".PadRight(15, ' ');;   // 15 spaces
        }
        if (Credit > 0)
        {
            retVal += string.Format("{0:N2}", Credit).PadLeft(15, ' ');
        }
        else
        {
            retVal += "".PadRight(15, ' ');;   // 15 spaces
        }
        retVal += " ";
        if (Narrative.StartsWith(getResX("BalanceBroughtForward")))
        {
            retVal += "".PadRight(6, ' ');;   //  _01_12_
        }
        else
        {
            retVal += Month.ToString().PadLeft(2, '0') + " ";
            retVal += Day.ToString().PadLeft(2, '0') + " ";
        }

        retVal += string.Format("{0:N2}", Balance).PadLeft(15, ' ') + " ";

        if (!Narrative.StartsWith(getResX("BalanceBroughtForward")))
        {
            retVal += "  " + Ref.ToString().PadLeft(9, '0');
        }

        retVal += transactionDate.ToShortDateString();
        return(retVal);
    }
Example #28
0
 void Start()
 {
     narr = GameObject.FindWithTag("Narrative").GetComponent <Narrative>();
 }
Example #29
0
        /// <summary>
        ///  Create a Narrative
        /// </summary>
        /// <param name="currentUser"></param>
        /// <param name="user"></param>
        /// <param name="appID"></param>
        /// <param name="overrideID"></param>
        /// <param name="dc"></param>
        /// <param name="dataRepository"></param>
        /// <param name="uow"></param>
        public NarrativeVMDC CreateNarrative(string currentUser, string user, string appID, string overrideID, NarrativeDC dc, IRepository <Narrative> dataRepository, IUnitOfWork uow, IExceptionManager exceptionManager, IMappingService mappingService)
        {
            try
            {
                #region Parameter validation

                // Validate parameters
                if (string.IsNullOrEmpty(currentUser))
                {
                    throw new ArgumentOutOfRangeException("currentUser");
                }
                if (string.IsNullOrEmpty(user))
                {
                    throw new ArgumentOutOfRangeException("user");
                }
                if (string.IsNullOrEmpty(appID))
                {
                    throw new ArgumentOutOfRangeException("appID");
                }
                if (null == dc)
                {
                    throw new ArgumentOutOfRangeException("dc");
                }
                if (null == dataRepository)
                {
                    throw new ArgumentOutOfRangeException("dataRepository");
                }
                if (null == uow)
                {
                    throw new ArgumentOutOfRangeException("uow");
                }
                if (null == exceptionManager)
                {
                    throw new ArgumentOutOfRangeException("exceptionManager");
                }
                if (null == mappingService)
                {
                    throw new ArgumentOutOfRangeException("mappingService");
                }

                #endregion

                using (uow)
                {
                    // Create a new ID for the Narrative item
                    dc.Code = Guid.NewGuid();

                    // Map data contract to model
                    Narrative destination = mappingService.Map <NarrativeDC, Narrative>(dc);

                    // Add the new item
                    dataRepository.Add(destination);

                    // Commit unit of work
                    uow.Commit();

                    // Map model back to data contract to return new row id.
                    dc = mappingService.Map <Narrative, NarrativeDC>(destination);
                }

                // Create aggregate data contract
                NarrativeVMDC returnObject = new NarrativeVMDC();

                // Add new item to aggregate
                returnObject.NarrativeItem = dc;

                return(returnObject);
            }
            catch (Exception e)
            {
                //Prevent exception from propogating across the service interface
                exceptionManager.ShieldException(e);

                return(null);
            }
        }
Example #30
0
 public override void Interact(GameObject other)
 {
     GetComponent <Walk> ().target = transform.position;
     DialogueBox.Open(id == 0 ? Narrative.RandomGreeting() : id);
 }
Example #31
0
    public List<Narrative> getNarratives(int RequestId)
    {
        List<Narrative> _Narratives = new List<Narrative>();
        Query = "SELECT narrative.id, narrative.name, narrative.filename, narrative.description FROM Narrative INNER JOIN Request ON Request.NarrativeId = Narrative.Id WHERE Request.Id = " + RequestId + " ORDER BY Narrative.Name";
        try
        {
            Data.SqlCommand cm = new Data.SqlCommand();
            cm.CommandText = Query;
            Data.SqlDataReader rd = cm.ExecuteReader();
            while(rd.Read())
            {
                Narrative _Narrative = new Narrative();
                _Narrative.Id = rd.GetInt16(0);
                _Narrative.Name = rd.GetString(1);
                _Narrative.FileName = rd.GetString(2);
                _Narrative.Description = rd.GetString(3);
                _Narratives.Add(_Narrative);
            }
            rd.Close();
        }
        catch (Exception)
        {

            throw;
        }
        return (_Narratives);
    }
Example #32
0
        public static Bundle getBundle(string basePath)
        {
            Bundle bdl = new Bundle();

            bdl.Type = Bundle.BundleType.Document;

            // A document must have an identifier with a system and a value () type = 'document' implies (identifier.system.exists() and identifier.value.exists())

            bdl.Identifier = new Identifier()
            {
                System = "urn:ietf:rfc:3986",
                Value  = FhirUtil.createUUID()
            };

            //Composition for Discharge Summary
            Composition c = new Composition();

            //B.2 患者基本情報
            // TODO 退院時サマリー V1.41 B.2 患者基本情報のproviderOrganizationの意図を確認 B.8 受診、入院時情報に入院した
            //医療機関の記述が書かれているならば、ここの医療機関はどういう位置づけのもの? とりあえず、managingOrganizationにいれておくが。
            Patient patient = null;

            if (true)
            {
                //Patientリソースを自前で生成する場合
                patient = PatientUtil.create();
            }
            else
            {
                //Patientリソースをサーバから取ってくる場合
                #pragma warning disable 0162
                patient = PatientUtil.get();
            }

            Practitioner practitioner = PractitionerUtil.create();
            Organization organization = OrganizationUtil.create();

            patient.ManagingOrganization = new ResourceReference()
            {
                Reference = organization.Id
            };


            //Compositionの作成

            c.Id     = FhirUtil.createUUID();         //まだFHIRサーバにあげられていないから,一時的なUUIDを生成してリソースIDとしてセットする
            c.Status = CompositionStatus.Preliminary; //最終版は CompositionStatus.Final
            c.Type   = new CodeableConcept()
            {
                Text   = "Discharge Summary", //[疑問]Codable Concept内のTextと、Coding内のDisplayとの違いは。Lead Term的な表示?
                Coding = new List <Coding>()
                {
                    new Coding()
                    {
                        Display = "Discharge Summary",
                        System  = "http://loinc.org",
                        Code    = "18842-5",
                    }
                }
            };

            c.Date   = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzzz");
            c.Author = new List <ResourceReference>()
            {
                new ResourceReference()
                {
                    Reference = practitioner.Id
                }
            };

            c.Subject = new ResourceReference()
            {
                Reference = patient.Id
            };

            c.Title = "退院時サマリー"; //タイトルはこれでいいのかな。

            //B.3 承認者

            var attester = new Composition.AttesterComponent();

            var code = new Code <Composition.CompositionAttestationMode>();
            code.Value = Composition.CompositionAttestationMode.Legal;
            attester.ModeElement.Add(code);

            attester.Party = new ResourceReference()
            {
                Reference = practitioner.Id
            };
            attester.Time = "20140620";

            c.Attester.Add(attester);

            //B.4 退院時サマリー記載者

            var author = new Practitioner();
            author.Id = FhirUtil.createUUID();

            var authorName = new HumanName().WithGiven("太郎").AndFamily("本日");
            authorName.Use = HumanName.NameUse.Official;
            authorName.AddExtension("http://hl7.org/fhir/StructureDefinition/iso21090-EN-representation", new FhirString("IDE"));
            author.Name.Add(authorName);

            c.Author.Add(new ResourceReference()
            {
                Reference = author.Id
            });

            //B.5 原本管理者

            c.Custodian = new ResourceReference()
            {
                Reference = organization.Id
            };

            //B.6 関係者 保険者 何故退院サマリーに保険者の情報を入れているのかな?
            //TODO 未実装


            //sections

            //B.7 主治医
            var section_careteam = new Composition.SectionComponent();
            section_careteam.Title = "careteam";

            var careteam = new CareTeam();
            careteam.Id = FhirUtil.createUUID();

            var attendingPhysician = new Practitioner();
            attendingPhysician.Id = FhirUtil.createUUID();

            var attendingPhysicianName = new HumanName().WithGiven("二郎").AndFamily("日本");
            attendingPhysicianName.Use = HumanName.NameUse.Official;
            attendingPhysicianName.AddExtension("http://hl7.org/fhir/StructureDefinition/iso21090-EN-representation", new FhirString("IDE"));
            attendingPhysician.Name.Add(attendingPhysicianName);

            //医師の診療科はPracitionerRole/speciality + PracticeSettingCodeValueSetで表現する.
            //TODO: 膠原病内科は、Specilityのprefered ValueSetの中にはなかった。日本の診療科に関するValueSetを作る必要がある。
            var attendingPractitionerRole = new PractitionerRole();

            attendingPractitionerRole.Id           = FhirUtil.createUUID();
            attendingPractitionerRole.Practitioner = new ResourceReference()
            {
                Reference = attendingPhysician.Id
            };
            attendingPractitionerRole.Code.Add(new CodeableConcept("http://hl7.org/fhir/ValueSet/participant-role", "394733009", "Attending physician"));
            attendingPractitionerRole.Specialty.Add(new CodeableConcept("http://hl7.org/fhir/ValueSet/c80-practice-codes", "405279007", "Medical specialty--OTHER--NOT LISTED"));

            var participant = new CareTeam.ParticipantComponent();
            participant.Member = new ResourceReference()
            {
                Reference = attendingPractitionerRole.Id
            };

            careteam.Participant.Add(participant);


            section_careteam.Entry.Add(new ResourceReference()
            {
                Reference = careteam.Id
            });
            c.Section.Add(section_careteam);


            //B.8 受診、入院情報
            //B.12 本文 (Entry部) 退院時サマリーV1.41の例では入院時診断を本文に書くような形に
            //なっているが、FHIRではadmissionDetailセクション中のEncounterで記載するのが自然だろう。

            var section_admissionDetail = new Composition.SectionComponent();
            section_admissionDetail.Title = "admissionDetail";

            var encounter = new Encounter();
            encounter.Id = FhirUtil.createUUID();

            encounter.Period = new Period()
            {
                Start = "20140328", End = "20140404"
            };

            var hospitalization = new Encounter.HospitalizationComponent();
            hospitalization.DischargeDisposition = new CodeableConcept("\thttp://hl7.org/fhir/discharge-disposition", "01", "Discharged to home care or self care (routine discharge)");

            encounter.Hospitalization = hospitalization;

            var locationComponent = new Encounter.LocationComponent();
            var location          = new Location()
            {
                Id   = FhirUtil.createUUID(),
                Name = "○○クリニック",
                Type = new CodeableConcept("http://terminology.hl7.org/ValueSet/v3-ServiceDeliveryLocationRoleType", "COAG", "Coagulation clinic")
            };

            locationComponent.Location = new ResourceReference()
            {
                Reference = location.Id
            };

            section_admissionDetail.Entry.Add(new ResourceReference()
            {
                Reference = encounter.Id
            });



            var diagnosisAtAdmission = new Condition()
            {
                Code = new CodeableConcept("http://hl7.org/fhir/ValueSet/icd-10", "N801", "右卵巣嚢腫")
            };
            diagnosisAtAdmission.Id = FhirUtil.createUUID();

            var diagnosisComponentAtAdmission = new Encounter.DiagnosisComponent()
            {
                Condition = new ResourceReference()
                {
                    Reference = diagnosisAtAdmission.Id
                },
                Role = new CodeableConcept("http://hl7.org/fhir/ValueSet/diagnosis-role", "AD", "Admission diagnosis")
            };

            var encounterAtAdmission = new Encounter();
            encounterAtAdmission.Id = FhirUtil.createUUID();
            encounterAtAdmission.Diagnosis.Add(diagnosisComponentAtAdmission);
            section_admissionDetail.Entry.Add(new ResourceReference()
            {
                Reference = encounterAtAdmission.Id
            });


            c.Section.Add(section_admissionDetail);

            //B.9情報提供者

            var section_informant = new Composition.SectionComponent();
            section_informant.Title = "informant";

            var informant = new RelatedPerson();
            informant.Id = FhirUtil.createUUID();

            var informantName = new HumanName().WithGiven("藤三郎").AndFamily("東京");
            informantName.Use = HumanName.NameUse.Official;
            informantName.AddExtension("http://hl7.org/fhir/StructureDefinition/iso21090-EN-representation", new FhirString("IDE"));
            informant.Name.Add(informantName);
            informant.Patient = new ResourceReference()
            {
                Reference = patient.Id
            };
            informant.Relationship = new CodeableConcept("http://hl7.org/fhir/ValueSet/relatedperson-relationshiptype", "FTH", "father");

            informant.Address.Add(new Address()
            {
                Line       = new string[] { "新宿区神楽坂一丁目50番地" },
                State      = "東京都",
                PostalCode = "01803",
                Country    = "日本"
            });

            informant.Telecom.Add(new ContactPoint()
            {
                System = ContactPoint.ContactPointSystem.Phone,
                Use    = ContactPoint.ContactPointUse.Work,
                Value  = "tel:(03)3555-1212"
            });


            section_informant.Entry.Add(new ResourceReference()
            {
                Reference = informant.Id
            });
            c.Section.Add(section_informant);


            // B.10 本文
            // B.10.1 本文記述

            var section_clinicalSummary = new Composition.SectionComponent();
            section_clinicalSummary.Title = "来院理由";

            section_clinicalSummary.Code = new CodeableConcept("http://loinc.org", "29299-5", "Reason for visit Narrative");

            var dischargeSummaryNarrative = new Narrative();
            dischargeSummaryNarrative.Status = Narrative.NarrativeStatus.Additional;
            dischargeSummaryNarrative.Div    = @"
<div xmlns=""http://www.w3.org/1999/xhtml"">\n\n
<p>平成19年喘息と診断を受けた。平成20年7月喘息の急性増悪にて当院呼吸器内科入院。退院後HL7医院にてFollowされていた</p>
<p>平成21年10月20日頃より右足首にじんじん感が出現。左足首、両手指にも認めるようになった。同時に37℃台の熱発出現しWBC28000、Eosi58%と上昇していた</p>
<p>このとき尿路感染症が疑われセフメタゾン投与されるも改善せず。WBC31500、Eosi64%と上昇、しびれ感の増悪認めた。またHb 7.3 Ht 20.0と貧血を認めた</p>
<p>膠原病、特にChuge-stress-syndoromeが疑われ平成21年11月8日当院膠原病内科入院となった</p>
</div>
            ";

            section_clinicalSummary.Text = dischargeSummaryNarrative;
            c.Section.Add(section_clinicalSummary);

            //B.10.3 観察・検査等
            //section-observations

            var section_observations = new Composition.SectionComponent();
            section_observations.Title = "observations";

            var obs = new List <Observation>()
            {
                FhirUtil.createLOINCObservation(patient, "8302-2", "身長", new Quantity()
                {
                    Value = (decimal)2.004,
                    Unit  = "m"
                }),
                FhirUtil.createLOINCObservation(patient, "8302-2", "身長", new Quantity()
                {
                    Value = (decimal)2.004,
                    Unit  = "m"
                }),
                //Component Resultsの例 血圧- 拡張期血圧、収縮期血圧のコンポーネントを含む。
                new Observation()
                {
                    Id      = FhirUtil.createUUID(),
                    Subject = new ResourceReference()
                    {
                        Reference = patient.Id
                    },
                    Status = ObservationStatus.Final,
                    Code   = new CodeableConcept()
                    {
                        Text   = "血圧",
                        Coding = new List <Coding>()
                        {
                            new Coding()
                            {
                                System  = "http://loinc.org",
                                Code    = "18684-1",
                                Display = "血圧"
                            }
                        }
                    },
                    Component = new List <Observation.ComponentComponent>()
                    {
                        new Observation.ComponentComponent()
                        {
                            Code = new CodeableConcept()
                            {
                                Text   = "収縮期血圧血圧",
                                Coding = new List <Coding>()
                                {
                                    new Coding()
                                    {
                                        System  = "http://loinc.org",
                                        Code    = "8480-6",
                                        Display = "収縮期血圧"
                                    }
                                }
                            },
                            Value = new Quantity()
                            {
                                Value = (decimal)120,
                                Unit  = "mm[Hg]"
                            }
                        },
                        new Observation.ComponentComponent()
                        {
                            Code = new CodeableConcept()
                            {
                                Text   = "拡張期血圧",
                                Coding = new List <Coding>()
                                {
                                    new Coding()
                                    {
                                        System  = "http://loinc.org",
                                        Code    = "8462-4",
                                        Display = "拡張期血圧"
                                    }
                                }
                            },
                            Value = new Quantity()
                            {
                                Value = (decimal)100,
                                Unit  = "mm[Hg]"
                            }
                        },
                    }
                }
            };


            foreach (var res in obs)
            {
                section_observations.Entry.Add(new ResourceReference()
                {
                    Reference = res.Id
                });
            }

            c.Section.Add(section_observations);


            //B.10.4 キー画像
            //section-medicalImages


            var mediaPath = basePath + "/../../resource/Hydrocephalus_(cropped).jpg";
            var media     = new Media();
            media.Id      = FhirUtil.createUUID();
            media.Type    = Media.DigitalMediaType.Photo;
            media.Content = FhirUtil.CreateAttachmentFromFile(mediaPath);

            /* R3ではImagingStudyに入れられるのはDICOM画像だけみたい。 R4ではreasonReferenceでMediaも参照できる。
             * とりあえずDSTU3ではMediaリソースをmedicalImagesセクションにセットする。
             * var imagingStudy = new ImagingStudy();
             * imagingStudy.Id = FhirUtil.getUUID(); //まだFHIRサーバにあげられていないから,一時的なUUIDを生成してリソースIDとしてセットする
             * imagingStudy.re
             */

            var section_medicalImages = new Composition.SectionComponent();
            section_medicalImages.Title = "medicalImages";
            //TODO: sectionのcodeは?
            section_medicalImages.Entry.Add(new ResourceReference()
            {
                Reference = media.Id
            });
            c.Section.Add(section_medicalImages);


            //Bundleの構築

            //Bundleの構成要素
            //Bunbdleの一番最初はCompostion Resourceであること。
            List <Resource> bdl_entries = new List <Resource> {
                c, patient, organization, practitioner, author, careteam, encounter, encounterAtAdmission,
                diagnosisAtAdmission, location, informant, media, attendingPhysician, attendingPractitionerRole
            };
            bdl_entries.AddRange(obs);


            foreach (Resource res in bdl_entries)
            {
                var entry = new Bundle.EntryComponent();
                //entry.FullUrl = res.ResourceBase.ToString()+res.ResourceType.ToString() + res.Id;
                entry.FullUrl  = res.Id;
                entry.Resource = res;
                bdl.Entry.Add(entry);
            }

            return(bdl);
        }