Add timeline to Provider Portal sample

This commit is contained in:
mattfras 2017-07-14 14:34:15 -07:00
Родитель 0056856dd3
Коммит aa5347a8d3
19 изменённых файлов: 669 добавлений и 23 удалений

Просмотреть файл

@ -90,6 +90,9 @@ label {
position: relative;
top: -2px;
}
.btn-inline {
margin-top: 35px;
}
.navbar-brand {
padding: 0px;
margin: 22px 40px 13px 15px;
@ -193,6 +196,7 @@ td.ms-row {
}
.ms-thumbnail img{
height: 50px;
width: 50px;
}
.goal-range-separator {
max-width: 6px;

Просмотреть файл

@ -47,7 +47,7 @@ namespace HealthVaultProviderManagementPortal.Controllers
public async Task<ActionResult> Index(Guid personId, Guid? recordId, double weight)
{
var item = new Weight(
new HealthServiceDateTime(DateTime.Now),
new HealthServiceDateTime(LocalDateTime.FromDateTime(DateTime.Now)),
new WeightValue(weight)
);

Просмотреть файл

@ -0,0 +1,159 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Mvc;
using System.Threading.Tasks;
using System.Web.Configuration;
using HealthVaultProviderManagementPortal.Models.Patient;
using Microsoft.HealthVault.Configuration;
using Microsoft.HealthVault.Web.Attributes;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Newtonsoft.Json;
using NodaTime;
using NodaTime.Serialization.JsonNet;
using static HealthVaultProviderManagementPortal.Helpers.RestClientFactory;
namespace HealthVaultProviderManagementPortal.Controllers
{
/// <summary>
/// Controller for creating and sending invitations to remote patients
/// </summary>
[RequireSignIn]
public class PatientController : Controller
{
/// <summary>
/// Gets a the timeline for a patient
/// </summary>
public async Task<ActionResult> Index(Guid personId, Guid recordId, DateTime? startDate, DateTime? endDate)
{
if (startDate == null)
{
return View();
}
var timeline = await GetTimeline(personId, recordId, startDate.Value, endDate);
var timelineEntries = new List<TimelineEntryViewModel>();
foreach (var task in timeline.Tasks)
{
timelineEntries.AddRange(ConvertToTimelineEntryViewModels(task));
}
var groupedTimelineEntries = timelineEntries.OrderBy(t => t.LocalDateTime).ThenByDescending(t => t.ScheduleType).GroupBy(st => st.LocalDateTime.Date);
var model = new TimelineViewModel
{
StartDate = startDate,
EndDate = endDate,
TimelineEntries = groupedTimelineEntries
};
return View(model);
}
private async Task<TimelineResponse> GetTimeline(Guid personId, Guid recordId, DateTime startDate, DateTime? endDate)
{
var restHealthVaultUrl = WebConfigurationManager.AppSettings.Get("HV_RestHealthServiceUrl"); //TODO: use built in SDK function to retreive this
// Construct URL
var uriBuilder = new UriBuilder(restHealthVaultUrl)
{
Path = "Timeline"
};
var queryParameters = new List<string>
{
$"startDate={startDate.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"
};
if (endDate != null)
{
queryParameters.Add($"endDate={endDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}");
}
if (queryParameters.Count > 0)
{
uriBuilder.Query = string.Join("&", queryParameters);
}
// Create HTTP transport objects
var httpRequest = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = uriBuilder.Uri,
};
httpRequest.Headers.Add("x-ms-version", "2.0-preview");
var connection = await GetConnectionAsync(personId);
await connection.AuthorizeRestRequestAsync(httpRequest, recordId);
var httpClient = new HttpClient();
var httpResponse = await httpClient.SendAsync(httpRequest);
var responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
if (!httpResponse.IsSuccessStatusCode)
{
throw new RestException(responseContent);
}
return SafeJsonConvert.DeserializeObject<TimelineResponse>(responseContent, GetDeserializationSettings());
}
private static IList<TimelineEntryViewModel> ConvertToTimelineEntryViewModels(TimelineTask task)
{
var timelineEntries = new List<TimelineEntryViewModel>();
if (task?.TimelineSnapshots == null || !task.TimelineSnapshots.Any()) return timelineEntries;
foreach (var snapshot in task.TimelineSnapshots)
{
if (snapshot.Schedules != null && snapshot.Schedules.Any())
{
foreach (var schedule in snapshot.Schedules)
{
timelineEntries.Add(new TimelineEntryViewModel
{
TaskId = task.TaskId,
TaskName = task.TaskName,
TaskImageUrl = task.TaskImageUrl,
LocalDateTime = schedule.LocalDateTime,
ScheduleType = schedule.Type
});
}
}
}
return timelineEntries;
}
private static JsonSerializerSettings GetDeserializationSettings()
{
var settings = new JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new ReadOnlyJsonContractResolver(),
Converters = new List<JsonConverter>
{
new Iso8601TimeSpanConverter()
}
};
settings.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
return settings;
}
}
}

Просмотреть файл

@ -57,20 +57,20 @@
<HintPath>..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.3\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.HealthVault, Version=1.65.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.1.65.20615.4-preview\lib\netstandard1.4\Microsoft.HealthVault.dll</HintPath>
<Reference Include="Microsoft.HealthVault, Version=1.66.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.1.66.20706.2-preview\lib\netstandard1.4\Microsoft.HealthVault.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.HealthVault.RestApi, Version=1.65.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.1.65.20615.4-preview\lib\netstandard1.4\Microsoft.HealthVault.RestApi.dll</HintPath>
<Reference Include="Microsoft.HealthVault.RestApi, Version=1.66.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.1.66.20706.2-preview\lib\netstandard1.4\Microsoft.HealthVault.RestApi.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.HealthVault.Web, Version=1.65.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.Web.1.65.20615.4-preview\lib\net461\Microsoft.HealthVault.Web.dll</HintPath>
<Reference Include="Microsoft.HealthVault.Web, Version=1.66.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.HealthVault.Web.1.66.20706.2-preview\lib\net461\Microsoft.HealthVault.Web.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Rest.ClientRuntime.2.3.7\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
<HintPath>..\packages\Microsoft.Rest.ClientRuntime.2.3.8\lib\net452\Microsoft.Rest.ClientRuntime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
@ -88,6 +88,10 @@
<HintPath>..\packages\NodaTime.2.0.2\lib\net45\NodaTime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NodaTime.Serialization.JsonNet, Version=2.0.0.0, Culture=neutral, PublicKeyToken=4226afe0d9b296d1, processorArchitecture=MSIL">
<HintPath>..\packages\NodaTime.Serialization.JsonNet.2.0.0\lib\net45\NodaTime.Serialization.JsonNet.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.3.0\lib\net46\System.AppContext.dll</HintPath>
@ -147,6 +151,10 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Reflection.TypeExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.TypeExtensions.4.3.0\lib\net46\System.Reflection.TypeExtensions.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime">
<HintPath>..\..\..\..\..\..\Repos\healthvault-samples\dotNETStandard\HealthVaultProviderManagementPortal\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
</Reference>
@ -214,6 +222,7 @@
<ItemGroup>
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\ActionPlanController.cs" />
<Compile Include="Controllers\PatientController.cs" />
<Compile Include="Controllers\GoalsController.cs" />
<Compile Include="Controllers\HealthDataController.cs" />
<Compile Include="Controllers\HomeController.cs" />
@ -242,6 +251,16 @@
<Compile Include="Models\ErrorInfoModel.cs" />
<Compile Include="Models\ErrorModel.cs" />
<Compile Include="Models\GoalsModel.cs" />
<Compile Include="Models\Patient\TaskType.cs" />
<Compile Include="Models\Patient\TimelineResponse.cs" />
<Compile Include="Models\Patient\TimelineSchedule.cs" />
<Compile Include="Models\Patient\TimelineScheduleOccurrence.cs" />
<Compile Include="Models\Patient\TimelineScheduleType.cs" />
<Compile Include="Models\Patient\TimelineSnapshot.cs" />
<Compile Include="Models\Patient\TimelineSnapshotCompletionMetrics.cs" />
<Compile Include="Models\Patient\TimelineEntryViewModel.cs" />
<Compile Include="Models\Patient\TimelineTask.cs" />
<Compile Include="Models\Patient\TimelineViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
@ -303,6 +322,9 @@
<ItemGroup>
<Content Include="Views\Goals\GoalRecommendation.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Patient\Index.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

Просмотреть файл

@ -0,0 +1,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
public enum TaskType
{
Unknown = 0,
BloodPressure = 1,
Other = 2,
}
}

