completionsResponse = await client.GetCompletionsAsync(
38 | deploymentOrModelName: config["openai-code-deployment"],
39 | new CompletionsOptions()
40 | {
41 | Prompts = { prompt, },
42 | Temperature = (float)0,
43 | MaxTokens = 1000,
44 | NucleusSamplingFactor = (float)1,
45 | FrequencyPenalty = (float)0,
46 | PresencePenalty = (float)0,
47 | GenerationSampleCount = 1,
48 | });
49 |
50 | Completions completions = completionsResponse.Value;
51 |
52 | string responseMessage = string.IsNullOrEmpty(completions.Choices[0].Text)
53 | ? "Function to generate code has been executed successfully but nocode has been genrated, please try again!!!"
54 | : completions.Choices[0].Text;
55 |
56 | return responseMessage;
57 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/CC.API.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | enable
6 | enable
7 | 02ea024b-83f0-4685-a381-8a01324cca2f
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | PreserveNewest
19 |
20 |
21 | PreserveNewest
22 |
23 |
24 | PreserveNewest
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Aquaman01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to underwater battle"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/Aquaman",
24 | "display": "Aquaman"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "text": "Attending"
31 | }
32 | ],
33 | "individual": {
34 | "reference": "Practitioner/DrAtlantis",
35 | "display": "Dr. Atlantis"
36 | }
37 | }
38 | ],
39 | "period": {
40 | "start": "2022-01-01T00:00:00Z",
41 | "end": "2022-01-01T01:00:00Z"
42 | },
43 | "reasonCode": [
44 | {
45 | "coding": [
46 | {
47 | "system": "http://snomed.info/sct",
48 | "code": "39848009",
49 | "display": "Wound"
50 | }
51 | ],
52 | "text": "Wound from underwater battle"
53 | }
54 | ],
55 | "hospitalization": {
56 | "dischargeDisposition": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
60 | "code": "home",
61 | "display": "Discharged to home"
62 | }
63 | ],
64 | "text": "Discharged to home after treatment"
65 | }
66 | },
67 | "location": [
68 | {
69 | "location": {
70 | "reference": "Location/1",
71 | "display": "Atlantis Medical Center"
72 | },
73 | "status": "completed"
74 | }
75 | ]
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Batman01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/BruceWayne",
24 | "display": "Bruce Wayne"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/DrLeslieThompkins",
30 | "display": "Dr. Leslie Thompkins"
31 | }
32 | }
33 | ],
34 | "period": {
35 | "start": "2022-01-01T00:00:00Z",
36 | "end": "2022-01-01T01:00:00Z"
37 | },
38 | "reasonCode": [
39 | {
40 | "coding": [
41 | {
42 | "system": "http://snomed.info/sct",
43 | "code": "283371005",
44 | "display": "Injury of head"
45 | }
46 | ],
47 | "text": "Injury of head"
48 | }
49 | ],
50 | "diagnosis": [
51 | {
52 | "condition": {
53 | "reference": "Condition/headInjury",
54 | "display": "Head Injury"
55 | },
56 | "role": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
60 | "code": "AD",
61 | "display": "admission"
62 | }
63 | ],
64 | "text": "Admission Diagnosis"
65 | },
66 | "rank": 1
67 | }
68 | ],
69 | "location": [
70 | {
71 | "location": {
72 | "reference": "Location/GothamCity",
73 | "display": "Gotham City"
74 | },
75 | "status": "completed"
76 | }
77 | ]
78 | }
79 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Black Panther01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to injuries from battle"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/BlackPanther",
24 | "display": "T'Challa"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/DrStrange",
30 | "display": "Dr. Strange"
31 | },
32 | "type": [
33 | {
34 | "coding": [
35 | {
36 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
37 | "code": "ATND",
38 | "display": "attender"
39 | }
40 | ],
41 | "text": "Attending Physician"
42 | }
43 | ]
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T10:30:00Z",
48 | "end": "2022-01-01T11:30:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "763005",
56 | "display": "Injury of head"
57 | }
58 | ],
59 | "text": "Injury from battle"
60 | }
61 | ],
62 | "hospitalization": {
63 | "dischargeDisposition": {
64 | "coding": [
65 | {
66 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
67 | "code": "home",
68 | "display": "Discharged to home"
69 | }
70 | ],
71 | "text": "Discharged to home after treatment"
72 | }
73 | },
74 | "location": [
75 | {
76 | "location": {
77 | "reference": "Location/1",
78 | "display": "Wakanda Medical Center"
79 | },
80 | "status": "completed"
81 | }
82 | ]
83 | }
84 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Black Widow01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/BlackWidow",
24 | "display": "Black Widow"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/Hawkeye",
30 | "display": "Hawkeye"
31 | },
32 | "type": [
33 | {
34 | "text": "Admitting"
35 | }
36 | ]
37 | }
38 | ],
39 | "period": {
40 | "start": "2022-01-01T00:00:00Z",
41 | "end": "2022-01-01T01:00:00Z"
42 | },
43 | "reasonCode": [
44 | {
45 | "coding": [
46 | {
47 | "system": "http://snomed.info/sct",
48 | "code": "40917007",
49 | "display": "Battle injury"
50 | }
51 | ],
52 | "text": "Injury from battle with Taskmaster"
53 | }
54 | ],
55 | "hospitalization": {
56 | "dischargeDisposition": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
60 | "code": "home",
61 | "display": "Discharge to home"
62 | }
63 | ],
64 | "text": "Discharged to home"
65 | }
66 | },
67 | "location": [
68 | {
69 | "location": {
70 | "reference": "Location/1",
71 | "display": "Avengers Tower"
72 | },
73 | "status": "completed"
74 | }
75 | ]
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Captain America01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/CaptainAmerica",
24 | "display": "Steve Rogers"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/DrStrange",
42 | "display": "Dr. Stephen Strange"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "1941-03-01T09:00:00Z",
48 | "end": "1941-03-01T09:30:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "283385000",
56 | "display": "Battle injury"
57 | }
58 | ],
59 | "text": "Injury from battle with Red Skull"
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Deadpool01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/example",
24 | "display": "Deadpool"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/example",
42 | "display": "Dr. Strange"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "39848009",
56 | "display": "Wound"
57 | }
58 | ],
59 | "text": "Wound after battle"
60 | }
61 | ],
62 | "diagnosis": [
63 | {
64 | "condition": {
65 | "reference": "Condition/example",
66 | "display": "Wound"
67 | },
68 | "role": {
69 | "coding": [
70 | {
71 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
72 | "code": "AD",
73 | "display": "admission"
74 | }
75 | ],
76 | "text": "Admission Diagnosis"
77 | },
78 | "rank": 1
79 | }
80 | ],
81 | "hospitalization": {
82 | "dischargeDisposition": {
83 | "coding": [
84 | {
85 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
86 | "code": "home",
87 | "display": "Discharged to home"
88 | }
89 | ],
90 | "text": "Discharged to home"
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Doctor Strange01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "S",
16 | "display": "Surgery"
17 | }
18 | ],
19 | "text": "Surgery"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/doctorstrange",
24 | "display": "Doctor Strange"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/ancientone",
42 | "display": "The Ancient One"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "1963-07-01T00:00:00Z",
48 | "end": "1963-07-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "442311008",
56 | "display": "Car accident (event)"
57 | }
58 | ],
59 | "text": "Car accident"
60 | }
61 | ],
62 | "diagnosis": [
63 | {
64 | "condition": {
65 | "reference": "Condition/handinjury",
66 | "display": "Hand injury"
67 | },
68 | "role": {
69 | "coding": [
70 | {
71 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
72 | "code": "AD",
73 | "display": "admission"
74 | }
75 | ],
76 | "text": "Admission diagnosis"
77 | },
78 | "rank": 1
79 | }
80 | ],
81 | "hospitalization": {
82 | "dischargeDisposition": {
83 | "coding": [
84 | {
85 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
86 | "code": "home",
87 | "display": "Discharged to home"
88 | }
89 | ],
90 | "text": "Discharged to home"
91 | }
92 | },
93 | "location": [
94 | {
95 | "location": {
96 | "reference": "Location/kamar-taj",
97 | "display": "Kamar-Taj"
98 | },
99 | "status": "completed"
100 | }
101 | ]
102 | }
103 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Flash01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "flash-encounter-1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to speed force accident"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/flash",
24 | "display": "Barry Allen (Flash)"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/dr-wells",
30 | "display": "Dr. Harrison Wells"
31 | }
32 | }
33 | ],
34 | "period": {
35 | "start": "2022-01-01T00:00:00Z",
36 | "end": "2022-01-01T01:00:00Z"
37 | },
38 | "reasonCode": [
39 | {
40 | "coding": [
41 | {
42 | "system": "http://snomed.info/sct",
43 | "code": "419170006",
44 | "display": "Speed force accident"
45 | }
46 | ],
47 | "text": "Speed force accident"
48 | }
49 | ],
50 | "hospitalization": {
51 | "dischargeDisposition": {
52 | "coding": [
53 | {
54 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
55 | "code": "home",
56 | "display": "Discharged to home"
57 | }
58 | ],
59 | "text": "Discharged to home"
60 | }
61 | },
62 | "location": [
63 | {
64 | "location": {
65 | "reference": "Location/1",
66 | "display": "Central City Hospital"
67 | },
68 | "status": "completed"
69 | }
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Green Lantern01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to intergalactic conflict"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/GreenLantern",
24 | "display": "Green Lantern"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/DrFate",
42 | "display": "Dr. Fate"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "39848009",
56 | "display": "Wound"
57 | }
58 | ],
59 | "text": "Wound from intergalactic conflict"
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Harley Quinn01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/HarleyQuinn",
24 | "display": "Harley Quinn"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/Batman",
30 | "display": "Batman"
31 | },
32 | "type": [
33 | {
34 | "text": "Admitting"
35 | }
36 | ]
37 | }
38 | ],
39 | "period": {
40 | "start": "2022-01-01T00:00:00Z",
41 | "end": "2022-01-01T01:00:00Z"
42 | },
43 | "reasonCode": [
44 | {
45 | "coding": [
46 | {
47 | "system": "http://snomed.info/sct",
48 | "code": "408512008",
49 | "display": "Disturbance in behavior"
50 | }
51 | ],
52 | "text": "Disturbance in behavior"
53 | }
54 | ],
55 | "diagnosis": [
56 | {
57 | "condition": {
58 | "reference": "Condition/mentalDisorder",
59 | "display": "Mental Disorder"
60 | },
61 | "role": {
62 | "coding": [
63 | {
64 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
65 | "code": "AD",
66 | "display": "admission"
67 | }
68 | ],
69 | "text": "Admission diagnosis"
70 | },
71 | "rank": 1
72 | }
73 | ],
74 | "hospitalization": {
75 | "dischargeDisposition": {
76 | "coding": [
77 | {
78 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
79 | "code": "home",
80 | "display": "Discharged to home"
81 | }
82 | ],
83 | "text": "Discharged to home"
84 | }
85 | },
86 | "location": [
87 | {
88 | "location": {
89 | "reference": "Location/ArkhamAsylum",
90 | "display": "Arkham Asylum"
91 | },
92 | "status": "completed"
93 | }
94 | ]
95 | }
96 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Hawkeye01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "subject": {
11 | "reference": "Patient/Hawkeye",
12 | "display": "Hawkeye"
13 | },
14 | "participant": [
15 | {
16 | "individual": {
17 | "reference": "Practitioner/doctor1",
18 | "display": "Dr. Strange"
19 | }
20 | }
21 | ],
22 | "period": {
23 | "start": "2022-01-01T00:00:00Z",
24 | "end": "2022-01-01T01:00:00Z"
25 | },
26 | "reasonCode": [
27 | {
28 | "coding": [
29 | {
30 | "system": "http://snomed.info/sct",
31 | "code": "123456",
32 | "display": "Injury from battle"
33 | }
34 | ]
35 | }
36 | ],
37 | "diagnosis": [
38 | {
39 | "condition": {
40 | "reference": "Condition/condition1",
41 | "display": "Arrow wound"
42 | },
43 | "role": {
44 | "coding": [
45 | {
46 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
47 | "code": "AD",
48 | "display": "admission"
49 | }
50 | ]
51 | },
52 | "rank": 1
53 | }
54 | ],
55 | "hospitalization": {
56 | "dischargeDisposition": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
60 | "code": "home",
61 | "display": "Discharged to home"
62 | }
63 | ]
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Iron Man01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Visit"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/IronMan",
24 | "display": "Stark, Anthony"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/DrStrange",
30 | "display": "Strange, Stephen"
31 | }
32 | }
33 | ],
34 | "period": {
35 | "start": "2022-01-01T00:00:00Z",
36 | "end": "2022-01-01T01:00:00Z"
37 | },
38 | "reasonCode": [
39 | {
40 | "coding": [
41 | {
42 | "system": "http://snomed.info/sct",
43 | "code": "39848009",
44 | "display": "Chest Pain"
45 | }
46 | ],
47 | "text": "Chest Pain due to Arc Reactor malfunction"
48 | }
49 | ],
50 | "diagnosis": [
51 | {
52 | "condition": {
53 | "reference": "Condition/arcReactorMalfunction",
54 | "display": "Arc Reactor Malfunction"
55 | },
56 | "role": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
60 | "code": "AD",
61 | "display": "admission"
62 | }
63 | ],
64 | "text": "Admission Diagnosis"
65 | },
66 | "rank": 1
67 | }
68 | ],
69 | "hospitalization": {
70 | "dischargeDisposition": {
71 | "coding": [
72 | {
73 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
74 | "code": "home",
75 | "display": "Discharged to home"
76 | }
77 | ],
78 | "text": "Discharged to home after Arc Reactor repair"
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Loki01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/Loki",
24 | "display": "Loki Laufeyson"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/Thor",
30 | "display": "Thor Odinson"
31 | },
32 | "type": [
33 | {
34 | "text": "Admitting"
35 | }
36 | ]
37 | }
38 | ],
39 | "period": {
40 | "start": "2022-01-01T00:00:00Z",
41 | "end": "2022-01-01T01:00:00Z"
42 | },
43 | "reasonCode": [
44 | {
45 | "coding": [
46 | {
47 | "system": "http://snomed.info/sct",
48 | "code": "408512008",
49 | "display": "Injury of head"
50 | }
51 | ],
52 | "text": "Injury of head due to battle with Thor"
53 | }
54 | ],
55 | "hospitalization": {
56 | "dischargeDisposition": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
60 | "code": "home",
61 | "display": "Discharged to home"
62 | }
63 | ],
64 | "text": "Discharged to home"
65 | }
66 | },
67 | "location": [
68 | {
69 | "location": {
70 | "reference": "Location/1",
71 | "display": "Asgard Royal Hospital"
72 | },
73 | "status": "completed"
74 | }
75 | ]
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Spider-Man01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/spiderman",
24 | "display": "Peter Parker (Spider-Man)"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/doctorstrange",
30 | "display": "Dr. Stephen Strange"
31 | }
32 | }
33 | ],
34 | "period": {
35 | "start": "2002-05-03T09:00:00Z",
36 | "end": "2002-05-03T09:30:00Z"
37 | },
38 | "reasonCode": [
39 | {
40 | "coding": [
41 | {
42 | "system": "http://snomed.info/sct",
43 | "code": "283385000",
44 | "display": "Stung by spider"
45 | }
46 | ],
47 | "text": "Stung by a genetically modified spider"
48 | }
49 | ],
50 | "diagnosis": [
51 | {
52 | "condition": {
53 | "reference": "Condition/spiderbite",
54 | "display": "Spider bite"
55 | },
56 | "role": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
60 | "code": "AD",
61 | "display": "admission"
62 | }
63 | ],
64 | "text": "Admission Diagnosis"
65 | },
66 | "rank": 1
67 | }
68 | ],
69 | "hospitalization": {
70 | "dischargeDisposition": {
71 | "coding": [
72 | {
73 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
74 | "code": "home",
75 | "display": "Discharged to home"
76 | }
77 | ],
78 | "text": "Discharged to home"
79 | }
80 | },
81 | "location": [
82 | {
83 | "location": {
84 | "reference": "Location/1",
85 | "display": "New York City Hospital"
86 | },
87 | "status": "completed"
88 | }
89 | ]
90 | }
91 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Superman01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to Kryptonite exposure"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/Superman",
24 | "display": "Clark Kent"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/Dr.EmilHamilton",
42 | "display": "Dr. Emil Hamilton"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "41917002",
56 | "display": "Exposure to radiation (event)"
57 | }
58 | ],
59 | "text": "Exposure to Kryptonite radiation"
60 | }
61 | ]
62 | }
63 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/The Hulk01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter due to transformation into Hulk"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/hulk",
24 | "display": "Bruce Banner"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/tonyStark",
30 | "display": "Tony Stark"
31 | },
32 | "type": [
33 | {
34 | "text": "Consultant"
35 | }
36 | ]
37 | }
38 | ],
39 | "period": {
40 | "start": "2022-01-01T00:00:00Z",
41 | "end": "2022-01-01T01:00:00Z"
42 | },
43 | "reasonCode": [
44 | {
45 | "coding": [
46 | {
47 | "system": "http://snomed.info/sct",
48 | "code": "12345678",
49 | "display": "Transformation into Hulk"
50 | }
51 | ],
52 | "text": "Transformation into Hulk"
53 | }
54 | ],
55 | "hospitalization": {
56 | "dischargeDisposition": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
60 | "code": "home",
61 | "display": "Discharged to home"
62 | }
63 | ],
64 | "text": "Discharged to home"
65 | }
66 | },
67 | "location": [
68 | {
69 | "location": {
70 | "reference": "Location/1",
71 | "display": "Stark Tower"
72 | },
73 | "status": "completed"
74 | }
75 | ]
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/The Joker01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/The Joker",
24 | "display": "The Joker"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/Batman",
30 | "display": "Batman"
31 | },
32 | "type": [
33 | {
34 | "coding": [
35 | {
36 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
37 | "code": "ATND",
38 | "display": "Attender"
39 | }
40 | ],
41 | "text": "Attender"
42 | }
43 | ]
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "408512008",
56 | "display": "Crime victim"
57 | }
58 | ],
59 | "text": "Crime victim"
60 | }
61 | ],
62 | "hospitalization": {
63 | "dischargeDisposition": {
64 | "coding": [
65 | {
66 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
67 | "code": "home",
68 | "display": "Discharged to home"
69 | }
70 | ],
71 | "text": "Discharged to home"
72 | }
73 | },
74 | "location": [
75 | {
76 | "location": {
77 | "reference": "Location/1",
78 | "display": "Gotham City Hospital"
79 | },
80 | "status": "completed"
81 | }
82 | ]
83 | }
84 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Thor01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/Thor",
24 | "display": "Thor Odinson"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/Hulk",
42 | "display": "Bruce Banner"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "39848009",
56 | "display": "Wound"
57 | }
58 | ],
59 | "text": "Wound after battle with Loki"
60 | }
61 | ],
62 | "hospitalization": {
63 | "dischargeDisposition": {
64 | "coding": [
65 | {
66 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
67 | "code": "home",
68 | "display": "Discharged to home"
69 | }
70 | ],
71 | "text": "Discharged to home"
72 | }
73 | },
74 | "location": [
75 | {
76 | "location": {
77 | "reference": "Location/1",
78 | "display": "Asgard Medical Center"
79 | },
80 | "status": "completed"
81 | }
82 | ]
83 | }
84 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Wolverine01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/Wolverine",
24 | "display": "Logan"
25 | },
26 | "participant": [
27 | {
28 | "type": [
29 | {
30 | "coding": [
31 | {
32 | "system": "http://terminology.hl7.org/CodeSystem/v3-ParticipationType",
33 | "code": "ATND",
34 | "display": "attender"
35 | }
36 | ],
37 | "text": "Attender"
38 | }
39 | ],
40 | "individual": {
41 | "reference": "Practitioner/DrXavier",
42 | "display": "Dr. Charles Xavier"
43 | }
44 | }
45 | ],
46 | "period": {
47 | "start": "2022-01-01T00:00:00Z",
48 | "end": "2022-01-01T01:00:00Z"
49 | },
50 | "reasonCode": [
51 | {
52 | "coding": [
53 | {
54 | "system": "http://snomed.info/sct",
55 | "code": "283385000",
56 | "display": "Wound"
57 | }
58 | ],
59 | "text": "Wound after battle"
60 | }
61 | ],
62 | "hospitalization": {
63 | "dischargeDisposition": {
64 | "coding": [
65 | {
66 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
67 | "code": "home",
68 | "display": "Discharged to home"
69 | }
70 | ],
71 | "text": "Discharged to home"
72 | }
73 | },
74 | "location": [
75 | {
76 | "location": {
77 | "reference": "Location/1",
78 | "display": "X-Mansion"
79 | },
80 | "status": "completed"
81 | }
82 | ]
83 | }
84 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Encounters/Wonder Woman01.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Encounter",
3 | "id": "encounter1",
4 | "status": "finished",
5 | "class": {
6 | "system": "http://terminology.hl7.org/CodeSystem/v3-ActCode",
7 | "code": "AMB",
8 | "display": "ambulatory"
9 | },
10 | "type": [
11 | {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0004",
15 | "code": "EMER",
16 | "display": "Emergency"
17 | }
18 | ],
19 | "text": "Emergency Encounter"
20 | }
21 | ],
22 | "subject": {
23 | "reference": "Patient/WonderWoman",
24 | "display": "Diana Prince"
25 | },
26 | "participant": [
27 | {
28 | "individual": {
29 | "reference": "Practitioner/SteveTrevor",
30 | "display": "Steve Trevor"
31 | }
32 | }
33 | ],
34 | "period": {
35 | "start": "2022-01-01T00:00:00Z",
36 | "end": "2022-01-01T01:00:00Z"
37 | },
38 | "reasonCode": [
39 | {
40 | "coding": [
41 | {
42 | "system": "http://snomed.info/sct",
43 | "code": "39848009",
44 | "display": "Wound"
45 | }
46 | ],
47 | "text": "Wound from battle with Ares"
48 | }
49 | ],
50 | "diagnosis": [
51 | {
52 | "condition": {
53 | "reference": "Condition/battleWound",
54 | "display": "Battle wound"
55 | },
56 | "role": {
57 | "coding": [
58 | {
59 | "system": "http://terminology.hl7.org/CodeSystem/diagnosis-role",
60 | "code": "AD",
61 | "display": "admission"
62 | }
63 | ],
64 | "text": "Admission Diagnosis"
65 | },
66 | "rank": 1
67 | }
68 | ],
69 | "hospitalization": {
70 | "dischargeDisposition": {
71 | "coding": [
72 | {
73 | "system": "http://terminology.hl7.org/CodeSystem/discharge-disposition",
74 | "code": "home",
75 | "display": "Discharged to home"
76 | }
77 | ],
78 | "text": "Discharged to home"
79 | }
80 | },
81 | "location": [
82 | {
83 | "location": {
84 | "reference": "Location/Themyscira",
85 | "display": "Themyscira"
86 | },
87 | "status": "completed"
88 | }
89 | ]
90 | }
91 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Aquaman.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "aquaman",
4 | "text": {
5 | "status": "generated",
6 | "div": "Aquaman
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Aquaman"
20 | },
21 | "system": "http://hospital.somewhere.org",
22 | "value": "123456789",
23 | "period": {
24 | "start": "1941-11-01"
25 | },
26 | "assigner": {
27 | "display": "DC Comics"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Curry",
36 | "given": [
37 | "Arthur"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1941-11-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Atlantis"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
68 | "valueCodeableConcept": {
69 | "coding": [
70 | {
71 | "system": "http://snomed.info/sct",
72 | "code": "300916003",
73 | "display": "Dehydration"
74 | }
75 | ],
76 | "text": "Dehydration"
77 | }
78 | }
79 | ]
80 | }
81 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Batman.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "batman",
4 | "text": {
5 | "status": "generated",
6 | "div": "Batman
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Batman"
20 | },
21 | "system": "http://hospital.saintwayne.com",
22 | "value": "batman",
23 | "period": {
24 | "start": "1939-05-01"
25 | },
26 | "assigner": {
27 | "display": "Saint Wayne Hospital"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Wayne",
36 | "given": [
37 | "Bruce"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1939-05-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "line": [
48 | "1007 Mountain Drive"
49 | ],
50 | "city": "Gotham",
51 | "state": "New Jersey",
52 | "postalCode": "12345",
53 | "country": "USA"
54 | }
55 | ],
56 | "communication": [
57 | {
58 | "language": {
59 | "coding": [
60 | {
61 | "system": "urn:ietf:bcp:47",
62 | "code": "en-US",
63 | "display": "English (United States)"
64 | }
65 | ]
66 | },
67 | "preferred": true
68 | }
69 | ],
70 | "extension": [
71 | {
72 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
73 | "valueString": "Fear of Bats"
74 | }
75 | ]
76 | }
77 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Black Widow.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "black-widow",
4 | "text": {
5 | "status": "generated",
6 | "div": "Black Widow
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Black Widow"
20 | },
21 | "system": "urn:oid:1.2.36.146.595.217.0.1",
22 | "value": "12345",
23 | "period": {
24 | "start": "1964-04-01"
25 | },
26 | "assigner": {
27 | "display": "Marvel Comics"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Romanova",
36 | "given": [
37 | "Natalia", "Alianovna"
38 | ]
39 | }
40 | ],
41 | "gender": "female",
42 | "birthDate": "1964-04-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Unknown"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
68 | "valueString": "Red Room's brainwashing and psychological conditioning"
69 | }
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Captain America.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "captain-america",
4 | "text": {
5 | "status": "generated",
6 | "div": ""
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Captain America"
20 | },
21 | "system": "http://hospital.somewhere.org",
22 | "value": "captain-america"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Rogers",
30 | "given": [
31 | "Steve"
32 | ]
33 | }
34 | ],
35 | "gender": "male",
36 | "birthDate": "1941-03-01",
37 | "deceasedBoolean": false,
38 | "address": [
39 | {
40 | "use": "home",
41 | "type": "both",
42 | "text": "New York, USA"
43 | }
44 | ],
45 | "communication": [
46 | {
47 | "language": {
48 | "coding": [
49 | {
50 | "system": "urn:ietf:bcp:47",
51 | "code": "en",
52 | "display": "English"
53 | }
54 | ]
55 | },
56 | "preferred": true
57 | }
58 | ]
59 | }
60 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Deadpool.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "deadpool",
4 | "text": {
5 | "status": "generated",
6 | "div": "Deadpool
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Deadpool"
20 | },
21 | "system": "http://hospital.somewhere.org",
22 | "value": "deadpool"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Wilson",
30 | "given": [
31 | "Wade",
32 | "Winston"
33 | ]
34 | },
35 | {
36 | "use": "nickname",
37 | "given": [
38 | "Deadpool"
39 | ]
40 | }
41 | ],
42 | "gender": "male",
43 | "birthDate": "1991-02-01",
44 | "deceasedBoolean": false,
45 | "address": [
46 | {
47 | "use": "home",
48 | "line": [
49 | "123 Fake Street"
50 | ],
51 | "city": "New York",
52 | "state": "NY",
53 | "postalCode": "10001",
54 | "country": "USA"
55 | }
56 | ],
57 | "communication": [
58 | {
59 | "language": {
60 | "coding": [
61 | {
62 | "system": "urn:ietf:bcp:47",
63 | "code": "en-US",
64 | "display": "English (United States)"
65 | }
66 | ]
67 | },
68 | "preferred": true
69 | }
70 | ],
71 | "extension": [
72 | {
73 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
74 | "valueString": "Cure for cancer"
75 | }
76 | ]
77 | }
78 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Doctor Strange.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "doctor-strange",
4 | "text": {
5 | "status": "generated",
6 | "div": "Doctor Strange
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "12345"
20 | },
21 | "system": "http://hospital.somewhere.org",
22 | "value": "12345",
23 | "period": {
24 | "start": "1963-07-01"
25 | },
26 | "assigner": {
27 | "display": "Hospital Somewhere"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Strange",
36 | "given": [
37 | "Stephen"
38 | ]
39 | },
40 | {
41 | "use": "nickname",
42 | "given": [
43 | "Doctor Strange"
44 | ]
45 | }
46 | ],
47 | "gender": "male",
48 | "birthDate": "1963-07-01",
49 | "communication": [
50 | {
51 | "language": {
52 | "coding": [
53 | {
54 | "system": "urn:ietf:bcp:47",
55 | "code": "en-US",
56 | "display": "English (United States)"
57 | }
58 | ]
59 | },
60 | "preferred": true
61 | }
62 | ],
63 | "link": [
64 | {
65 | "other": {
66 | "reference": "AllergyIntolerance/doctor-strange-weakness"
67 | },
68 | "type": "seealso"
69 | }
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Flash.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "flash",
4 | "text": {
5 | "status": "generated",
6 | "div": "Flash
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Flash"
20 | },
21 | "system": "http://hospital.example.org",
22 | "value": "123456"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Allen",
30 | "given": [
31 | "Barry"
32 | ]
33 | }
34 | ],
35 | "gender": "male",
36 | "birthDate": "1956-10-01",
37 | "deceasedBoolean": false,
38 | "address": [
39 | {
40 | "use": "home",
41 | "line": [
42 | "123 Fake Street"
43 | ],
44 | "city": "Central City",
45 | "state": "KS",
46 | "postalCode": "12345",
47 | "country": "USA"
48 | }
49 | ],
50 | "communication": [
51 | {
52 | "language": {
53 | "coding": [
54 | {
55 | "system": "urn:ietf:bcp:47",
56 | "code": "en-US",
57 | "display": "English (United States)"
58 | }
59 | ]
60 | },
61 | "preferred": true
62 | }
63 | ],
64 | "extension": [
65 | {
66 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
67 | "valueString": "Cold"
68 | }
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Green Lantern.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "green-lantern",
4 | "text": {
5 | "status": "generated",
6 | "div": "Green Lantern
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Green Lantern"
20 | },
21 | "system": "http://example.org/patients",
22 | "value": "green-lantern"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Jordan",
30 | "given": [
31 | "Hal"
32 | ]
33 | }
34 | ],
35 | "gender": "male",
36 | "birthDate": "1940-07-22",
37 | "communication": [
38 | {
39 | "language": {
40 | "coding": [
41 | {
42 | "system": "urn:ietf:bcp:47",
43 | "code": "en",
44 | "display": "English"
45 | }
46 | ],
47 | "text": "English"
48 | },
49 | "preferred": true
50 | }
51 | ],
52 | "link": [
53 | {
54 | "other": {
55 | "reference": "AllergyIntolerance/green-lantern-weakness"
56 | },
57 | "type": "seealso"
58 | }
59 | ]
60 | }
61 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Harley Quinn.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "harley-quinn",
4 | "text": {
5 | "status": "generated",
6 | "div": "Harley Quinn
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "official",
11 | "system": "http://example.com/fhir/identifiers",
12 | "value": "harley-quinn"
13 | }
14 | ],
15 | "active": true,
16 | "name": [
17 | {
18 | "use": "official",
19 | "family": "Quinzel",
20 | "given": [
21 | "Harleen",
22 | "Frances"
23 | ],
24 | "prefix": [
25 | "Dr."
26 | ]
27 | },
28 | {
29 | "use": "alias",
30 | "text": "Harley Quinn"
31 | }
32 | ],
33 | "gender": "female",
34 | "birthDate": "1992-09-11",
35 | "communication": [
36 | {
37 | "language": {
38 | "coding": [
39 | {
40 | "system": "urn:ietf:bcp:47",
41 | "code": "en",
42 | "display": "English"
43 | }
44 | ]
45 | },
46 | "preferred": true
47 | }
48 | ],
49 | "link": [
50 | {
51 | "other": {
52 | "reference": "Patient/joker"
53 | },
54 | "type": "seealso"
55 | }
56 | ],
57 | "extension": [
58 | {
59 | "url": "http://example.com/fhir/StructureDefinition/allergyintolerance",
60 | "valueReference": {
61 | "reference": "AllergyIntolerance/harley-quinn-weakness"
62 | }
63 | }
64 | ]
65 | }
66 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Hawkeye.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "hawkeye",
4 | "text": {
5 | "status": "generated",
6 | "div": ""
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Hawkeye"
20 | },
21 | "system": "http://hospital.example.org",
22 | "value": "hawkeye"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Hawkeye",
30 | "given": [
31 | "Clint",
32 | "Barton"
33 | ]
34 | }
35 | ],
36 | "gender": "male",
37 | "birthDate": "1964-09-01",
38 | "deceasedBoolean": false
39 | }
40 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Loki.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "loki",
4 | "text": {
5 | "status": "generated",
6 | "div": "Loki
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "12345"
20 | },
21 | "system": "http://hospital.smarthealthit.org",
22 | "value": "12345",
23 | "period": {
24 | "start": "1950-08-01"
25 | },
26 | "assigner": {
27 | "display": "Smart Health IT"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Laufeyson",
36 | "given": [
37 | "Loki"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1962-10-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Asgard"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
68 | "valueString": "Thor"
69 | }
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Spider-Man.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "spiderman",
4 | "text": {
5 | "status": "generated",
6 | "div": "Spider-Man
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Spider-Man"
20 | },
21 | "system": "urn:oid:1.2.36.146.595.217.0.1",
22 | "value": "12345",
23 | "period": {
24 | "start": "1962-08-01"
25 | },
26 | "assigner": {
27 | "display": "Marvel Comics"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Parker",
36 | "given": [
37 | "Peter"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1962-08-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "line": [
48 | "20 Ingram Street",
49 | "Forest Hills"
50 | ],
51 | "city": "New York",
52 | "state": "NY",
53 | "postalCode": "11375",
54 | "country": "USA"
55 | }
56 | ],
57 | "communication": [
58 | {
59 | "language": {
60 | "coding": [
61 | {
62 | "system": "urn:ietf:bcp:47",
63 | "code": "en-US",
64 | "display": "English (United States)"
65 | }
66 | ]
67 | },
68 | "preferred": true
69 | }
70 | ],
71 | "extension": [
72 | {
73 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
74 | "valueString": "Ethyl Chloride"
75 | }
76 | ]
77 | }
78 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Superman.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "superman",
4 | "text": {
5 | "status": "generated",
6 | "div": "Superman
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Superman"
20 | },
21 | "system": "urn:oid:1.2.36.146.595.217.0.1",
22 | "value": "12345",
23 | "period": {
24 | "start": "1938-04-18"
25 | },
26 | "assigner": {
27 | "display": "DC Comics"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Kent",
36 | "given": [
37 | "Clark"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1938-04-18",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Metropolis"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://hl7.org/fhir/StructureDefinition/patient-nationality",
68 | "extension": [
69 | {
70 | "url": "code",
71 | "valueCodeableConcept": {
72 | "coding": [
73 | {
74 | "system": "urn:iso:std:iso:3166",
75 | "code": "US",
76 | "display": "United States of America"
77 | }
78 | ]
79 | }
80 | }
81 | ]
82 | }
83 | ]
84 | }
85 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/The Hulk.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "hulk001",
4 | "text": {
5 | "status": "generated",
6 | "div": "Bruce Banner aka The Hulk
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Medical record number"
20 | },
21 | "system": "http://hospital.example.org",
22 | "value": "hulk001",
23 | "period": {
24 | "start": "1962-05-01"
25 | },
26 | "assigner": {
27 | "display": "Hospital Example"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Banner",
36 | "given": [
37 | "Bruce"
38 | ]
39 | },
40 | {
41 | "use": "nickname",
42 | "given": [
43 | "Hulk"
44 | ]
45 | }
46 | ],
47 | "gender": "male",
48 | "birthDate": "1962-05-01",
49 | "deceasedBoolean": false,
50 | "address": [
51 | {
52 | "use": "home",
53 | "type": "both",
54 | "text": "Unknown"
55 | }
56 | ],
57 | "communication": [
58 | {
59 | "language": {
60 | "coding": [
61 | {
62 | "system": "urn:ietf:bcp:47",
63 | "code": "en",
64 | "display": "English"
65 | }
66 | ]
67 | },
68 | "preferred": true
69 | }
70 | ],
71 | "managingOrganization": {
72 | "reference": "Organization/hospital-example"
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/The Joker.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "joker",
4 | "text": {
5 | "status": "generated",
6 | "div": "The Joker
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "The Joker"
20 | },
21 | "system": "http://hospital.example.org",
22 | "value": "123456"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Unknown",
30 | "given": [
31 | "The Joker"
32 | ]
33 | }
34 | ],
35 | "gender": "male",
36 | "birthDate": "1940-04-25",
37 | "deceasedBoolean": false,
38 | "address": [
39 | {
40 | "use": "home",
41 | "line": [
42 | "1007 Mountain Drive"
43 | ],
44 | "city": "Gotham",
45 | "state": "NY",
46 | "postalCode": "12345",
47 | "country": "USA"
48 | }
49 | ],
50 | "communication": [
51 | {
52 | "language": {
53 | "coding": [
54 | {
55 | "system": "urn:ietf:bcp:47",
56 | "code": "en",
57 | "display": "English"
58 | }
59 | ]
60 | },
61 | "preferred": true
62 | }
63 | ],
64 | "managingOrganization": {
65 | "reference": "Organization/hospital"
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Thor.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "Thor",
4 | "text": {
5 | "status": "generated",
6 | "div": ""
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Thor"
20 | },
21 | "system": "http://hospital.smarthealthit.org",
22 | "value": "Thor",
23 | "period": {
24 | "start": "1962-08-01"
25 | },
26 | "assigner": {
27 | "display": "Smart Health IT"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Odinson",
36 | "given": [
37 | "Thor"
38 | ]
39 | }
40 | ],
41 | "gender": "male",
42 | "birthDate": "1962-08-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Asgard"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://example.org/fhir/StructureDefinition/allergyintolerance",
68 | "valueString": "Lack of worthiness"
69 | }
70 | ]
71 | }
72 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Wolverine.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "wolverine",
4 | "text": {
5 | "status": "generated",
6 | "div": "Wolverine
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Wolverine"
20 | },
21 | "system": "http://hospital.example.org",
22 | "value": "wolverine"
23 | }
24 | ],
25 | "active": true,
26 | "name": [
27 | {
28 | "use": "official",
29 | "family": "Logan",
30 | "given": [
31 | "James",
32 | "Howlett"
33 | ]
34 | }
35 | ],
36 | "gender": "male",
37 | "birthDate": "1974-10-01",
38 | "deceasedBoolean": false,
39 | "address": [
40 | {
41 | "use": "home",
42 | "type": "both",
43 | "text": "X-Mansion, 1407 Graymalkin Lane, Salem Center, Westchester County, New York, USA"
44 | }
45 | ],
46 | "communication": [
47 | {
48 | "language": {
49 | "coding": [
50 | {
51 | "system": "urn:ietf:bcp:47",
52 | "code": "en",
53 | "display": "English"
54 | }
55 | ]
56 | },
57 | "preferred": true
58 | }
59 | ],
60 | "managingOrganization": {
61 | "reference": "Organization/1",
62 | "display": "X-Men"
63 | },
64 | "link": [
65 | {
66 | "other": {
67 | "reference": "Patient/wolverine"
68 | },
69 | "type": "seealso"
70 | }
71 | ]
72 | }
73 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Data/Patients/Wonder Woman.json:
--------------------------------------------------------------------------------
1 | {
2 | "resourceType": "Patient",
3 | "id": "wonderwoman",
4 | "text": {
5 | "status": "generated",
6 | "div": "Wonder Woman
"
7 | },
8 | "identifier": [
9 | {
10 | "use": "usual",
11 | "type": {
12 | "coding": [
13 | {
14 | "system": "http://terminology.hl7.org/CodeSystem/v2-0203",
15 | "code": "MR",
16 | "display": "Medical record number"
17 | }
18 | ],
19 | "text": "Wonder Woman"
20 | },
21 | "system": "urn:oid:1.2.36.146.595.217.0.1",
22 | "value": "12345",
23 | "period": {
24 | "start": "1941-12-01"
25 | },
26 | "assigner": {
27 | "display": "DC Comics"
28 | }
29 | }
30 | ],
31 | "active": true,
32 | "name": [
33 | {
34 | "use": "official",
35 | "family": "Prince",
36 | "given": [
37 | "Diana"
38 | ]
39 | }
40 | ],
41 | "gender": "female",
42 | "birthDate": "1941-12-01",
43 | "deceasedBoolean": false,
44 | "address": [
45 | {
46 | "use": "home",
47 | "type": "both",
48 | "text": "Themyscira"
49 | }
50 | ],
51 | "communication": [
52 | {
53 | "language": {
54 | "coding": [
55 | {
56 | "system": "urn:ietf:bcp:47",
57 | "code": "en",
58 | "display": "English"
59 | }
60 | ]
61 | },
62 | "preferred": true
63 | }
64 | ],
65 | "extension": [
66 | {
67 | "url": "http://hl7.org/fhir/StructureDefinition/patient-mothersMaidenName",
68 | "valueString": "Hippolyta"
69 | }
70 | ],
71 | "link": [
72 | {
73 | "other": {
74 | "reference": "Patient/steve-trevor"
75 | },
76 | "type": "seealso"
77 | }
78 | ]
79 | }
80 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GenerateFhirEncounters/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": 1,
3 | "type": "completion",
4 | "description": "Generate HL7 FHIR encounters to represent encounters for a comic book character.",
5 | "completion": {
6 | "max_tokens": 1000,
7 | "temperature": 0.0,
8 | "top_p": 0.0,
9 | "presence_penalty": 0.0,
10 | "frequency_penalty": 0.0
11 | },
12 | "input": {
13 | "parameters": [
14 | {
15 | "name": "input",
16 | "description": "The name of the comic book character.",
17 | "defaultValue": ""
18 | }
19 | ]
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GenerateFhirEncounters/skprompt.txt:
--------------------------------------------------------------------------------
1 | generate a valid HL7 FHIR R4 Encounter in JSON format.
2 | all required properties must be present: the resourcetype property should have value of "Encounter"
3 | encounter should be based on a scenario from the character's comic book history.
4 |
5 | generate a valid HL7 FHIR R4 encounters for {{$input}}.
6 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GenerateFhirPatients/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": 1,
3 | "type": "completion",
4 | "description": "Generate HL7 FHIR data to represent a comic book character.",
5 | "completion": {
6 | "max_tokens": 1000,
7 | "temperature": 0.0,
8 | "top_p": 0.0,
9 | "presence_penalty": 0.0,
10 | "frequency_penalty": 0.0
11 | },
12 | "input": {
13 | "parameters": [
14 | {
15 | "name": "input",
16 | "description": "The name of the comic book character.",
17 | "defaultValue": ""
18 | }
19 | ]
20 | }
21 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GenerateFhirPatients/skprompt.txt:
--------------------------------------------------------------------------------
1 | generate a valid HL7 FHIR R4 Patient in JSON format.
2 | all required properties must be present: the resourcetype property should have value of "patient"
3 | include the character's secret identity as a human name, their weakness as an allergyintolerance entity, and their birth date as the date of their first appearance.
4 |
5 | generate a valid HL7 FHIR R4 patient for {{$input}}.
6 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GetPopularCharacters/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": 1,
3 | "type": "completion",
4 | "description": "Create a pipe-delimited list of the most popular comic book superheroes or supervillains.",
5 | "completion": {
6 | "max_tokens": 500,
7 | "temperature": 0.0,
8 | "top_p": 0.0,
9 | "presence_penalty": 0.0,
10 | "frequency_penalty": 0.0
11 | },
12 | "input": {
13 | "parameters": [
14 | {
15 | "name": "input",
16 | "description": "The number of characters to list.",
17 | "defaultValue": "10"
18 | }
19 | ]
20 | }
21 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Plugins/ComicBookPlugin/GetPopularCharacters/skprompt.txt:
--------------------------------------------------------------------------------
1 | create a pipe-delimited list of the most popular comic book superheroes or supervillains
2 |
3 | Example:
4 | User: 10
5 | Bot: Superman|Batman|Spider-Man|Wonder Woman|Iron Man|Captain America|The Hulk|Thor|The Joker|Wolverine
6 |
7 | User: {{$input}}
8 | Bot:
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Program.cs:
--------------------------------------------------------------------------------
1 | using CC.API;
2 | using Hl7.Fhir.Model;
3 |
4 | var builder = WebApplication.CreateBuilder(args);
5 |
6 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
7 | builder.Services.AddEndpointsApiExplorer();
8 | builder.Services.AddSwaggerGen();
9 |
10 | string apiKey = builder.Configuration["OpenAI:ApiKey"] ??
11 | throw new ApplicationException("No OpenAI API key found in configuration.");
12 |
13 | var app = builder.Build();
14 |
15 | if (app.Environment.IsDevelopment())
16 | {
17 | app.UseSwagger();
18 | app.UseSwaggerUI();
19 | }
20 |
21 | app.UseHttpsRedirection();
22 |
23 | //app.UseAuthorization();
24 |
25 | RouteGroupBuilder patientApis = app.MapGroup("/patients");
26 | patientApis.MapGet("/", GetAllPatients);
27 | patientApis.MapGet("/{id}", GetPatientById);
28 | patientApis.MapPost("/generate/patients", GeneratePatients);
29 | patientApis.MapPost("/generate/encounters", GenerateEncounters);
30 |
31 | app.Run();
32 |
33 | async Task GeneratePatients()
34 | {
35 | AiHelper aiHelper = new(apiKey);
36 | List characters = await aiHelper.GeneratePatients();
37 |
38 | foreach (string character in characters)
39 | {
40 | await aiHelper.GenerateFhirOfPatient(character);
41 | }
42 |
43 | return TypedResults.Ok();
44 | }
45 |
46 | async Task GenerateEncounters()
47 | {
48 | AiHelper aiHelper = new(apiKey);
49 | List characters = await aiHelper.GeneratePatients();
50 |
51 | foreach (string character in characters)
52 | {
53 | await aiHelper.GenerateFhirEncounters(character);
54 | }
55 |
56 | return TypedResults.Ok();
57 | }
58 |
59 | static async Task GetAllPatients()
60 | {
61 | List patients = new();
62 |
63 | string patientDataPath = Path.Combine(Directory.GetCurrentDirectory(), "Data", "Patients");
64 | string[] files = Directory.GetFiles(patientDataPath);
65 | foreach (string file in files)
66 | {
67 | using StreamReader reader = new(file);
68 | string patient = await reader.ReadToEndAsync();
69 |
70 | if (patient is not null)
71 | patients.Add(patient);
72 | }
73 |
74 | return TypedResults.Ok(patients);
75 | }
76 |
77 | static IResult GetPatientById()
78 | {
79 | Patient patient = new();
80 |
81 | return TypedResults.Ok(patient);
82 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:38758",
8 | "sslPort": 44385
9 | }
10 | },
11 | "profiles": {
12 | "http": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "launchBrowser": true,
16 | "launchUrl": "swagger",
17 | "applicationUrl": "http://localhost:5029",
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "https": {
23 | "commandName": "Project",
24 | "dotnetRunMessages": true,
25 | "launchBrowser": true,
26 | "launchUrl": "swagger",
27 | "applicationUrl": "https://localhost:7120;http://localhost:5029",
28 | "environmentVariables": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | }
31 | },
32 | "IIS Express": {
33 | "commandName": "IISExpress",
34 | "launchBrowser": true,
35 | "launchUrl": "swagger",
36 | "environmentVariables": {
37 | "ASPNETCORE_ENVIRONMENT": "Development"
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.API/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | },
8 | "AllowedHosts": "*"
9 | }
10 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/AllergyIntoleranceDTO.cs:
--------------------------------------------------------------------------------
1 | namespace CC.Shared
2 | {
3 | public class AllergyIntoleranceDTO
4 | {
5 | public SubstanceDTO Substance { get; set; } = new();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/CC.Shared.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/CodeableConceptDTO.cs:
--------------------------------------------------------------------------------
1 | namespace CC.Shared
2 | {
3 | public class CodeableConceptDTO
4 | {
5 | public List Coding { get; set; } = new List();
6 |
7 | public string Text { get; set; } = string.Empty;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/CodingDTO.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace CC.Shared
4 | {
5 | public class CodingDTO
6 | {
7 | [JsonPropertyName("system")]
8 | public string System { get; set; } = string.Empty;
9 |
10 | [JsonPropertyName("version")]
11 | public string Version { get; set; } = string.Empty;
12 |
13 | [JsonPropertyName("code")]
14 | public string Code { get; set; } = string.Empty;
15 |
16 | [JsonPropertyName("display")]
17 | public string Display { get; set; } = string.Empty;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/EncounterDTO.cs:
--------------------------------------------------------------------------------
1 | namespace CC.Shared
2 | {
3 | public class EncounterDTO
4 | {
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/HumanNameDTO.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace CC.Shared
4 | {
5 | public class HumanNameDTO
6 | {
7 | [JsonPropertyName("use")]
8 | public string Use { get; set; } = string.Empty;
9 |
10 | [JsonPropertyName("family")]
11 | public string Family { get; set; } = string.Empty;
12 |
13 | [JsonPropertyName("given")]
14 | public List Given { get; set; } = new();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/PatientDTO.cs:
--------------------------------------------------------------------------------
1 | using System.Text.Json.Serialization;
2 |
3 | namespace CC.Shared
4 | {
5 | public class PatientDTO
6 | {
7 | [JsonPropertyName("id")]
8 | public string Id { get; set; } = string.Empty;
9 |
10 | [JsonPropertyName("active")]
11 | public bool Active { get; set; }
12 |
13 | [JsonPropertyName("gender")]
14 | public string Gender { get; set; } = string.Empty;
15 |
16 | [JsonPropertyName("birthDate")]
17 | public string BirthDate { get; set; } = string.Empty;
18 |
19 | [JsonPropertyName("name")]
20 | public List Name { get; set; } = new();
21 |
22 | [JsonPropertyName("allergyTolerance")]
23 | public List AllergyIntolerance { get; set; } = new();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.Shared/SubstanceDTO.cs:
--------------------------------------------------------------------------------
1 | namespace CC.Shared
2 | {
3 | public class SubstanceDTO
4 | {
5 | public List Coding { get; set; } = new List();
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/App.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI
2 | {
3 | public partial class App : Application
4 | {
5 | public App()
6 | {
7 | InitializeComponent();
8 |
9 | MainPage = new AppShell();
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/AppShell.xaml:
--------------------------------------------------------------------------------
1 |
2 |
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 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
50 |
51 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/AppShell.xaml.cs:
--------------------------------------------------------------------------------
1 | using CC.UI.Controls;
2 | using CC.UI.Models;
3 | using CC.UI.Pages;
4 | using CC.UI.Services;
5 | using CC.UI.ViewModels;
6 | using Microsoft.SemanticKernel.Orchestration;
7 | using Microsoft.SemanticKernel.Planning;
8 | using System.ComponentModel.DataAnnotations;
9 |
10 | namespace CC.UI
11 | {
12 | public partial class AppShell : Shell
13 | {
14 | public AppShell()
15 | {
16 | InitializeComponent();
17 |
18 | Routing.RegisterRoute(nameof(MainPage), typeof(MainPage));
19 | Routing.RegisterRoute(nameof(EncounterPage), typeof(EncounterPage));
20 | Routing.RegisterRoute(nameof(PatientDetailPage), typeof(PatientDetailPage));
21 | Routing.RegisterRoute(nameof(SchedulingPage), typeof(SchedulingPage));
22 | }
23 |
24 | private async void CopilotChat_SubmitChat(object sender, NewChatEventArgs e)
25 | {
26 | Plan plan = await AiServices.CreateActionPlan(e.ChatItem);
27 |
28 | // based on plan, provide parameters to the action
29 | if (plan.Steps != null && plan.Steps.Count > 0)
30 | {
31 | SKContext context = AiServices._kernel.CreateNewContext();
32 | switch (plan.Steps[0].Name)
33 | {
34 | case "NavigateApplicationPages":
35 | // no additional parameters needed
36 | FunctionResult navigateResult = await plan.InvokeAsync(context);
37 | await Shell.Current.GoToAsync(navigateResult.GetValue());
38 | break;
39 | case "SummarizeEncounter":
40 | // no additional parameters needed
41 | FunctionResult summarizeResult = await plan.InvokeAsync(context);
42 | CopilotChatViewModel vm = copilotChat.BindingContext as CopilotChatViewModel;
43 | vm.ChatHistory.Add(new ChatItem() {
44 | Text = summarizeResult.GetValue(),
45 | Author = "Copilot", Timestamp = DateTime.Now
46 | });
47 | break;
48 | default:
49 | break;
50 | };
51 | }
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Controls/NewChatEventArgs.cs:
--------------------------------------------------------------------------------
1 | using CC.UI.Models;
2 |
3 | namespace CC.UI.Controls
4 | {
5 | public class NewChatEventArgs : EventArgs
6 | {
7 | public ChatItem ChatItem { get; set; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Controls/PatientList.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
13 |
14 |
15 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Controls/PatientList.xaml.cs:
--------------------------------------------------------------------------------
1 | using CC.Shared;
2 | using CC.UI.Pages;
3 | using CC.UI.Services;
4 | using System.Collections.ObjectModel;
5 |
6 | namespace CC.UI.Controls;
7 |
8 | public partial class PatientList : ContentView
9 | {
10 | public event EventHandler PatientSelected;
11 |
12 | public ObservableCollection Patients { get; } = new();
13 |
14 | public PatientList()
15 | {
16 | InitializeComponent();
17 |
18 | BindingContext = this;
19 | }
20 |
21 | private async void OnGetPatientsClicked(object sender, EventArgs e)
22 | {
23 | Patients.Clear();
24 |
25 | RestService service = new();
26 | List patients = await service.RetrievePatients();
27 | foreach (PatientDTO patient in patients)
28 | {
29 | Patients.Add(patient);
30 | }
31 | }
32 |
33 | private void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e)
34 | {
35 | PatientSelected?.Invoke(this, e);
36 | }
37 |
38 | private async void OnNewEncounterClicked(object sender, EventArgs e)
39 | {
40 | await Shell.Current.GoToAsync(nameof(EncounterPage));
41 | }
42 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI
2 | {
3 | public partial class MainPage : ContentPage
4 | {
5 | public static string Description { get; } = "This page allows user view a list of patients.";
6 |
7 | public MainPage()
8 | {
9 | InitializeComponent();
10 | }
11 |
12 | private void PatientList_PatientSelected(object sender, EventArgs e)
13 | {
14 | Shell.Current.GoToAsync("PatientDetailPage");
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/MauiProgram.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Maui;
2 | using Microsoft.Extensions.Logging;
3 |
4 | namespace CC.UI
5 | {
6 | public static class MauiProgram
7 | {
8 | public static MauiApp CreateMauiApp()
9 | {
10 | var builder = MauiApp.CreateBuilder();
11 | builder
12 | .UseMauiApp()
13 | // Initialize the .NET MAUI Community Toolkit by adding the below line of code
14 | .UseMauiCommunityToolkit()
15 | .UseMauiCommunityToolkitMediaElement()
16 | .ConfigureFonts(fonts =>
17 | {
18 | fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
19 | fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
20 | });
21 |
22 | #if DEBUG
23 | builder.Logging.AddDebug();
24 | #endif
25 |
26 | return builder.Build();
27 | }
28 | }
29 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Models/ChatItem.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI.Models;
2 |
3 | public class ChatAction
4 | {
5 | public ChatAction() { }
6 |
7 | public ChatAction(string description) { Description = description; }
8 |
9 | public string Description { get; set; } = string.Empty;
10 |
11 | public delegate void ActionDelegate();
12 | }
13 |
14 | public class ChatItem
15 | {
16 | public ChatItem() { }
17 | // cheating :)
18 | public ChatItem(string author, string description, params string[] actionDescriptions)
19 | {
20 | Author = author;
21 | Text = description;
22 | Timestamp = DateTime.Now;
23 | Actions.AddRange(actionDescriptions.Select(a => new ChatAction(a)));
24 |
25 | BackgroundColor = author switch
26 | {
27 | "Copilot" => "Red",//"#FFC0C0C0";
28 | "Patient" => "Yellow",//"#FFC0C0FF";
29 | "You" => "Blue",//"#FFC0FFC0";
30 | _ => "White",//"#FFFFFFFF";
31 | };
32 | HorizontalAlignment = author == "You" ? "Start" : "End";
33 | }
34 |
35 | public string Text { get; set; } = string.Empty;
36 |
37 | public string Author { get; set; } = string.Empty;
38 |
39 | public DateTime Timestamp { get; set; }
40 |
41 | public List Actions { get; } = new();
42 |
43 | public string BackgroundColor { get; set; }
44 |
45 | public string HorizontalAlignment { get; set; }
46 | }
47 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Pages/EncounterPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI.Pages;
2 |
3 | public partial class EncounterPage : ContentPage
4 | {
5 | public static string Description { get; } = "This page allows user to capture notes and other details about a specific clinical encounter with a patient.";
6 |
7 | public EncounterPage()
8 | {
9 | InitializeComponent();
10 | }
11 |
12 | private void OnSummarizeTranscriptClicked(object sender, EventArgs e)
13 | {
14 | //AiServices.SummarizeEncounter();
15 | }
16 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Pages/PatientDetailPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
12 |
13 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Pages/PatientDetailPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI.Pages;
2 |
3 | public partial class PatientDetailPage : ContentPage
4 | {
5 | public static string Description { get; } = "This page allows user to capture a patient's demographic details and latest vitals.";
6 |
7 | public PatientDetailPage()
8 | {
9 | InitializeComponent();
10 | }
11 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Pages/SchedulingPage.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Pages/SchedulingPage.xaml.cs:
--------------------------------------------------------------------------------
1 | namespace CC.UI.Pages;
2 |
3 | public partial class SchedulingPage : ContentPage
4 | {
5 | public static string Description { get; } = "This page allows the user to view and edit their schedule of appointments and meetings.";
6 |
7 | public SchedulingPage()
8 | {
9 | InitializeComponent();
10 | }
11 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Android/MainActivity.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Content.PM;
3 | using Android.OS;
4 |
5 | namespace CC.UI
6 | {
7 | [Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
8 | public class MainActivity : MauiAppCompatActivity
9 | {
10 | }
11 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Android/MainApplication.cs:
--------------------------------------------------------------------------------
1 | using Android.App;
2 | using Android.Runtime;
3 |
4 | namespace CC.UI
5 | {
6 | [Application]
7 | public class MainApplication : MauiApplication
8 | {
9 | public MainApplication(IntPtr handle, JniHandleOwnership ownership)
10 | : base(handle, ownership)
11 | {
12 | }
13 |
14 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
15 | }
16 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Android/Resources/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #512BD4
4 | #2B0B98
5 | #2B0B98
6 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/MacCatalyst/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 |
3 | namespace CC.UI
4 | {
5 | [Register("AppDelegate")]
6 | public class AppDelegate : MauiUIApplicationDelegate
7 | {
8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9 | }
10 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/MacCatalyst/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | UIDeviceFamily
6 |
7 | 1
8 | 2
9 |
10 | UIRequiredDeviceCapabilities
11 |
12 | arm64
13 |
14 | UISupportedInterfaceOrientations
15 |
16 | UIInterfaceOrientationPortrait
17 | UIInterfaceOrientationLandscapeLeft
18 | UIInterfaceOrientationLandscapeRight
19 |
20 | UISupportedInterfaceOrientations~ipad
21 |
22 | UIInterfaceOrientationPortrait
23 | UIInterfaceOrientationPortraitUpsideDown
24 | UIInterfaceOrientationLandscapeLeft
25 | UIInterfaceOrientationLandscapeRight
26 |
27 | XSAppIconAssets
28 | Assets.xcassets/appicon.appiconset
29 |
30 |
31 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/MacCatalyst/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace CC.UI
5 | {
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Tizen/Main.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Maui;
2 | using Microsoft.Maui.Hosting;
3 | using System;
4 |
5 | namespace CC.UI
6 | {
7 | internal class Program : MauiApplication
8 | {
9 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
10 |
11 | static void Main(string[] args)
12 | {
13 | var app = new Program();
14 | app.Run(args);
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Tizen/tizen-manifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | maui-application-title-placeholder
6 | maui-appicon-placeholder
7 |
8 |
9 |
10 |
11 | http://tizen.org/privilege/internet
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Windows/App.xaml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Windows/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.UI.Xaml;
2 |
3 | // To learn more about WinUI, the WinUI project structure,
4 | // and more about our project templates, see: http://aka.ms/winui-project-info.
5 |
6 | namespace CC.UI.WinUI
7 | {
8 | ///
9 | /// Provides application-specific behavior to supplement the default Application class.
10 | ///
11 | public partial class App : MauiWinUIApplication
12 | {
13 | ///
14 | /// Initializes the singleton application object. This is the first line of authored code
15 | /// executed, and as such is the logical equivalent of main() or WinMain().
16 | ///
17 | public App()
18 | {
19 | this.InitializeComponent();
20 | }
21 |
22 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
23 | }
24 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Windows/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | $placeholder$
15 | User Name
16 | $placeholder$.png
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/Windows/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 | true/PM
12 | PerMonitorV2, PerMonitor
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/iOS/AppDelegate.cs:
--------------------------------------------------------------------------------
1 | using Foundation;
2 |
3 | namespace CC.UI
4 | {
5 | [Register("AppDelegate")]
6 | public class AppDelegate : MauiUIApplicationDelegate
7 | {
8 | protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
9 | }
10 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | LSRequiresIPhoneOS
6 |
7 | UIDeviceFamily
8 |
9 | 1
10 | 2
11 |
12 | UIRequiredDeviceCapabilities
13 |
14 | arm64
15 |
16 | UISupportedInterfaceOrientations
17 |
18 | UIInterfaceOrientationPortrait
19 | UIInterfaceOrientationLandscapeLeft
20 | UIInterfaceOrientationLandscapeRight
21 |
22 | UISupportedInterfaceOrientations~ipad
23 |
24 | UIInterfaceOrientationPortrait
25 | UIInterfaceOrientationPortraitUpsideDown
26 | UIInterfaceOrientationLandscapeLeft
27 | UIInterfaceOrientationLandscapeRight
28 |
29 | XSAppIconAssets
30 | Assets.xcassets/appicon.appiconset
31 |
32 |
33 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Platforms/iOS/Program.cs:
--------------------------------------------------------------------------------
1 | using ObjCRuntime;
2 | using UIKit;
3 |
4 | namespace CC.UI
5 | {
6 | public class Program
7 | {
8 | // This is the main entry point of the application.
9 | static void Main(string[] args)
10 | {
11 | // if you want to use a different Application Delegate class from "AppDelegate"
12 | // you can specify it here.
13 | UIApplication.Main(args, null, typeof(AppDelegate));
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Plugins/ApplicationHelpPlugin/ApplicationHelpPlugin.cs:
--------------------------------------------------------------------------------
1 | using CC.UI.Pages;
2 | using Microsoft.SemanticKernel;
3 | using Microsoft.SemanticKernel.Orchestration;
4 | using Microsoft.SemanticKernel.TemplateEngine;
5 | using System.ComponentModel;
6 | using static Microsoft.SemanticKernel.TemplateEngine.PromptTemplateConfig;
7 |
8 | namespace CC.UI.Plugins.ApplicationHelpPlugin
9 | {
10 | public class ApplicationHelpPlugin
11 | {
12 | private readonly IKernel _kernel;
13 |
14 | public ApplicationHelpPlugin(IKernel kernel)
15 | {
16 | _kernel = kernel;
17 | }
18 |
19 | [SKFunction, Description("Gets the likeliest name of the page the user is looking for.")]
20 | public async Task NavigateApplicationPages(string input)
21 | {
22 | List pageNames = new()
23 | {
24 | $"{nameof(MainPage)}: {MainPage.Description}",
25 | $"{nameof(EncounterPage)}: {EncounterPage.Description}",
26 | $"{nameof(PatientDetailPage)}: {PatientDetailPage.Description}",
27 | $"{nameof(SchedulingPage)}: {SchedulingPage.Description}"
28 | };
29 | string pageList = string.Join("; ", pageNames);
30 |
31 | string prompt = $"""
32 | User: {input}
33 | Based on the input above, which of these pages is the user most likely looking for: {pageList}?
34 | Return only one page name
35 | """;
36 |
37 | if (!_kernel.Functions.TryGetFunction("WhichPage", out ISKFunction whichPageFunction))
38 | {
39 | var promptConfig = new PromptTemplateConfig
40 | {
41 | Description = "returns the most likely page the user is looking for",
42 | Input =
43 | {
44 | Parameters = new List
45 | {
46 | new InputParameter
47 | {
48 | Name = "input",
49 | Description = "The user's request.",
50 | DefaultValue = ""
51 | }
52 | }
53 | }
54 | };
55 |
56 | var promptTemplate = new PromptTemplate(
57 | prompt,
58 | promptConfig,
59 | _kernel
60 | );
61 | PromptTemplateConfig functionConfig = new();
62 | whichPageFunction = _kernel.RegisterSemanticFunction("WhichPage", functionConfig, promptTemplate);
63 | }
64 |
65 | KernelResult result = await _kernel.RunAsync(prompt, whichPageFunction);
66 |
67 | if (result is null)
68 | throw new ApplicationException("No value returned from kernel.");
69 |
70 | return result.GetValue();
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Plugins/MedicalKnowledgePlugin/MedicalKnowledgePlugin.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.SemanticKernel;
2 | using Microsoft.SemanticKernel.Orchestration;
3 | using Microsoft.SemanticKernel.TemplateEngine;
4 | using System.ComponentModel;
5 | using static Microsoft.SemanticKernel.TemplateEngine.PromptTemplateConfig;
6 |
7 | namespace CC.UI.Plugins.MedicalKnowledgePlugin
8 | {
9 | public class MedicalKnowledgePlugin
10 | {
11 | private readonly IKernel _kernel;
12 |
13 | public MedicalKnowledgePlugin(IKernel kernel)
14 | {
15 | _kernel = kernel;
16 | }
17 |
18 | [SKFunction, Description("Summarize a clinical encounter and capture specific actions.")]
19 | public async Task SummarizeEncounter(string transcription)
20 | {
21 | string prompt = $"""
22 | User: {transcription}
23 | Summarize the above medical encounter in less than 200 words.
24 | At the end, include a bulleted list of tasks that need to be completed and who is owning each task.
25 | """;
26 |
27 | if (!_kernel.Functions.TryGetFunction("WhichPage", out ISKFunction summarizeEncounterFunction))
28 | {
29 | var promptConfig = new PromptTemplateConfig
30 | {
31 | Description = "summarizes a clinical encounter with a patient",
32 | Input =
33 | {
34 | Parameters = new List
35 | {
36 | new InputParameter
37 | {
38 | Name = "input",
39 | Description = "The user's request.",
40 | DefaultValue = ""
41 | }
42 | }
43 | }
44 | };
45 |
46 | var promptTemplate = new PromptTemplate(
47 | prompt,
48 | promptConfig,
49 | _kernel
50 | );
51 | PromptTemplateConfig functionConfig = new();
52 | summarizeEncounterFunction = _kernel.RegisterSemanticFunction("SummarizeEncounter", functionConfig, promptTemplate);
53 | }
54 |
55 | KernelResult result = await _kernel.RunAsync(prompt, summarizeEncounterFunction);
56 |
57 | if (result is null)
58 | throw new ApplicationException("No value returned from kernel.");
59 |
60 | return result.GetValue();
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Plugins/MedicalKnowledgePlugin/SummarizeEncounter/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "schema": 1,
3 | "type": "completion",
4 | "description": "Summarize a clinical encounter based on transcription and other captured data.",
5 | "completion": {
6 | "max_tokens": 1000,
7 | "temperature": 0.0,
8 | "top_p": 0.0,
9 | "presence_penalty": 0.0,
10 | "frequency_penalty": 0.0
11 | },
12 | "input": {
13 | "parameters": [
14 | {
15 | "name": "transcription",
16 | "description": "Transcription of conversation between participants in an encounter.",
17 | "defaultValue": ""
18 | }
19 | ]
20 | }
21 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Plugins/MedicalKnowledgePlugin/SummarizeEncounter/skprompt.txt:
--------------------------------------------------------------------------------
1 | summarize the main points of a clinical encounter in less than 200 words.
2 |
3 | be sure to capture a bullet point list of any actions and their owners.
4 |
5 | use the transcription of the encounter: {{$transcription}}
6 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Plugins/MedicalKnowledgePlugin/SummarizeEncounterFunction.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.SemanticKernel.TemplateEngine;
2 |
3 | namespace CC.UI.Plugins.MedicalKnowledgePlugin
4 | {
5 | internal static class SummarizeEncounterFunction
6 | {
7 | public static string Prompt { get; } = """
8 | User: {{$transcription}}
9 | Summarize the above medical encounter in less than 200 words.
10 | At the end, include a bulleted list of tasks that need to be completed and who is owning each task.
11 | """;
12 |
13 | public static string PluginName { get; } = "MedicalKnowledgePlugin";
14 |
15 | public static string Functionname { get; } = "SummarizeEncounter";
16 |
17 | public static PromptTemplateConfig PromptTemplateConfig { get; }
18 |
19 | public static PromptTemplate PromptTemplate { get; }
20 |
21 | static SummarizeEncounterFunction()
22 | {
23 | PromptTemplateConfig = new()
24 | {
25 | Description = "Summarize a medical encounter from a transcription and capture any assigned tasks."
26 | };
27 |
28 | // TODO: I don't understand how to use this :(
29 | //PromptTemplate = new(Prompt, PromptTemplateConfig, );
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Windows Machine": {
4 | "commandName": "MsixPackage",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/AppIcon/appicon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/AppIcon/appiconfg.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/Fonts/OpenSans-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/globalopenaihack/f23316e4b90cec9e19ae50c6ca7bea6ed8731ac9/quickstarts/CustomCopilot/CC.UI/Resources/Fonts/OpenSans-Regular.ttf
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/Fonts/OpenSans-Semibold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/globalopenaihack/f23316e4b90cec9e19ae50c6ca7bea6ed8731ac9/quickstarts/CustomCopilot/CC.UI/Resources/Fonts/OpenSans-Semibold.ttf
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/Raw/AboutAssets.txt:
--------------------------------------------------------------------------------
1 | Any raw assets you want to be deployed with your application can be placed in
2 | this directory (and child directories). Deployment of the asset to your application
3 | is automatically handled by the following `MauiAsset` Build Action within your `.csproj`.
4 |
5 |
6 |
7 | These files will be deployed with you package and will be accessible using Essentials:
8 |
9 | async Task LoadMauiAsset()
10 | {
11 | using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt");
12 | using var reader = new StreamReader(stream);
13 |
14 | var contents = reader.ReadToEnd();
15 | }
16 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/Splash/splash.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Resources/Styles/Colors.xaml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 | #512BD4
8 | #DFD8F7
9 | #2B0B98
10 | White
11 | Black
12 | #E1E1E1
13 | #C8C8C8
14 | #ACACAC
15 | #919191
16 | #6E6E6E
17 | #404040
18 | #212121
19 | #141414
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 | #F7B548
35 | #FFD590
36 | #FFE5B9
37 | #28C2D1
38 | #7BDDEF
39 | #C3F2F4
40 | #3E8EED
41 | #72ACF1
42 | #A7CBF6
43 |
44 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Services/AiServices.cs:
--------------------------------------------------------------------------------
1 | using CC.UI.Models;
2 | using CC.UI.Plugins.ApplicationHelpPlugin;
3 | using CC.UI.Plugins.MedicalKnowledgePlugin;
4 | using Microsoft.SemanticKernel;
5 | using Microsoft.SemanticKernel.Orchestration;
6 | using Microsoft.SemanticKernel.Planners;
7 | using Microsoft.SemanticKernel.Planning;
8 |
9 | namespace CC.UI.Services
10 | {
11 | internal static class AiServices
12 | {
13 | private static readonly string _languageEndpoint = "https://ai-cc.openai.azure.com/";
14 |
15 | private static readonly string _imageEndpoint = "https://ai-cc.openai.azure.com/";
16 |
17 | private static readonly string _speechEndpoint = "https://ai-cc.openai.azure.com/";
18 |
19 | private static readonly string _model = "gpt-4";
20 |
21 | internal static readonly IKernel _kernel;
22 |
23 | static AiServices()
24 | {
25 | string apiKey = "88eb9b24ebb8415faf674b699b3a490f";
26 | _kernel = Kernel.Builder
27 | .WithAzureChatCompletionService(_model, _languageEndpoint, apiKey)
28 | .Build();
29 |
30 | _kernel.ImportFunctions(new ApplicationHelpPlugin(_kernel), "ApplicationHelpPlugin");
31 | _kernel.ImportFunctions(new MedicalKnowledgePlugin(_kernel), "MedicalKnowledgePlugin");
32 | }
33 |
34 | internal static async Task CreateActionPlan(ChatItem chatItem)
35 | {
36 | ActionPlanner planner = new(_kernel);
37 | Plan plan = await planner.CreatePlanAsync(chatItem.Text);
38 |
39 | return plan;
40 | }
41 |
42 | internal static async Task ExecutePlan(Plan plan)
43 | {
44 | FunctionResult result = await plan.InvokeAsync(_kernel);
45 | string resultString = result.GetValue();
46 |
47 | if (resultString is null)
48 | throw new ApplicationException("No value returned from kernel.");
49 |
50 | return resultString;
51 | }
52 |
53 | internal static async Task SummarizeEncounter(string transcription)
54 | {
55 | ISKFunction summarize = _kernel.Functions.GetFunction("MedicalKnowledgePlugin", "SummarizeEncounter");
56 | KernelResult result1 = await _kernel.RunAsync(transcription, summarize);
57 | string result1String = result1.GetValue();
58 |
59 | if (result1String is null)
60 | throw new ApplicationException("No value returned from kernel.");
61 |
62 | return result1String;
63 | }
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/Services/RestService.cs:
--------------------------------------------------------------------------------
1 | using CC.Shared;
2 | using Hl7.Fhir.Serialization;
3 | using System.Diagnostics;
4 | using System.Text.Json;
5 |
6 | namespace CC.UI.Services
7 | {
8 | internal class RestService
9 | {
10 | private HttpClient _httpClient = new();
11 |
12 | private JsonSerializerOptions _serializerOptions;
13 |
14 | internal RestService()
15 | {
16 | _serializerOptions = new JsonSerializerOptions
17 | {
18 | PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
19 | PropertyNameCaseInsensitive = true,
20 | WriteIndented = true
21 | };
22 | }
23 |
24 | internal async Task> RetrievePatients()
25 | {
26 | List patients = new();
27 | Uri uri = new("https://localhost:7120/patients");
28 | HttpResponseMessage response = await _httpClient.GetAsync(uri);
29 | if (response.IsSuccessStatusCode)
30 | {
31 | string content = await response.Content.ReadAsStringAsync();
32 | List strings = JsonSerializer.Deserialize>(content);
33 |
34 | foreach (string item in strings)
35 | {
36 | //var options = new JsonSerializerOptions().ForFhir(ModelInfo.ModelInspector);
37 | try
38 | {
39 | //PatientDTO deserializedPatient = JsonSerializer.Deserialize(item, options);
40 | PatientDTO deserializedPatient = JsonSerializer.Deserialize(item);
41 |
42 | if (deserializedPatient != null)
43 | {
44 | patients.Add(deserializedPatient);
45 | }
46 | }
47 | catch (DeserializationFailedException e)
48 | {
49 | Debug.WriteLine(e.Message);
50 | }
51 | }
52 | }
53 | return patients;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/ViewModels/AppViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Runtime.CompilerServices;
3 | using System.Windows.Input;
4 |
5 | namespace CC.UI.ViewModels
6 | {
7 | public class AppViewModel : INotifyPropertyChanged
8 | {
9 |
10 | public event PropertyChangedEventHandler PropertyChanged;
11 |
12 | private void OnPropertyChanged([CallerMemberName] string name = "") =>
13 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
14 |
15 | public ICommand SetLocationCommand { private set; get; }
16 |
17 | public ICommand GoToPatientListCommand { private set; get; }
18 |
19 | public string CurrentLocation { get; set; } = "Baxter Building";
20 |
21 | public AppViewModel()
22 | {
23 | SetLocationCommand = new Command(
24 | execute: (string arg) =>
25 | {
26 | CurrentLocation = arg;
27 | },
28 | canExecute: (string arg) =>
29 | {
30 | return true;
31 | });
32 |
33 | GoToPatientListCommand = new Command(
34 | execute: (string arg) =>
35 | {
36 | Shell.Current.GoToAsync(nameof(MainPage));
37 | },
38 | canExecute: (string arg) =>
39 | {
40 | return true;
41 | });
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/ViewModels/BaseViewModel.cs:
--------------------------------------------------------------------------------
1 | using CommunityToolkit.Mvvm.ComponentModel;
2 |
3 | namespace CC.UI.ViewModels
4 | {
5 | public abstract partial class BaseViewModel : ObservableObject
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.UI/ViewModels/MainViewModel.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.ObjectModel;
2 | using System.ComponentModel;
3 | using System.Runtime.CompilerServices;
4 | using System.Windows.Input;
5 | using Firely = Hl7.Fhir.Model;
6 |
7 | namespace CC.UI.ViewModels
8 | {
9 | public class MainViewModel : INotifyPropertyChanged
10 | {
11 |
12 | public event PropertyChangedEventHandler PropertyChanged;
13 |
14 | private void OnPropertyChanged([CallerMemberName] string name = "") =>
15 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
16 |
17 | public ICommand SetLocationCommand { private set; get; }
18 |
19 | public string CurrentLocation { get; set; } = "Baxter Building";
20 |
21 | public ObservableCollection Patients { get; } = new();
22 |
23 | public MainViewModel()
24 | {
25 | SetLocationCommand = new Command(
26 | execute: (string arg) =>
27 | {
28 | CurrentLocation = arg;
29 | },
30 | canExecute: (string arg) =>
31 | {
32 | return true;
33 | });
34 | }
35 | }
36 | }
37 |
38 | //class ClockViewModel : INotifyPropertyChanged
39 | //{
40 | // public event PropertyChangedEventHandler PropertyChanged;
41 |
42 | // private DateTime _dateTime;
43 | // private Timer _timer;
44 |
45 | // public DateTime DateTime
46 | // {
47 | // get => _dateTime;
48 | // set
49 | // {
50 | // if (_dateTime != value)
51 | // {
52 | // _dateTime = value;
53 | // OnPropertyChanged(); // reports this property
54 | // }
55 | // }
56 | // }
57 |
58 | // public ClockViewModel()
59 | // {
60 | // this.DateTime = DateTime.Now;
61 |
62 | // // Update the DateTime property every second.
63 | // _timer = new Timer(new TimerCallback((s) => this.DateTime = DateTime.Now),
64 | // null, TimeSpan.Zero, TimeSpan.FromSeconds(1));
65 | // }
66 |
67 | // ~ClockViewModel() =>
68 | // _timer.Dispose();
69 |
70 | // public void OnPropertyChanged([CallerMemberName] string name = "") =>
71 | // PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
72 | //}
--------------------------------------------------------------------------------
/quickstarts/CustomCopilot/CC.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.7.34202.233
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.API", "CC.API\CC.API.csproj", "{25072B00-3714-4327-AD37-EE50F490BC51}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CC.Shared", "CC.Shared\CC.Shared.csproj", "{68EEA25D-0CF0-48AB-95DA-08EB917439C8}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CC.UI", "CC.UI\CC.UI.csproj", "{87CF61D0-EEBB-4C40-A780-B081182C287F}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {25072B00-3714-4327-AD37-EE50F490BC51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19 | {25072B00-3714-4327-AD37-EE50F490BC51}.Debug|Any CPU.Build.0 = Debug|Any CPU
20 | {25072B00-3714-4327-AD37-EE50F490BC51}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {25072B00-3714-4327-AD37-EE50F490BC51}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {68EEA25D-0CF0-48AB-95DA-08EB917439C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23 | {68EEA25D-0CF0-48AB-95DA-08EB917439C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
24 | {68EEA25D-0CF0-48AB-95DA-08EB917439C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
25 | {68EEA25D-0CF0-48AB-95DA-08EB917439C8}.Release|Any CPU.Build.0 = Release|Any CPU
26 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Debug|Any CPU.Build.0 = Debug|Any CPU
28 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
29 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Release|Any CPU.Build.0 = Release|Any CPU
31 | {87CF61D0-EEBB-4C40-A780-B081182C287F}.Release|Any CPU.Deploy.0 = Release|Any CPU
32 | EndGlobalSection
33 | GlobalSection(SolutionProperties) = preSolution
34 | HideSolutionNode = FALSE
35 | EndGlobalSection
36 | GlobalSection(ExtensibilityGlobals) = postSolution
37 | SolutionGuid = {087E1912-8D5A-4C8B-90A1-2804A82FC700}
38 | EndGlobalSection
39 | EndGlobal
40 |
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/AzureOpenAICSharp/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net7.0/AzureOpenAICSharp.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/AzureOpenAICSharp/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/AzureOpenAICSharp.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/AzureOpenAICSharp.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/AzureOpenAICSharp.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/AzureOpenAICSharp/AzureOpenAICSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/AzureOpenAICSharp/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Net.Http;
2 | using System.Text;
3 | using System.Text.Json;
4 |
5 | using Azure;
6 | using Azure.AI.OpenAI;
7 |
8 | string endpoint = "https://your.azure.openai.endpoint/";
9 | string key = "api-key-found-in-azure-openai";
10 | string deploymentName = "AzureOpenAI Studio deployment model name";
11 |
12 | OpenAIClient client = new(new Uri(endpoint), new AzureKeyCredential(key));
13 |
14 | //Sample text to be used for intent detection
15 | string dress = @"Dear Contoso,
16 | I recently purchased a dress from your store and was disappointed to find that it was much shorter than expected. The dress I received was not the same length as the one pictured on your website.
17 | I am writing to request an exchange for a dress of the correct length. I understand that the product I received was not what I expected, and I would like to receive a dress that is the same length as the one pictured on your website.
18 | I look forward to hearing from you soon.
19 | Sincerely,
20 | Liea Organa";
21 |
22 |
23 | string book = @"
24 | Dear Contoso,
25 | I am writing to request a refund for the books I purchased from your store last week. Unfortunately, the books did not meet my expectations, and I would like to return them for a full refund.
26 | I have attached a copy of the purchase receipt to this email as proof of purchase. The books are in their original packaging and have not been used, so I hope that the refund process will be straightforward.
27 | Please let me know what steps I need to take to return the books and receive a refund. I look forward to hearing back from you soon.
28 | Thank you for your attention to this matter.
29 | Sincerely,
30 | Jabba D Hutt";
31 |
32 |
33 | var completionsOptions = new CompletionsOptions()
34 | {
35 | Prompts = { $@"This is an agent used to detect intent and provide a Department value for the following categories: “Books”, “Home”, “Fashion”, “Electronics”, “Grocery”, “Others”
36 | ---
37 | Sample Output will be in one line separated by !!
38 | Department: Electronics!!Order Intent: Defect
39 |
40 | Department: Grocery!!Order Intent: Rotten food
41 | ---
42 | Text: {book}
43 | " },
44 | Temperature = (float)0,
45 | MaxTokens = 100,
46 | NucleusSamplingFactor = (float)1,
47 | FrequencyPenalty = (float)0,
48 | PresencePenalty = (float)0,
49 | GenerationSampleCount = 1,
50 | };
51 |
52 |
53 | Response completionsResponse = await client.GetCompletionsAsync(deploymentName, completionsOptions);
54 |
55 | string completion = completionsResponse.Value.Choices[0].Text.Trim();
56 |
57 | //split completion into department and orderIntent
58 | string[] completionParts = completion.Split(new string[] { "!!" }, StringSplitOptions.None);
59 | string department = "";
60 | string orderIntent = "";
61 | foreach (string part in completionParts)
62 | {
63 | if(part.Contains("Department:"))
64 | {
65 | department = part.Replace("Department:", "").Trim();
66 | }else if(part.Contains("Order Intent:"))
67 | {
68 | orderIntent = part.Replace("Order Intent:", "").Trim();
69 | }
70 | }
71 | //Now parsed into department and orderIntent, actions like sending an email, calling a function or raising an event can occurr.
72 | Console.WriteLine(department);
73 | Console.WriteLine(orderIntent);
74 |
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/OpenAICSharp/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net7.0/OpenAICSharp.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/OpenAICSharp/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/OpenAICSharp.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/OpenAICSharp.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/OpenAICSharp.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/OpenAICSharp/OpenAICSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/IntentDetection/OpenAICSharp/Program.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Text;
3 | using Newtonsoft.Json;
4 |
5 | string apiUrl = "https://api.openai.com/v1/completions";
6 | string apiKey = "Your-OpenAI-API-Key";
7 |
8 | var client = new HttpClient();
9 | var request = new HttpRequestMessage(HttpMethod.Post, apiUrl);
10 | request.Headers.Add("Authorization", $"Bearer {apiKey}");
11 |
12 | string dress = @"Dear Contoso,
13 | I recently purchased a dress from your store and was disappointed to find that it was much shorter than expected. The dress I received was not the same length as the one pictured on your website.
14 | I am writing to request an exchange for a dress of the correct length. I understand that the product I received was not what I expected, and I would like to receive a dress that is the same length as the one pictured on your website.
15 | I look forward to hearing from you soon.
16 | Sincerely,
17 | Liea Organa";
18 |
19 | string book = @"
20 | Dear Contoso,
21 | I am writing to request a refund for the books I purchased from your store last week. Unfortunately, the books did not meet my expectations, and I would like to return them for a full refund.
22 | I have attached a copy of the purchase receipt to this email as proof of purchase. The books are in their original packaging and have not been used, so I hope that the refund process will be straightforward.
23 | Please let me know what steps I need to take to return the books and receive a refund. I look forward to hearing back from you soon.
24 | Thank you for your attention to this matter.
25 | Sincerely,
26 | Jabba D Hutt";
27 |
28 |
29 | string text = $@"This is an agent used to detect intent and provide a Department value for the following categories: “Books”, “Home”, “Fashion”, “Electronics”, “Grocery”, “Others”
30 | ---
31 | Sample Output will be in one line separated by !!
32 | Department: Electronics!!Order Intent: Defect
33 |
34 | Department: Grocery!!Order Intent: Rotten food
35 | ---
36 | Text: {book}";
37 |
38 |
39 | var body = new {
40 | model = "text-davinci-003", // Specify the OpenAI model you wish to use
41 | prompt = text,
42 | temperature = 0,
43 | max_tokens = 100,
44 | top_p = 1,
45 | frequency_penalty = 0,
46 | presence_penalty = 0
47 | };
48 | var objAsJson = JsonConvert.SerializeObject(body);
49 | request.Content = new StringContent(objAsJson, Encoding.UTF8, "application/json");
50 |
51 | var response = await client.SendAsync(request);
52 |
53 | string jsonResponse = await response.Content.ReadAsStringAsync();
54 | dynamic? result = JsonConvert.DeserializeObject(jsonResponse);
55 | string completion = result!.choices[0].text.Trim();
56 |
57 | //split completion into department and orderIntent
58 | string[] completionParts = completion.Split(new string[] { "!!" }, StringSplitOptions.None);
59 | string department = "";
60 | string orderIntent = "";
61 | foreach (string part in completionParts)
62 | {
63 |
64 | if(part.Contains("Department:"))
65 | {
66 | department = part.Replace("Department:", "").Trim();
67 | }else if(part.Contains("Order Intent:"))
68 | {
69 | orderIntent = part.Replace("Order Intent:", "").Trim();
70 | }
71 | }
72 | //Now parsed into department and orderIntent, you can use these to route the request to the appropriate department
73 | Console.WriteLine(department);
74 | Console.WriteLine(orderIntent);
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/AzureOpenAICSharp/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net7.0/newapp.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/AzureOpenAICSharp/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/newapp.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/newapp.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/newapp.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/AzureOpenAICSharp/AzureOpenAICSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/AzureOpenAICSharp/Program.cs:
--------------------------------------------------------------------------------
1 |
2 | using Azure;
3 | using Azure.AI.OpenAI;
4 | string endpoint = "https://your.azure.openai.endpoint/";
5 | string key = "api-key-found-in-azure-openai";
6 | string deploymentName = "AzureOpenAI Studio deployment model name";
7 |
8 | OpenAIClient client = new(new Uri(endpoint), new AzureKeyCredential(key));
9 |
10 | var completionsOptions = new CompletionsOptions()
11 | { Prompts = { @$"Classify the sentiment in this text.
12 | ----
13 | Text
14 | I don't like Pizza.
15 | ----
16 | Is the text Positive, Neutral or Negative?"},
17 | };
18 |
19 |
20 |
21 | Response completionsResponse = client.GetCompletions(deploymentName, completionsOptions);
22 |
23 | string completion = completionsResponse.Value.Choices[0].Text;
24 | Console.WriteLine(completion);
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/OpenAICSharp/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "0.2.0",
3 | "configurations": [
4 | {
5 | // Use IntelliSense to find out which attributes exist for C# debugging
6 | // Use hover for the description of the existing attributes
7 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/bin/Debug/net7.0/openAIExample.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}",
16 | // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
17 | "console": "internalConsole",
18 | "stopAtEntry": false
19 | },
20 | {
21 | "name": ".NET Core Attach",
22 | "type": "coreclr",
23 | "request": "attach"
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/OpenAICSharp/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/openAIExample.csproj",
11 | "/property:GenerateFullPaths=true",
12 | "/consoleloggerparameters:NoSummary"
13 | ],
14 | "problemMatcher": "$msCompile"
15 | },
16 | {
17 | "label": "publish",
18 | "command": "dotnet",
19 | "type": "process",
20 | "args": [
21 | "publish",
22 | "${workspaceFolder}/openAIExample.csproj",
23 | "/property:GenerateFullPaths=true",
24 | "/consoleloggerparameters:NoSummary"
25 | ],
26 | "problemMatcher": "$msCompile"
27 | },
28 | {
29 | "label": "watch",
30 | "command": "dotnet",
31 | "type": "process",
32 | "args": [
33 | "watch",
34 | "run",
35 | "--project",
36 | "${workspaceFolder}/openAIExample.csproj"
37 | ],
38 | "problemMatcher": "$msCompile"
39 | }
40 | ]
41 | }
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/OpenAICSharp/OpenAICSharp.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net7.0
6 | enable
7 | enable
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/quickstarts/SentimentAnalysis/OpenAICSharp/Program.cs:
--------------------------------------------------------------------------------
1 |
2 | using System.Text;
3 | using Newtonsoft.Json;
4 |
5 | string apiUrl = "https://api.openai.com/v1/completions";
6 | string apiKey = "Your-OpenAI-API-Key";
7 |
8 | var client = new HttpClient();
9 | var request = new HttpRequestMessage(HttpMethod.Post, apiUrl);
10 | request.Headers.Add("Authorization", $"Bearer {apiKey}");
11 |
12 | string statement = "I don't like Pizza.";
13 | var body = new {
14 | model = "text-curie-001", // Specify the OpenAI model you wish to use
15 | prompt = $"Classify the sentiment in this text: {statement}",
16 | temperature = 0,
17 | max_tokens = 60,
18 | top_p = 1,
19 | frequency_penalty = 0,
20 | presence_penalty = 0
21 | };
22 | var objAsJson = JsonConvert.SerializeObject(body);
23 | request.Content = new StringContent(objAsJson, Encoding.UTF8, "application/json");
24 |
25 | var response = await client.SendAsync(request);
26 |
27 | string jsonResponse = await response.Content.ReadAsStringAsync();
28 | dynamic? result = JsonConvert.DeserializeObject(jsonResponse);
29 | Console.WriteLine(result!.choices[0].text);
--------------------------------------------------------------------------------