Beispiel #1
0
    } // RiskAssessment

    public RiskAssessment(RiskAssessmentData rad, RiskMap riskMap) {
      dateStamp_ = rad.Timestamp.Date;
      name_ = riskMap.Name;

      var resolved = rad.ResolvedRisks();
      var managed = rad.ManagedRisks();
      var risks = rad.Risks();
      foreach (Guid id in riskMap.Risks.Select(r => r.Id)) {
        if (resolved.Contains(id))
          resolved_.Add(id);
        else if (managed.Contains(id))
          managed_.Add(id);
        else if (risks.Contains(id))
          risks_.Add(id);
        else
          notRisks_.Add(id);
      } // foreach ...

      var themes = riskMap.AllThemes();

      foreach (var theme in themes) {
        var categoryAssessments = buildThemeCategories(theme, riskMap);
        themeAssessments_.Add(new ThemeAssessment(theme, categoryAssessments, risks_, managed_));
      } // foreach
    } // RiskAssessment
Beispiel #2
0
    public Client(
      ClientData client, 
      RiskMap riskMap, 
      IList<ProjectQuestionData> projectQuestions,
      IList<ReferralAgency> referralAgencies) :
        base(client) {

      client.RiskAssessments.Sort(RiskSort);
      riskAssessment_ = new RiskAssessment(client.RiskAssessments, riskMap);

      questions_ = prepareQuestionAnswers(client, projectQuestions);
      referrals_ = prepareReferrals(client, referralAgencies);

      if (client_.Notes == null)
        return;

      generalNote_ = client_.Notes.
        Where(n => n.Type == NoteType.General).
        OrderByDescending(n => n.Timestamp).
        Select(n => n.Text).
        FirstOrDefault();

      timeLine_ = buildTimeLine(client.Notes, client.RiskAssessments, riskMap);
      files_ = client.Notes.
        Where(n => n.Type == NoteType.File).
        OrderByDescending(n => n.Timestamp).
        ToList();
    } // Client
Beispiel #3
0
    public RiskAssessment(IList<RiskAssessmentData> rads, RiskMap riskMap) :
        this(rads.Count != 0 ? rads.First() : new RiskAssessmentData(), riskMap) {

      if (rads.Count != 0) {
        var allRiskAssessments = rads.Select(r => new RiskAssessment(r, riskMap)).ToList();
        setInitialScores(allRiskAssessments.Last());
        setHighScores(allRiskAssessments);
      } // if ...
    } // RiskAssessment
Beispiel #4
0
    } // RiskSort

    private static List<TimelineEntry> buildTimeLine(List<NoteData> notes,
                                                     List<RiskAssessmentData> riskAssessments,
                                                     RiskMap riskMap) {
                                                     Dictionary<DateTime, TimelineEntry> timeLineEntries = new Dictionary<DateTime, TimelineEntry>();

      foreach (var nd in notes.OrderByDescending(n => n.Timestamp)) {
        DateTime date = nd.Timestamp.Date;
        if (!timeLineEntries.Keys.Contains(date))
          timeLineEntries.Add(date, new TimelineEntry(date));
        TimelineEntry tle = timeLineEntries[date];

        if (nd.Type == NoteType.Narrative)
          tle.addNote(nd);
        if ((nd.Type == NoteType.Registered) ||
            (nd.Type == NoteType.Reopen) ||
            (nd.Type == NoteType.DidNotAttend) ||
            (nd.Type == NoteType.Discharged))
          tle.addNote(nd.Text);
        if (nd.Type == NoteType.File)
          tle.addNote("Uploaded " + nd.Text);
        if ((nd.Type == NoteType.Event) ||
            (nd.Type == NoteType.Referral))
          tle.addAction(nd.Text);
      } // foreach note

      foreach (var rad in riskAssessments.OrderByDescending(rad => rad.Timestamp)) {
        DateTime date = rad.Timestamp.Date;
        if (!timeLineEntries.Keys.Contains(date))
          timeLineEntries.Add(date, new TimelineEntry(date));
        TimelineEntry tle = timeLineEntries[date];

        RiskAssessment ra = new RiskAssessment(rad, riskMap);
        tle.addRiskAssessment(ra);
      } // foreach riskassessment

      List<TimelineEntry> timeLine = timeLineEntries.Values.OrderByDescending(tle => tle.Datestamp).ToList();
      if (timeLine.Count > 0) {
        TimelineEntry last = timeLine.Last();
        if (last.RiskScores == null)
          last.defaultRiskScores(riskMap);
        List<TimelineEntry.RiskScore> riskScore = last.RiskScores;
        for (int i = timeLine.Count - 1; i >= 0; --i) {
          TimelineEntry tle = timeLine[i];
          if (tle.RiskScores == null)
            tle.RiskScores = riskScore;
          else
            riskScore = tle.RiskScores;
        } // foreach
      } // if ...
      return timeLine;        
    } // 
Beispiel #5
0
    } // setHighScores

    private IList<CategoryAssessment> buildThemeCategories(string themeName, RiskMap riskMap) {
      var themeCategories = new List<CategoryAssessment>();
      foreach (var category in riskMap.AllCategories()) {
        var catRisks = riskMap.Risks.
          Where(r => r.Theme == themeName).
          Where(r => r.Category == category);

        if (catRisks.Count() == 0)
          continue;

        var risks = catRisks.
          OrderBy(r => r.Grouping).
          ThenBy(r => riskScoreSort(r)).
          Select(r => new CategoryRisk(r, riskStatus(r))).
          ToList();
        themeCategories.Add(
          new CategoryAssessment(
            category,
            risks)
        );
      } // foreach
      return themeCategories;
    } // buildThemeCategories
Beispiel #6
0
 public Client(ClientData client, RiskMap riskMap) : this(client, riskMap, null, null) { }
Beispiel #7
0
 } // addRiskAssessment
 public void defaultRiskScores(RiskMap riskMap) {
   riskScores_ = riskMap.AllThemes().
                    Select(t => new RiskScore { Title = t, Score = "0" }).
                    ToList();
 } // defaultRiskScores