-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPatient.cs
More file actions
163 lines (126 loc) · 4.84 KB
/
Copy pathPatient.cs
File metadata and controls
163 lines (126 loc) · 4.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
using CodeEffects.Rule.Common.Attributes;
using CodeEffects.Rule.Common.Models;
namespace CodeEffects.Demo.Asp.AdaptiveSource
{
[Data("Education", typeof(Utils), "Schools")]
[ExternalMethod(typeof(Utils), "ExternalMethod")]
[ExternalAction(typeof(Utils), "ExternalAction")]
public class Patient
{
[Field(DisplayName = "Patient ID", Min = 0, Max = 10000000, AllowCalculations = false, IncludeInCalculations = false)]
public int ID { get; set; } = 0;
[Field(DisplayName = "First Name", Max = 200)]
public string? FirstName { get; set; }
[Field(DisplayName = "Last Name", Max = 200, Prompt = true)]
public string? LastName { get; set; }
[Field(DisplayName = "Date of Birth", DateTimeFormat = "MMM dd, yyyy")]
public DateTime DOB { get; set; } = DateTime.MinValue;
public Gender Gender { get; set; } = Gender.Undefined;
[Field(DisplayName = "Education", DataSourceName = "Education", Description = "Patient's Education", ValueInputType = ValueInputType.User)]
public string? EducationID { get; set; }
[Field(DisplayName = "Is Active")]
public bool IsActive { get; set; } = false;
[Field(Min = 0, Max = 500000, IncludeInCalculations = true, AllowCalculations = true)]
public decimal Salary { get; set; } = 0;
[Field(Min = 0, Max = 1000000, IncludeInCalculations = true, AllowCalculations = true)]
public decimal TotalInvoiced { get; set; } = 0;
[Field(Min = 0, Max = 1000000, IncludeInCalculations = true, AllowCalculations = true)]
public decimal TotalPaid { get; set; } = 0;
public Address Home { get; set; } = new Address();
public Address Work { get; set; } = new Address();
public List<string> Nicknames { get; set; } = new List<string>();
public ICollection<Visit> Visits { get; set; } = new List<Visit>();
public ICollection<Hospital> Hospitals { get; set; } = new List<Hospital>();
[ExcludeFromEvaluation]
public string? Output { get; set; }
[Method(DisplayName = "Full Name")]
public string FullName()
{
return LastName + ", " + FirstName;
}
[Method(DisplayName = "Get AI Probability", IncludeInCalculations = true)]
[return: Return(Min = 0, Max = 1, AllowCalculations = true)]
public decimal GetAiProbability([Parameter(Prompt = true)] string prompt)
{
// Get your AI implementation that returns some probability percentage here
return 0.75m;
}
[Method(DisplayName = "Get Total Debt", IncludeInCalculations = true)]
[return: Return(Min = -10000000, Max = 10000000, AllowCalculations = true)]
public static decimal CalculateTotalDebt(decimal invoiced, decimal paid)
{
return invoiced - paid;
}
public void Accept(string message)
{
this.IsActive = true;
this.Output = message;
}
public void Decline(string message)
{
this.IsActive = false;
this.Output = message;
}
}
public enum Gender
{
Undefined = 0, Male = 1, Female = 2
}
public enum State
{
Undefined = 0,
Georgia = 1,
[EnumItem("North Carolina")]
NorthCarolina = 2
}
public enum VisitType
{
Undefined = 0,
[EnumItem("Check Up")]
CheckUp = 1,
Emergency = 4
}
public class Address
{
[Parent("Home", "Home Street")]
[Parent("Work", "Work Street")]
[Field(Prompt = true)]
public string? Street { get; set; }
[Parent("Home", "Home City")]
[Parent("Work", "Work City")]
public string? City { get; set; }
[Parent("Home", "Home Zip")]
[Parent("Work", "Work Zip")]
public string? Zip { get; set; }
[Parent("Home", "Home State")]
[Parent("Work", "Work State")]
public State State { get; set; } = State.Undefined;
}
[Data("Doctors", typeof(Utils), "Doctors")]
public class Visit
{
[Field(DisplayName = "ID", Min = 0, Max = 100000, AllowCalculations = false, IncludeInCalculations = false)]
public int ID { get; set; } = 0;
[Field(DisplayName = "Doctor", DataSourceName = "Doctors", ValueInputType = ValueInputType.User)]
public string? DoctorID { get; set; }
[Field(DisplayName = "Date", DateTimeFormat = "MMM dd, yyyy")]
public DateTime Date { get; set; } = DateTime.MinValue;
public VisitType Type { get; set; } = VisitType.Undefined;
[Method(DisplayName = "Test Method")]
public VisitType TestMethod([Parameter(DataSourceName = "Doctors")] string doctorID, VisitType type)
{
if(type == VisitType.Undefined && doctorID == "abc") return VisitType.Emergency;
else return VisitType.CheckUp;
}
}
[Data("Managers", typeof(Utils), "Managers")]
public class Hospital
{
[Field(Min = 0, Max = 100000, AllowCalculations = false, IncludeInCalculations = false)]
public int ID { get; set; } = 0;
[Field(Max = 100)]
public string? Name { get; set; }
[Field(DisplayName = "Manager", DataSourceName = "Managers", ValueInputType = ValueInputType.User)]
public int ManagerID { get; set; }
}
}