Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/microsoft/FHIR-Converter in…
Browse files Browse the repository at this point in the history
…to mcm/fix-spec-source
  • Loading branch information
mcmcgrath13 committed Dec 13, 2024
2 parents 7546817 + 066edf0 commit 4fe184c
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 18 deletions.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<Product>Microsoft Health</Product>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<RepoRootPath>$(MSBuildThisFileDirectory)</RepoRootPath>
<LatestFramework>net8.0</LatestFramework>
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions build/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ parameters:

steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.0.x'
displayName: 'Use .NET Core sdk 8.0.x'
inputs:
version: 6.0.x
version: 8.0.x
selectOrConfig: configs
nugetConfigPath: nuget.config

Expand Down
4 changes: 2 additions & 2 deletions build/publish-nugets.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
steps:
- task: UseDotNet@2
displayName: 'Use .NET Core sdk 6.0.x'
displayName: 'Use .NET Core sdk 8.0.x'
inputs:
version: 6.0.x
version: 8.0.x
selectOrConfig: configs
nugetConfigPath: nuget.config

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>
<IsPackable>true</IsPackable>
<NuspecFile>Microsoft.Health.Fhir.Liquid.Converter.Tool.nuspec</NuspecFile>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<contentFiles>
<files include="any/net6.0/**/*.*" buildAction="Content" copyToOutput="true" />
<files include="any/net8.0/**/*.*" buildAction="Content" copyToOutput="true" />
</contentFiles>
</metadata>
<files>
<file src="..\..\bin\publish\**" target="contentFiles\any\net6.0" />
<file src="..\..\bin\publish\**" target="contentFiles\any\net8.0" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Health.Fhir.Liquid.Converter.Exceptions;
using Microsoft.Health.Fhir.Liquid.Converter.Models.Hl7v2;
using Microsoft.Health.Fhir.Liquid.Converter.Parsers;
using Xunit;
Expand Down Expand Up @@ -45,7 +46,7 @@ public void GivenAnHl7v2Data_WhenGetFirstSegments_CorrectResultShouldBeReturned(
Assert.True(!segments.ContainsKey("PV1"));

// Hl7v2Data and segment id content could not be null
Assert.Throws<NullReferenceException>(() => Filters.GetFirstSegments(null, "PID"));
Assert.Throws<TemplateLoadException>(() => Filters.GetFirstSegments(null, "PID"));
Assert.Throws<NullReferenceException>(() => Filters.GetFirstSegments(new Hl7v2Data(), null));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Health.Fhir.Liquid.Converter.Exceptions;
using Microsoft.Health.Fhir.Liquid.Converter.Models;
using Microsoft.Health.Fhir.Liquid.Converter.Models.Hl7v2;

namespace Microsoft.Health.Fhir.Liquid.Converter
Expand All @@ -17,6 +19,11 @@ public partial class Filters
{
public static Dictionary<string, Hl7v2Segment> GetFirstSegments(Hl7v2Data hl7v2Data, string segmentIdContent)
{
if (hl7v2Data == null)
{
throw new TemplateLoadException(FhirConverterErrorCode.TemplateDataMismatch, "Incorrect template was passed in for the input data format.");
}

var result = new Dictionary<string, Hl7v2Segment>();
var segmentIds = segmentIdContent.Split(@"|");
for (var i = 0; i < hl7v2Data.Meta.Count; ++i)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>
<IsPackable>false</IsPackable>
<Nullable>annotations</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public enum FhirConverterErrorCode
InvalidCodeMapping = 1103,
TemplateSyntaxError = 1104,
InvalidJsonSchema = 1105,
TemplateDataMismatch = 1106,

// DataParseException
InputParsingError = 1201,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public PartialDateTime ConvertToDate()

public PartialDateTime AddSeconds(double seconds)
{
DateTimeValue = DateTimeValue.AddSeconds(seconds);
var timespan = TimeSpan.FromSeconds(seconds);
DateTimeValue = DateTimeValue.Add(timespan);
MillisecondString = null;

if (Precision != DateTimePrecision.Milliseconds)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ protected string RenderTemplates(Template template, Context context)
{
throw;
}
catch (TemplateLoadException)
{
throw;
}
catch (Exception ex)
{
Console.WriteLine("Ex: {1} StackTrace: '{0}'", Environment.StackTrace, ex);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Package Description</description>
<dependencies>
<group targetFramework="net6.0">
<group targetFramework="net8.0">
<dependency id="Antlr4.Runtime.Standard" version="4.8.0" exclude="Build,Analyzers" />
<dependency id="Azure.Identity" version="1.10.3" exclude="Build,Analyzers" />
<dependency id="Azure.Storage.Blobs" version="12.17.0" exclude="Build,Analyzers" />
Expand All @@ -32,7 +32,7 @@
</dependencies>
</metadata>
<files>
<file src="bin\Release\net6.0\Microsoft.Health.Fhir.Liquid.Converter.dll" target="lib\net6.0" />
<file src="bin\Release\net6.0\Microsoft.Health.Fhir.TemplateManagement.dll" target="lib\net6.0" />
<file src="bin\Release\net8.0\Microsoft.Health.Fhir.Liquid.Converter.dll" target="lib\net8.0" />
<file src="bin\Release\net8.0\Microsoft.Health.Fhir.TemplateManagement.dll" target="lib\net8.0" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>$(LatestFramework)</TargetFramework>
<IsPackable>true</IsPackable>
<NuspecFile>Microsoft.Health.Fhir.Liquid.Converter.nuspec</NuspecFile>
<OrasVersion>0.12.0</OrasVersion>
Expand Down

0 comments on commit 4fe184c

Please sign in to comment.