-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
434 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using System.Net.Http.Json; | ||
using UdapEd.Shared.Model.CdsHooks; | ||
using UdapEd.Shared.Services; | ||
|
||
namespace UdapEd.Client.Services; | ||
|
||
public class CdsService : ICdsService | ||
{ | ||
private readonly HttpClient _httpClient; | ||
|
||
public CdsService(HttpClient httpClient) | ||
{ | ||
_httpClient = httpClient; | ||
} | ||
|
||
public Task<List<CdsServiceViewModel>?> FetchCdsServices() | ||
{ | ||
return _httpClient.GetFromJsonAsync<List<CdsServiceViewModel>> ("CdsServices/FetchCdsServices"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#region (c) 2024 Joseph Shook. All rights reserved. | ||
// /* | ||
// Authors: | ||
// Joseph Shook [email protected] | ||
// | ||
// See LICENSE in the project root for license information. | ||
// */ | ||
#endregion | ||
|
||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.AspNetCore.RateLimiting; | ||
using UdapEd.Server.Extensions; | ||
using UdapEd.Shared.Services; | ||
|
||
namespace UdapEd.Server.Controllers; | ||
|
||
[Route("[controller]")] | ||
[EnableRateLimiting(RateLimitExtensions.Policy)] | ||
public class CdsServicesController : Controller | ||
{ | ||
private readonly ICdsService _cdsService; | ||
|
||
public CdsServicesController(ICdsService cdsService) | ||
{ | ||
_cdsService = cdsService; | ||
} | ||
|
||
[HttpGet("FetchCdsServices")] | ||
public async Task<IActionResult> FetchCdsServices() | ||
{ | ||
var services = await _cdsService.FetchCdsServices(); | ||
return Ok(services); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@code { | ||
[Parameter] | ||
public EventCallback TakeSuggestion { get; set; } | ||
} | ||
|
||
<div class="card-list"> | ||
<!-- Add your card items here --> | ||
<button @onclick="TakeSuggestion">Take Suggestion</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
@using UdapEd.Shared.Model.CdsHooks | ||
|
||
<MudDialog Style="margin: 20px"> | ||
<DialogContent> | ||
<MudText Typo="Typo.h6" GutterBottom="true">Configure CDS Services</MudText> | ||
@if (Services != null) | ||
{ | ||
foreach (var service in Services) | ||
{ | ||
<ServiceDisplay CdsServiceModel="service" /> | ||
} | ||
} | ||
</DialogContent> | ||
<DialogActions> | ||
<MudButton Color="Color.Primary" OnClick="Submit">Close</MudButton> | ||
</DialogActions> | ||
</MudDialog> | ||
|
||
@code { | ||
[CascadingParameter] | ||
MudDialogInstance MudDialog { get; set; } = null!; | ||
|
||
[Inject] ICdsService CdaService { get; set; } = null!; | ||
|
||
[Parameter] | ||
public List<CdsServiceViewModel>? Services { get; set; } | ||
|
||
void Submit() => MudDialog.Close(); | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
Services = await CdaService.FetchCdsServices(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@using Microsoft.Fast.Components.FluentUI | ||
@code { | ||
[Parameter] | ||
public string Class { get; set; } = string.Empty; | ||
} | ||
|
||
<FluentCard class="@Class"> | ||
<div> | ||
<!-- Your ContextView content goes here --> | ||
<h1>CDS Developer Panel</h1> | ||
<!-- Add more content as needed --> | ||
</div> | ||
</FluentCard> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
@using Microsoft.Fast.Components.FluentUI | ||
|
||
@inject NavigationManager Navigation | ||
|
||
|
||
@code { | ||
|
||
[Parameter] | ||
public string Class { get; set; } = string.Empty; | ||
|
||
private string? _firstQueryParam; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
var uri = Navigation.ToAbsoluteUri(Navigation.Uri); | ||
var query = Microsoft.AspNetCore.WebUtilities.QueryHelpers.ParseQuery(uri.Query); | ||
_firstQueryParam = query.Keys.FirstOrDefault(); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
@code { | ||
|
||
} | ||
|
||
<FluentCard class="@Class"> | ||
@if (_firstQueryParam == "PatientView") | ||
{ | ||
<PatientView /> | ||
} | ||
else if (_firstQueryParam == "RxView") | ||
{ | ||
<PatientView /> | ||
} | ||
else if (_firstQueryParam == "RxSign") | ||
{ | ||
<PatientView /> | ||
} | ||
else if (_firstQueryParam == "PamaImaging") | ||
{ | ||
<PatientView /> | ||
} | ||
else | ||
{ | ||
<p>Component not found</p> | ||
} | ||
</FluentCard> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@using Hl7.Fhir.Model | ||
@inject IJSRuntime JSRuntime | ||
|
||
@code { | ||
[Parameter] | ||
public Patient Patient { get; set; } | ||
|
||
[Parameter] | ||
public bool IsContextVisible { get; set; } | ||
|
||
private string Name => Patient?.Name?.FirstOrDefault()?.Given.FirstOrDefault() ?? "Missing Name"; | ||
private string Dob => Patient?.BirthDate ?? "Missing DOB"; | ||
private string Pid => Patient?.Id ?? "Missing Patient ID"; | ||
|
||
private string IsHalfView => IsContextVisible ? "half-view" : string.Empty; | ||
} | ||
|
||
<div class="@(IsHalfView)"> | ||
<h1 class="view-title">Patient View</h1> | ||
<h2>@Name</h2> | ||
<div class="patient-data-text"> | ||
<p> | ||
<strong>ID: </strong> @Pid <strong>Birthdate: </strong> @Dob | ||
</p> | ||
</div> | ||
<CardList TakeSuggestion="() => {}" /> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@using UdapEd.Shared.Model.CdsHooks | ||
@inject IJSRuntime Js | ||
|
||
<MudGrid> | ||
<MudItem xs="6" Style="margin-top: auto;"> | ||
<MudText Typo="Typo.h6">@CdsServiceModel.Url</MudText> | ||
</MudItem> | ||
<MudItem xs="6" Class="d-flex flex-column align-items-end"> | ||
<MudCheckBox LabelPosition="LabelPosition.Start" @bind-Value="CdsServiceModel.CdsService.Enabled" Color="Color.Primary" Label="Enabled?" Class="ml-auto" /> | ||
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="RemoveService" Class="ml-auto mt-2"> | ||
Delete | ||
</MudButton> | ||
</MudItem> | ||
</MudGrid> | ||
<MudPaper Outlined="true" Square="true"><pre>@_serviceMetadata</pre></MudPaper> | ||
|
||
|
||
|
||
@code { | ||
string? _serviceMetadata; | ||
|
||
[Parameter] | ||
public CdsServiceViewModel CdsServiceModel { get; set; } | ||
|
||
[Parameter] | ||
public EventCallback<string> Toggle { get; set; } | ||
|
||
[Parameter] | ||
public EventCallback<string> Remove { get; set; } | ||
|
||
private ElementReference _definitionBody; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
var definitionCopy = JsonSerializer.Serialize(CdsServiceModel, new JsonSerializerOptions { WriteIndented = true }); | ||
_serviceMetadata = definitionCopy; | ||
base.OnInitialized(); | ||
} | ||
|
||
private async Task ToggleService() | ||
{ | ||
if (Toggle.HasDelegate) | ||
{ | ||
await Toggle.InvokeAsync(CdsServiceModel.Url); | ||
} | ||
} | ||
|
||
private async Task RemoveService() | ||
{ | ||
if (Remove.HasDelegate) | ||
{ | ||
await Remove.InvokeAsync(CdsServiceModel.Url); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#region (c) 2024 Joseph Shook. All rights reserved. | ||
// /* | ||
// Authors: | ||
// Joseph Shook [email protected] | ||
// | ||
// See LICENSE in the project root for license information. | ||
// */ | ||
#endregion | ||
|
||
namespace UdapEd.Shared.Model.CdsHooks; | ||
|
||
public class CdsServiceViewModel | ||
{ | ||
public string Url { get; set; } | ||
public CdsService CdsService {get; set; } | ||
} | ||
|
||
[Serializable] | ||
public class CdsService : Udap.CdsHooks.Model.CdsService | ||
{ | ||
public CdsService(){} | ||
|
||
public CdsService(Udap.CdsHooks.Model.CdsService baseService) | ||
{ | ||
foreach (var property in baseService.GetType().GetProperties()) | ||
{ | ||
var value = property.GetValue(baseService); | ||
this.GetType().GetProperty(property.Name)?.SetValue(this, value); | ||
} | ||
} | ||
|
||
public bool Enabled { get; set; } | ||
} |
Oops, something went wrong.