Просмотреть файл

@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System;
using NodaTime;
/// <summary>
/// An entry on the timeline
/// </summary>
public class TimelineEntryViewModel
{
/// <summary>
/// ID of the task this timeline task is associated with
/// </summary>
public Guid TaskId { get; set; }
/// <summary>
/// Name of the task
/// </summary>
public string TaskName { get; set; }
/// <summary>
/// Task image URL
/// </summary>
public string TaskImageUrl { get; set; }
/// <summary>
/// The local date and time of the schedule
/// </summary>
public LocalDateTime LocalDateTime { get; set; }
/// <summary>
/// The type of schedule
/// </summary>
public TimelineScheduleType ScheduleType { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System.Collections.Generic;
public class TimelineResponse
{
/// <summary>
/// The collection of tasks
/// </summary>
public IList<TimelineTask> Tasks { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,80 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System;
using System.Collections.Generic;
using System.Linq;
using Enums;
using NodaTime;
/// <summary>
/// The schedule for the timeline entry
/// </summary>
public class TimelineSchedule
{
/// <summary>
/// The adherence delta for the task
/// </summary>
public Duration? AdherenceDelta { get; set; }
/// <summary>
/// The local date and time of the schedule
/// </summary>
public LocalDateTime LocalDateTime { get; set; }
/// <summary>
/// The type of schedule
/// </summary>
public TimelineScheduleType Type { get; set; }
/// <summary>
/// The recurrence type of the schedule
/// </summary>
public ActionPlanScheduleRecurrenceType RecurrenceType { get; set; }
/// <summary>
/// The occurrences which are bucketed into the schedule
/// </summary>
public List<TimelineScheduleOccurrence> Occurrences { get; set; }
public TimelineSchedule Clone()
{
return new TimelineSchedule
{
AdherenceDelta = this.AdherenceDelta,
LocalDateTime = this.LocalDateTime,
Type = this.Type,
RecurrenceType = this.RecurrenceType,
Occurrences = this.Occurrences
};
}
/// <summary>
/// Allocate the schedule occurrences which are grouped by date to the timeline schedule
/// </summary>
/// <param name="scheduleOccurrencesGroupedByDate"></param>
public void AssignOccurrences(IEnumerable<IGrouping<LocalDate, TimelineScheduleOccurrence>> scheduleOccurrencesGroupedByDate)
{
if (scheduleOccurrencesGroupedByDate != null)
{
this.Occurrences = scheduleOccurrencesGroupedByDate
.FirstOrDefault(group => group.Key.Equals(this.LocalDateTime.Date))
?.Select(occurrence =>
{
// Re-calculate if the occurrence is in or out of window
occurrence.InWindow = this.Type == TimelineScheduleType.Anytime ||
Math.Abs(Period.Between(this.LocalDateTime, occurrence.LocalDateTime).ToDuration().TotalMinutes) <= this.AdherenceDelta?.TotalMinutes;
return occurrence;
})
.ToList();
}
}
}
}

Просмотреть файл

@ -0,0 +1,48 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System;
using NodaTime;
/// <summary>
/// The schedule for the timeline entry
/// </summary>
public class TimelineScheduleOccurrence
{
/// <summary>
/// The task tracking entry Id for the schedule occurrence
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// The local date and time for the occurrence
/// </summary>
public LocalDateTime LocalDateTime { get; set; }
/// <summary>
/// If the occurrence occurred in or out of window
/// </summary>
public bool InWindow { get; set; }
/// <summary>
/// Creates a deep copy of the timeline schedule occurrence
/// </summary>
/// <returns></returns>
public TimelineScheduleOccurrence Clone()
{
return new TimelineScheduleOccurrence
{
Id = this.Id,
LocalDateTime = this.LocalDateTime,
InWindow = this.InWindow
};
}
}
}

Просмотреть файл

@ -0,0 +1,22 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
/// <summary>
/// Specifies the type of the TimelineScheduleEntry
/// </summary>
public enum TimelineScheduleType
{
Unknown = 0,
Zoned = 1,
Local = 2,
Unscheduled = 3,
Anytime = 4
}
}

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System.Collections.Generic;
using NodaTime;
/// <summary>
/// A snapshot of the timeline
/// </summary>
public class TimelineSnapshot
{
/// <summary>
/// Collection of schedules for the timeline entry
/// </summary>
public List<TimelineSchedule> Schedules { get; set; }
/// <summary>
/// Completion metrics specifying the recurrence and type for the timeline entry
/// </summary>
public TimelineSnapshotCompletionMetrics CompletionMetrics { get; set; }
/// <summary>
/// The occurrences which are marked as out of window and are thus not associated with a schedule
/// </summary>
public List<TimelineScheduleOccurrence> UnscheduledOccurrences { get; set; }
/// <summary>
/// The effective start time instant for the timeline snapshot
/// </summary>
public Instant EffectiveStartInstant { get; set; }
/// <summary>
/// The effective end time instant for the timeline snapshot
/// </summary>
public Instant EffectiveEndInstant { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,33 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using Enums;
/// <summary>
/// An entry on the timeline
/// </summary>
public class TimelineSnapshotCompletionMetrics
{
/// <summary>
/// The type of recurrence
/// </summary>
public ActionPlanScheduleRecurrenceType RecurrenceType { get; set; }
/// <summary>
/// The type of completion (Frequency/Schedule)
/// </summary>
public ActionPlanTaskCompletionType CompletionType { get; set; }
/// <summary>
/// The required number of occurrences required for the completion over the recurring period
/// </summary>
public int? RequiredNumberOfOccurrences { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,44 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System;
using System.Collections.Generic;
/// <summary>
/// An entry on the timeline
/// </summary>
public class TimelineTask
{
/// <summary>
/// ID of the task this timeline task is associated with
/// </summary>
public Guid TaskId { get; set; }
/// <summary>
/// Name of the task
/// </summary>
public string TaskName { get; set; }
/// <summary>
/// Type of the task
/// </summary>
public TaskType TaskType { get; set; }
/// <summary>
/// Task image URL
/// </summary>
public string TaskImageUrl { get; set; }
/// <summary>
/// Collection of timeline snapshots for the task
/// </summary>
public List<TimelineSnapshot> TimelineSnapshots { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
using System.Linq;
using NodaTime;
namespace HealthVaultProviderManagementPortal.Models.Patient
{
using System;
using System.Collections.Generic;
public class TimelineViewModel
{
public DateTime? StartDate { get; set; }
public DateTime? EndDate { get; set; }
public IEnumerable<IGrouping<LocalDate, Patient.TimelineEntryViewModel>> TimelineEntries { get; set; }
}
}

Просмотреть файл

@ -117,15 +117,18 @@
</tr>
</thead>
<tbody>
@foreach (var task in Model.AssociatedTasks)
@if (Model.AssociatedTasks != null)
{
<tr>
<td>@task.Id</td>
<td>@task.Name</td>
<td>@task.Status</td>
<td>@Html.ActionLink("Edit", "Task", new { planId = task.AssociatedPlanId, id = task.Id, personId = Request.Params["personId"], recordId = Request.Params["recordId"] })</td>
<td>@Html.ActionLink("Validate auto tracking", "ValidateTracking", new { planId = task.AssociatedPlanId, id = task.Id, personId = Request.Params["personId"], recordId = Request.Params["recordId"] })</td>
</tr>
foreach (var task in Model.AssociatedTasks)
{
<tr>
<td>@task.Id</td>
<td>@task.Name</td>
<td>@task.Status</td>
<td>@Html.ActionLink("Edit", "Task", new {planId = task.AssociatedPlanId, id = task.Id, personId = Request.Params["personId"], recordId = Request.Params["recordId"]})</td>
<td>@Html.ActionLink("Validate auto tracking", "ValidateTracking", new {planId = task.AssociatedPlanId, id = task.Id, personId = Request.Params["personId"], recordId = Request.Params["recordId"]})</td>
</tr>
}
}
</tbody>
</table>

Просмотреть файл

@ -31,11 +31,13 @@
{
foreach (var authorizedRecord in person.AuthorizedRecords)
{
var routeValues = new RouteValueDictionary();
routeValues.Add("recordId", authorizedRecord.Value.Id);
routeValues.Add("personId", person.PersonId);
var routeValues = new RouteValueDictionary
{
{"recordId", authorizedRecord.Value.Id},
{ "personId", person.PersonId}
};
<tr>
<tr>
<td>@authorizedRecord.Value.Name</td>
<td>
@Html.ActionLink("Plans", "Plans", "ActionPlan", routeValues, new Dictionary<string, object>())
@ -46,6 +48,9 @@
<td>
@Html.ActionLink("Health data", "Index", "HealthData", routeValues, new Dictionary<string, object>())
</td>
<td>
@Html.ActionLink("Patient preview", "Index", "Patient", routeValues, new Dictionary<string, object>())
</td>
</tr>
}
}

Просмотреть файл

@ -0,0 +1,69 @@
@*
Copyright (c) Microsoft Corporation. All rights reserved.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*@
@using HealthVaultProviderManagementPortal.Models.Patient
@model HealthVaultProviderManagementPortal.Models.Patient.TimelineViewModel
@{
ViewBag.Title = "Patient preview";
DateTime date = DateTime.MinValue;
}
<h1 class="page-title">Patient preview</h1>
@using (Html.BeginForm("Index", "Patient", FormMethod.Get))
{
@Html.Hidden("personID", Request.Params["personId"])
@Html.Hidden("recordID", Request.Params["recordID"])
<div class="form-horizontal">
<div class="form-group">
<div class="col-md-5 slim-col">
@Html.LabelFor(model => model.StartDate, htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.StartDate, new { htmlAttributes = new { @class = "form-control" } })
</div>
<div class="col-md-5 slim-col">
@Html.LabelFor(model => model.EndDate, htmlAttributes: new { @class = "control-label" })
@Html.EditorFor(model => model.EndDate, new { htmlAttributes = new { @class = "form-control" } })
</div>
<div class="col-md-2 slim-col">
<input type="submit" value="Get" class="btn btn-default btn-inline" />
</div>
</div>
</div>
}
@if (Model?.TimelineEntries != null && Model.TimelineEntries.Any())
{
<h3>Timeline</h3>
foreach (var entry in Model.TimelineEntries)
{
<h4>@entry.Key</h4>
<table class="table table-striped">
<tbody>
@foreach (var task in entry)
{
<tr>
<td class="ms-thumbnail"><img class="img-thumbnail" src="@task.TaskImageUrl" alt="Task thumbnail icon" /></td>
<td>
@task.TaskName<br />
@(task.ScheduleType == TimelineScheduleType.Anytime ?
TimelineScheduleType.Anytime.ToString() :
task.LocalDateTime.TimeOfDay.ToString())
</td>
<td><!--@task.TaskId--></td>
</tr>
}
</tbody>
</table>
}
}

Просмотреть файл

@ -129,6 +129,10 @@
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NodaTime" publicKeyToken="4226afe0d9b296d1" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.2.0" newVersion="2.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.codedom>

Просмотреть файл

@ -8,16 +8,17 @@
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net461" />
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net461" />
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="1.0.3" targetFramework="net461" />
<package id="Microsoft.HealthVault" version="1.65.20615.4-preview" targetFramework="net461" />
<package id="Microsoft.HealthVault.Web" version="1.65.20615.4-preview" targetFramework="net461" />
<package id="Microsoft.HealthVault" version="1.66.20706.2-preview" targetFramework="net461" />
<package id="Microsoft.HealthVault.Web" version="1.66.20706.2-preview" targetFramework="net461" />
<package id="Microsoft.Net.Compilers" version="1.3.2" targetFramework="net461" developmentDependency="true" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.7" targetFramework="net461" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.8" targetFramework="net461" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net461" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net461" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net461" />
<package id="NodaTime" version="2.0.2" targetFramework="net461" />
<package id="NodaTime.Serialization.JsonNet" version="2.0.0" targetFramework="net461" />
<package id="System.AppContext" version="4.3.0" targetFramework="net461" />
<package id="System.Collections" version="4.3.0" targetFramework="net461" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net461" />
@ -45,6 +46,7 @@
<package id="System.Reflection" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net461" />
<package id="System.Reflection.TypeExtensions" version="4.3.0" targetFramework="net461" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime" version="4.3.0" targetFramework="net461" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net461" />