From a385edc52cde731a5696de36fcef3769d78087b2 Mon Sep 17 00:00:00 2001 From: sowu880 <57981365+sowu880@users.noreply.github.com> Date: Wed, 6 Jul 2022 13:42:14 +0800 Subject: [PATCH 1/4] Fix more than 3 digits for milliseconds in datetime (#409) * fix * fix --- .../Hl7v2/ADT_A01/ADT-A01-01-expected.json | 2 +- .../Hl7v2/ADT_A01/ADT-A01-02-expected.json | 2 +- .../Hl7v2/ADT_A02/ADT-A02-01-expected.json | 4 ++-- .../Hl7v2/ADT_A02/ADT-A02-02-expected.json | 2 +- .../Hl7v2/ADT_A03/ADT-A03-01-expected.json | 2 +- .../Hl7v2/ADT_A03/ADT-A03-02-expected.json | 2 +- .../Hl7v2/ADT_A04/ADT-A04-01-expected.json | 2 +- .../Hl7v2/ADT_A04/ADT-A04-02-expected.json | 2 +- .../Hl7v2/ADT_A05/ADT-A05-01-expected.json | 2 +- .../Hl7v2/ADT_A05/ADT-A05-02-expected.json | 2 +- .../Hl7v2/ADT_A08/ADT-A08-01-expected.json | 2 +- .../Hl7v2/ADT_A08/ADT-A08-02-expected.json | 2 +- .../Hl7v2/ADT_A11/ADT-A11-01-expected.json | 2 +- .../Hl7v2/ADT_A11/ADT-A11-02-expected.json | 2 +- .../Hl7v2/ADT_A13/ADT-A13-01-expected.json | 2 +- .../Hl7v2/ADT_A13/ADT-A13-02-expected.json | 2 +- .../Hl7v2/ADT_A14/ADT-A14-01-expected.json | 2 +- .../Hl7v2/ADT_A14/ADT-A14-02-expected.json | 2 +- .../Hl7v2/ADT_A15/ADT-A15-01-expected.json | 2 +- .../Hl7v2/ADT_A15/ADT-A15-02-expected.json | 2 +- .../Hl7v2/ADT_A16/ADT-A16-01-expected.json | 2 +- .../Hl7v2/ADT_A16/ADT-A16-02-expected.json | 2 +- .../Hl7v2/ADT_A25/ADT-A25-01-expected.json | 2 +- .../Hl7v2/ADT_A25/ADT-A25-02-expected.json | 2 +- .../Hl7v2/ADT_A26/ADT-A26-01-expected.json | 2 +- .../Hl7v2/ADT_A26/ADT-A26-02-expected.json | 2 +- .../Hl7v2/ADT_A27/ADT-A27-01-expected.json | 2 +- .../Hl7v2/ADT_A27/ADT-A27-02-expected.json | 2 +- .../Hl7v2/ADT_A28/ADT-A28-01-expected.json | 2 +- .../Hl7v2/ADT_A28/ADT-A28-02-expected.json | 2 +- .../Hl7v2/ADT_A29/ADT-A29-01-expected.json | 2 +- .../Hl7v2/ADT_A29/ADT-A29-02-expected.json | 2 +- .../Hl7v2/ADT_A31/ADT-A31-01-expected.json | 2 +- .../Hl7v2/ADT_A31/ADT-A31-02-expected.json | 2 +- .../Hl7v2/ADT_A41/ADT-A41-01-expected.json | 2 +- .../Hl7v2/ADT_A41/ADT-A41-02-expected.json | 2 +- .../Hl7v2/ADT_A60/ADT-A60-01-expected.json | 2 +- .../Hl7v2/ADT_A60/ADT-A60-02-expected.json | 2 +- .../Hl7v2/BAR_P01/BAR-P01-01-expected.json | 2 +- .../Hl7v2/BAR_P01/BAR-P01-02-expected.json | 2 +- .../Hl7v2/BAR_P02/BAR-P02-01-expected.json | 2 +- .../Hl7v2/BAR_P02/BAR-P02-02-expected.json | 2 +- .../Hl7v2/BAR_P12/BAR-P12-01-expected.json | 2 +- .../Hl7v2/BAR_P12/BAR-P12-02-expected.json | 2 +- .../Hl7v2/DFT_P03/DFT-P03-02-expected.json | 2 +- .../Filters/DateFiltersTests.cs | 13 ++++++++++++- .../Models/PartialDateTime.cs | 17 +++++++++++++++-- 47 files changed, 73 insertions(+), 49 deletions(-) diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-01-expected.json index 06f70c7e6..242bc8e55 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-01-expected.json @@ -2785,7 +2785,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-02-expected.json index 57ea403e6..9c64ed08e 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A01/ADT-A01-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-01-expected.json index 17426c648..6ca26f9dd 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-01-expected.json @@ -65,7 +65,7 @@ "id": "0a7545d7-202f-96e5-31e9-bb7d27ade3c2", "text": { "status": "generated", - "div": "

Resource bundle generated on 2022-03-28T06:47:19.004Z using Microsoft FHIR Converter.Template Version: TEMPLATE_VERSION_PLACEHOLDER.Template URL: https://github.com/microsoft/FHIR-Converter/releases/download/vTEMPLATE_VERSION_PLACEHOLDER/Hl7v2DefaultTemplates.tar.gz.Root template: ADT_A02.

" + "div": "

Resource bundle generated on 2022-03-28T06:47:19.4Z using Microsoft FHIR Converter.Template Version: TEMPLATE_VERSION_PLACEHOLDER.Template URL: https://github.com/microsoft/FHIR-Converter/releases/download/vTEMPLATE_VERSION_PLACEHOLDER/Hl7v2DefaultTemplates.tar.gz.Root template: ADT_A02.

" }, "occurredDateTime": "1989-08-18T14:41:00+05:30", "recorded": "1989-08-18T14:41:00+05:30", @@ -2473,7 +2473,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-02-expected.json index 7fb9ed8be..753cc5cc6 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A02/ADT-A02-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-01-expected.json index c97627b76..5a4135c46 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-01-expected.json @@ -2748,7 +2748,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-02-expected.json index af473e756..e92c2df26 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A03/ADT-A03-02-expected.json @@ -1881,7 +1881,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-01-expected.json index a71ddd216..a7cfd238c 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-01-expected.json @@ -2748,7 +2748,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-02-expected.json index 8f732076b..011fe13b2 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A04/ADT-A04-02-expected.json @@ -2154,7 +2154,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-01-expected.json index 1891fc3ef..e84cde383 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-01-expected.json @@ -2742,7 +2742,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-02-expected.json index 55ff7f0fa..d61ec833d 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A05/ADT-A05-02-expected.json @@ -2154,7 +2154,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-01-expected.json index 129c34e68..561bb82b9 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-01-expected.json @@ -2872,7 +2872,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-02-expected.json index a509d09fb..caa7eda66 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A08/ADT-A08-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-01-expected.json index 4b386d544..8232bb44f 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-01-expected.json @@ -2391,7 +2391,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-02-expected.json index 4cee7b531..e6a686d05 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A11/ADT-A11-02-expected.json @@ -2149,7 +2149,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-01-expected.json index 3998872ed..b8f88b682 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-01-expected.json @@ -2871,7 +2871,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-02-expected.json index cf3b904a4..5366c244f 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A13/ADT-A13-02-expected.json @@ -2153,7 +2153,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-01-expected.json index ed119ab90..5f5c1ecab 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-01-expected.json @@ -2742,7 +2742,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-02-expected.json index b703615d0..878529c3e 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A14/ADT-A14-02-expected.json @@ -2154,7 +2154,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-01-expected.json index 6d2b0e6ed..c99fd54ca 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-01-expected.json @@ -2464,7 +2464,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-02-expected.json index 286a89b7f..ffb05bbaf 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A15/ADT-A15-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-01-expected.json index ac42f12e5..b18589d39 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-01-expected.json @@ -2866,7 +2866,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-02-expected.json index f19053a36..5d6623b62 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A16/ADT-A16-02-expected.json @@ -2154,7 +2154,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-01-expected.json index d4e9b86b7..59e434173 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-01-expected.json @@ -2395,7 +2395,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-02-expected.json index 87b85132a..6aff0ef2f 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A25/ADT-A25-02-expected.json @@ -2153,7 +2153,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-01-expected.json index a6cfaa164..d8f831b23 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-01-expected.json @@ -2161,7 +2161,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-02-expected.json index b03b9902c..dd90c6717 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A26/ADT-A26-02-expected.json @@ -1780,7 +1780,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-01-expected.json index c8e796f26..b8e1a9e16 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-01-expected.json @@ -2390,7 +2390,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-02-expected.json index 93d2c7558..c6f46c7bc 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A27/ADT-A27-02-expected.json @@ -2149,7 +2149,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-01-expected.json index f21301320..74bd83262 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-01-expected.json @@ -2742,7 +2742,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-02-expected.json index cd4f6830c..fa9e57753 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A28/ADT-A28-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-01-expected.json index dcb5d7b42..45b197a21 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-01-expected.json @@ -2395,7 +2395,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-02-expected.json index 913746f33..b292c5750 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A29/ADT-A29-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-01-expected.json index 3ecd26257..f74908db5 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-01-expected.json @@ -2742,7 +2742,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-02-expected.json index 56f05b8af..cfeadbfc8 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A31/ADT-A31-02-expected.json @@ -1880,7 +1880,7 @@ "resource": { "resourceType": "Provenance", "id": "9f6be243-c2fa-f8c8-0a7a-d168e98bdd4c", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-01-expected.json index 07c0c5a37..dac7b3626 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-01-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-02-expected.json index b2b0c7384..8d006c43c 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A41/ADT-A41-02-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-01-expected.json index 914658ae6..01dd79512 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-01-expected.json @@ -2358,7 +2358,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-02-expected.json index 2dca0d6d3..6f36014ac 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/ADT_A60/ADT-A60-02-expected.json @@ -794,7 +794,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-01-expected.json index 1be284ac3..0f3722325 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-01-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-02-expected.json index d473452f3..331a749ae 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P01/BAR-P01-02-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "07eea8d4-d9d1-105e-9d76-23efad1ef94d", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-01-expected.json index 8fffc12b4..01478cfe9 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-01-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "0d294d4d-3c8c-be35-4813-e61ba6e34968", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-02-expected.json index 367efa833..1e71bcddb 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P02/BAR-P02-02-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "0d294d4d-3c8c-be35-4813-e61ba6e34968", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-01-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-01-expected.json index 6892c8212..cc855a2f7 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-01-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-01-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "b867d34c-37a2-f79b-bb8a-ee155ab769b7", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-02-expected.json index b707a51f8..91812275c 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/BAR_P12/BAR-P12-02-expected.json @@ -260,7 +260,7 @@ "resource": { "resourceType": "Provenance", "id": "b867d34c-37a2-f79b-bb8a-ee155ab769b7", - "occurredDateTime": "2021-08-17T18:49:43.004+05:30", + "occurredDateTime": "2021-08-17T18:49:43.4+05:30", "recorded": "2029-08-01T11:21:24+05:30", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/DFT_P03/DFT-P03-02-expected.json b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/DFT_P03/DFT-P03-02-expected.json index 35b8e0cbf..eb2af909c 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/DFT_P03/DFT-P03-02-expected.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.FunctionalTests/TestData/Expected/Hl7v2/DFT_P03/DFT-P03-02-expected.json @@ -2341,7 +2341,7 @@ "resource": { "resourceType": "Provenance", "id": "7ea13aa8-faf2-0187-4bb2-5dea25212fba", - "occurredDateTime": "2021-08-17T15:19:43.004+02:00", + "occurredDateTime": "2021-08-17T15:19:43.4+02:00", "recorded": "2005-01-12T22:00:00Z", "reason": [ { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/DateFiltersTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/DateFiltersTests.cs index 5184a34ab..f72fe23df 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/DateFiltersTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Filters/DateFiltersTests.cs @@ -21,6 +21,7 @@ public static IEnumerable GetValidDataForAddHyphensDate() yield return new object[] { @"200101", "preserve", @"2001-01" }; yield return new object[] { @"19241010", "local", @"1924-10-10" }; yield return new object[] { @"19850101000000", "local", @"1985-01-01" }; + yield return new object[] { @"19850101000000.1234", "local", @"1985-01-01" }; } // We assume the local timezone is +08:00. @@ -29,6 +30,7 @@ public static IEnumerable GetValidDataWithoutTimeZoneForAddHyphensDate yield return new object[] { @"200101", "utc", new DateTime(2001, 1, 1) }; yield return new object[] { @"20010102", "utc", new DateTime(2001, 1, 2) }; yield return new object[] { @"19880101000000", "utc", new DateTime(1988, 1, 1, 0, 0, 0) }; + yield return new object[] { @"19880101000000.1234", "utc", new DateTime(1988, 1, 1, 0, 0, 0) }; } public static IEnumerable GetValidDataForAddHyphensDateWithDefaultTimeZoneHandling() @@ -39,6 +41,7 @@ public static IEnumerable GetValidDataForAddHyphensDateWithDefaultTime yield return new object[] { @"200101", @"2001-01" }; yield return new object[] { @"19241010", @"1924-10-10" }; yield return new object[] { @"19850101000000", @"1985-01-01" }; + yield return new object[] { @"19850101000000.1234", @"1985-01-01" }; } public static IEnumerable GetValidDataForAddSeconds() @@ -51,12 +54,13 @@ public static IEnumerable GetValidDataForAddSeconds() yield return new object[] { @"1970-01-01T00:01:00+06:00", 60.000, "preserve", @"1970-01-01T00:02:00+06:00" }; yield return new object[] { @"1970-01-01T00:01:00+06:30", 60.000, "preserve", @"1970-01-01T00:02:00+06:30" }; yield return new object[] { @"1970-01-01T00:01:00+14:00", 60, "utc", @"1969-12-31T10:02:00Z" }; + yield return new object[] { @"1970-01-01T00:01:00.1234+14:00", 60, "utc", @"1969-12-31T10:02:00.123Z" }; // Skip this test in pipeline, as the local time zone is different // yield return new object[] { @"2001-01", 60, "preserve", @"2001-01-01T00:01:00+08:00" }; // yield return new object[] { @"1924-10-10", 60000, "utc", @"1924-10-10T08:40:00Z" }; // yield return new object[] { @"1970-01-01T00:01:00+06:00", 60, "local", @"1970-01-01T02:02:00+08:00" }; - // yield return new object[] { @"1924-10-10", 60000, "local", @"1924-10-10T16:40:00" }; + // yield return new object[] { @"1924-10-10", 60000, "local", @"1924-10-10T16:40:00+08:00" }; } // We assume the local timezone is +08:00. @@ -72,6 +76,8 @@ public static IEnumerable GetValidDataForAddSecondsWithDefaultTimeZone yield return new object[] { string.Empty, 60, string.Empty }; yield return new object[] { @"1970-01-01T00:01:00Z", 60.123, @"1970-01-01T00:02:00.123Z" }; yield return new object[] { @"1970-01-01T00:01:00+06:00", 60.000, @"1970-01-01T00:02:00+06:00" }; + yield return new object[] { @"1970-01-01T00:01:00.1234+06:00", 60.000, @"1970-01-01T00:02:00.123+06:00" }; + yield return new object[] { @"1970-01-01T00:01:00.1234+06:00", 60.1234, @"1970-01-01T00:02:00.246+06:00" }; // Skip this test in pipeline, as the local time zone is different // yield return new object[] { @"2001-01", 60, @"2001-01-01T00:01:00+08:00" }; @@ -101,6 +107,8 @@ public static IEnumerable GetValidDataForFormatAsDateTime() yield return new object[] { @"19701231115959+0600", "preserve", @"1970-12-31T11:59:59+06:00" }; yield return new object[] { @"19701231115959+0600", "utc", @"1970-12-31T05:59:59Z" }; yield return new object[] { @"19701231115959+0630", "utc", @"1970-12-31T05:29:59Z" }; + yield return new object[] { @"19701231115959.12234+0630", "utc", @"1970-12-31T05:29:59.12234Z" }; + yield return new object[] { @"19701231115959.000+0630", "utc", @"1970-12-31T05:29:59.000Z" }; // Skip this test in pipeline, as the local time zone is different // yield return new object[] { @"20110103143428-0800", "local", @"2011-01-04T06:34:28+08:00" }; @@ -129,6 +137,8 @@ public static IEnumerable GetValidDataForFormatAsDateTimeWithDefaultTi yield return new object[] { @"19701231115959+0600", @"1970-12-31T11:59:59+06:00" }; yield return new object[] { @"19701231115959+0000", @"1970-12-31T11:59:59Z" }; yield return new object[] { @"19701231115959-0000", @"1970-12-31T11:59:59Z" }; + yield return new object[] { @"19701231115959.1234-0000", @"1970-12-31T11:59:59.1234Z" }; + yield return new object[] { @"19701231115959.000-0000", @"1970-12-31T11:59:59.000Z" }; // If no time zone provided, it is treated as local // yield return new object[] { @"20050110045253", @"2005-01-10T04:52:53+08:00" }; @@ -161,6 +171,7 @@ public static IEnumerable GetInvalidDataForFormatAsDateTime() yield return new object[] { @"2020010130" }; yield return new object[] { @"202001011080" }; yield return new object[] { @"20200101101080" }; + yield return new object[] { @"20200101101080.-123" }; } public static IEnumerable GetInvalidTimeZoneHandling() diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs index 028fdfa62..02396525d 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/PartialDateTime.cs @@ -37,7 +37,8 @@ public PartialDateTime(string input, DateTimeType type = DateTimeType.Fhir) int hour = groups["hour"].Success ? int.Parse(groups["hour"].Value) : 0; int minute = groups["minute"].Success ? int.Parse(groups["minute"].Value) : 0; int second = groups["second"].Success ? int.Parse(groups["second"].Value) : 0; - int millisecond = groups["millisecond"].Success ? int.Parse(groups["millisecond"].Value) : 0; + int millisecond = groups["millisecond"].Success ? int.Parse(groups["millisecond"].Value.Length > 3 ? groups["millisecond"].Value.Substring(0, 3) : groups["millisecond"].Value) : 0; + MillisecondString = groups["millisecond"].Success ? groups["millisecond"].Value : null; var timeSpan = TimeZoneInfo.Local.GetUtcOffset(new DateTime(year, month, day, hour, minute, second, millisecond)); if (groups["timeZone"].Success) @@ -71,6 +72,8 @@ public PartialDateTime(string input, DateTimeType type = DateTimeType.Fhir) public bool HasTimeZone { get; private set; } + public string MillisecondString { get; private set; } + public DateTimePrecision Precision { get; private set; } public PartialDateTime ConvertToDate() @@ -82,6 +85,8 @@ public PartialDateTime ConvertToDate() public PartialDateTime AddSeconds(double seconds) { DateTimeValue = DateTimeValue.AddSeconds(seconds); + MillisecondString = null; + if (Precision != DateTimePrecision.Milliseconds) { Precision = DateTimeValue.Millisecond == 0 ? DateTimePrecision.Second : DateTimePrecision.Milliseconds; @@ -112,8 +117,16 @@ public string ToFhirString(TimeZoneHandlingMethod timeZoneHandling = TimeZoneHan } var timeZoneSuffix = resultDateTime.Offset == TimeSpan.Zero ? "Z" : "%K"; + string dateTimeFormat; + if (Precision < DateTimePrecision.Milliseconds) + { + dateTimeFormat = "yyyy-MM-ddTHH:mm:ss" + timeZoneSuffix; + } + else + { + dateTimeFormat = MillisecondString == null ? "yyyy-MM-ddTHH:mm:ss.fff" + timeZoneSuffix : "yyyy-MM-ddTHH:mm:ss." + MillisecondString + timeZoneSuffix; + } - var dateTimeFormat = Precision < DateTimePrecision.Milliseconds ? "yyyy-MM-ddTHH:mm:ss" + timeZoneSuffix : "yyyy-MM-ddTHH:mm:ss.fff" + timeZoneSuffix; return resultDateTime.ToString(dateTimeFormat); } } From e93614b2ff7f686e13d87714cd887dffb5a429f1 Mon Sep 17 00:00:00 2001 From: QuanWanxx <68055742+QuanWanxx@users.noreply.github.com> Date: Wed, 6 Jul 2022 14:31:17 +0800 Subject: [PATCH 2/4] Update version to 5.0.3 (#412) --- release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yml b/release.yml index 3aad5aace..cd4a63ded 100644 --- a/release.yml +++ b/release.yml @@ -18,7 +18,7 @@ variables: buildConfiguration: 'Release' major: 5 minor: 0 - patch: 2 + patch: 3 buildnum: $[counter(format('{0}.{1}.{2}',variables['major'],variables['minor'], variables['patch']), 1)] version: $(major).$(minor).$(patch).$(buildnum) From 2dcf0058009b1a7b71563d19b369afab914a9dd2 Mon Sep 17 00:00:00 2001 From: QuanWanxx <68055742+QuanWanxx@users.noreply.github.com> Date: Fri, 5 Aug 2022 17:36:59 +0800 Subject: [PATCH 3/4] Change to NJsonSchema lib (#415) * Change to NJsonSchema lib * Catch Exception when Parse JsonSchema * Add meta schema as embedded resource * Update FunctionalTest to ignore meta-schema.json * Add multiple times test for validate --- data/Templates/Json/Schema/meta-schema.json | 150 ++++++++++++++++++ .../TemplateLocalFileSystemTests.cs | 10 +- .../DotLiquids/ValidateTests.cs | 39 ++++- .../Schemas/InvalidTestSchema.schema.json | 2 +- .../Schemas/TestSchema.schema.json | 1 + .../Schemas/TestSchema2.schema.json | 1 + .../Schemas/TestSubPropertySchema.schema.json | 1 + .../ValidUnmatchedTemplate3.liquid | 2 +- .../Utilities/TemplateUtilityTests.cs | 21 +++ .../DotLiquids/Validate.cs | 13 +- ...rosoft.Health.Fhir.Liquid.Converter.csproj | 6 +- .../Models/Json/JSchemaContext.cs | 6 +- .../Models/Json/JSchemaDocument.cs | 6 +- .../Models/Json/JSchemaTraceInfo.cs | 6 +- .../Processors/JsonProcessor.cs | 4 +- .../Utilities/TemplateUtility.cs | 52 +++++- .../TemplateCollectionFunctionalTests.cs | 12 +- 17 files changed, 298 insertions(+), 34 deletions(-) create mode 100644 data/Templates/Json/Schema/meta-schema.json diff --git a/data/Templates/Json/Schema/meta-schema.json b/data/Templates/Json/Schema/meta-schema.json new file mode 100644 index 000000000..85eb502a6 --- /dev/null +++ b/data/Templates/Json/Schema/meta-schema.json @@ -0,0 +1,150 @@ +{ + "id": "http://json-schema.org/draft-04/schema#", + "$schema": "http://json-schema.org/draft-04/schema#", + "description": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": { "$ref": "#" } + }, + "positiveInteger": { + "type": "integer", + "minimum": 0 + }, + "positiveIntegerDefault0": { + "allOf": [ { "$ref": "#/definitions/positiveInteger" }, { "default": 0 } ] + }, + "simpleTypes": { + "enum": [ "array", "boolean", "integer", "null", "number", "object", "string" ] + }, + "stringArray": { + "type": "array", + "items": { "type": "string" }, + "minItems": 1, + "uniqueItems": true + } + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "format": "uri" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "multipleOf": { + "type": "number", + "minimum": 0, + "exclusiveMinimum": true + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "boolean", + "default": false + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "boolean", + "default": false + }, + "maxLength": { "$ref": "#/definitions/positiveInteger" }, + "minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "items": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/schemaArray" } + ], + "default": {} + }, + "maxItems": { "$ref": "#/definitions/positiveInteger" }, + "minItems": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxProperties": { "$ref": "#/definitions/positiveInteger" }, + "minProperties": { "$ref": "#/definitions/positiveIntegerDefault0" }, + "required": { "$ref": "#/definitions/stringArray" }, + "additionalProperties": { + "anyOf": [ + { "type": "boolean" }, + { "$ref": "#" } + ], + "default": {} + }, + "definitions": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": { "$ref": "#" }, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [ + { "$ref": "#" }, + { "$ref": "#/definitions/stringArray" } + ] + } + }, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + { "$ref": "#/definitions/simpleTypes" }, + { + "type": "array", + "items": { "$ref": "#/definitions/simpleTypes" }, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "allOf": { "$ref": "#/definitions/schemaArray" }, + "anyOf": { "$ref": "#/definitions/schemaArray" }, + "oneOf": { "$ref": "#/definitions/schemaArray" }, + "not": { "$ref": "#" } + }, + "dependencies": { + "exclusiveMaximum": [ "maximum" ], + "exclusiveMinimum": [ "minimum" ] + }, + "default": {} +} diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/TemplateLocalFileSystemTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/TemplateLocalFileSystemTests.cs index ab061c069..b9ab1b66c 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/TemplateLocalFileSystemTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/TemplateLocalFileSystemTests.cs @@ -12,7 +12,7 @@ using Microsoft.Health.Fhir.Liquid.Converter.Models; using Microsoft.Health.Fhir.Liquid.Converter.Models.Json; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Schema; +using NJsonSchema; using Xunit; namespace Microsoft.Health.Fhir.Liquid.Converter.UnitTests.DotLiquids @@ -23,7 +23,6 @@ public class TemplateLocalFileSystemTests public void GivenAValidTemplateDirectory_WhenGetTemplate_CorrectResultsShouldBeReturned() { var templateLocalFileSystem = new TemplateLocalFileSystem(TestConstants.Hl7v2TemplateDirectory, DataType.Hl7v2); - var context = new Context(CultureInfo.InvariantCulture); // Template exists Assert.NotNull(templateLocalFileSystem.GetTemplate("ADT_A01")); @@ -49,11 +48,10 @@ public void GivenAValidTemplateDirectory_WhenGetTemplateWithContext_CorrectResul } [Fact] - public void GivenAValidTemplateDirectory_WhenGetJsonSchemaTemplate_CorrectResultsShouldBeReturned() + public async void GivenAValidTemplateDirectory_WhenGetJsonSchemaTemplate_CorrectResultsShouldBeReturned() { var templateLocalFileSystem = new TemplateLocalFileSystem(Path.Join(TestConstants.TestTemplateDirectory, @"ValidValidateTemplates"), DataType.Hl7v2); var testSchemaPath = "Schemas/TestSchema.schema.json"; - var context = new Context(CultureInfo.InvariantCulture); var schemaTemplate = templateLocalFileSystem.GetTemplate(testSchemaPath); @@ -64,8 +62,8 @@ public void GivenAValidTemplateDirectory_WhenGetJsonSchemaTemplate_CorrectResult Assert.NotNull(jSchemaDocument); Assert.NotNull(jSchemaDocument.Schema); - JSchema expectedJSchema = JSchema.Parse(File.ReadAllText(Path.Join(TestConstants.TestTemplateDirectory, @"ValidValidateTemplates", testSchemaPath))); - Assert.True(JToken.DeepEquals(JToken.Parse(jSchemaDocument.Schema.ToString()), JToken.Parse(expectedJSchema.ToString()))); + JsonSchema expectedJSchema = await JsonSchema.FromJsonAsync(File.ReadAllText(Path.Join(TestConstants.TestTemplateDirectory, @"ValidValidateTemplates", testSchemaPath))); + Assert.True(JToken.DeepEquals(JToken.Parse(jSchemaDocument.Schema.ToJson()), JToken.Parse(expectedJSchema.ToJson()))); } [Fact] diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/ValidateTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/ValidateTests.cs index dc6ae8b30..847a1fbb3 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/ValidateTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/DotLiquids/ValidateTests.cs @@ -88,6 +88,43 @@ public void GivenValidValidateMatchedTemplateContent_WhenParseAndRender_CorrectR Assert.True(JToken.DeepEquals(expectedObject, actualObject)); } + [Theory] + [MemberData(nameof(GetValidValidateMatchedTemplateContents))] + public void GivenValidValidateMatchedTemplateContent_WhenRenderMultipleTimes_CorrectResultShouldBeReturned(string templateContent, string expectedResult) + { + int repeatCount = 100000; + + // Template should be parsed correctly + var template = TemplateUtility.ParseLiquidTemplate(TemplateName, templateContent); + + var templateFolder = Path.Join(TestConstants.TestTemplateDirectory, @"ValidValidateTemplates"); + var parser = new JsonDataParser(); + var inputContent = "{\"id\": \"0\",\"valueReference\" : \"testReference\",\"resourceType\" : \"Patient\",\"name\":{\"valueString\" : \"valueString\"}}"; + + var templateProvider = new TemplateProvider(templateFolder, DataType.Json); + var jsonData = parser.Parse(inputContent); + var dictionary = new Dictionary { { "msg", jsonData } }; + var context = new Context( + environments: new List { Hash.FromDictionary(dictionary) }, + outerScope: new Hash(), + registers: Hash.FromDictionary(new Dictionary() { { "file_system", templateProvider.GetTemplateFileSystem() } }), + errorsOutputMode: ErrorsOutputMode.Rethrow, + maxIterations: 0, + timeout: 0, + formatProvider: CultureInfo.InvariantCulture); + context.AddFilters(typeof(Filters)); + + string result = string.Empty; + for (int i = 0; i < repeatCount; i++) + { + result = template.Render(RenderParameters.FromContext(context, CultureInfo.InvariantCulture)); + } + + var expectedObject = JObject.Parse(expectedResult); + var actualObject = JObject.Parse(result); + Assert.True(JToken.DeepEquals(expectedObject, actualObject)); + } + [Theory] [MemberData(nameof(GetValidValidateMatchedTemplateWithSchemaContents))] public void GivenValidValidateMatchedTemplateContent_WithJsonContext_WhenParseAndRender_InvolvedSchemaShouldBeReturned(string templateContent, List expectSchemaFiles) @@ -120,7 +157,7 @@ public void GivenValidValidateMatchedTemplateContent_WithJsonContext_WhenParseAn for (int i = 0; i < expectSchemaFiles.Count; i++) { var expectedSchemaObject = JObject.Parse(File.ReadAllText(Path.Join(TestConstants.TestTemplateDirectory, expectSchemaFiles[i]))); - var actualSchemaObject = JObject.Parse(context.ValidateSchemas[i].ToString()); + var actualSchemaObject = JObject.Parse(context.ValidateSchemas[i].ToJson()); Assert.True(JToken.DeepEquals(expectedSchemaObject, actualSchemaObject)); } } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/InvalidValidateTemplates/Schemas/InvalidTestSchema.schema.json b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/InvalidValidateTemplates/Schemas/InvalidTestSchema.schema.json index 20636060c..cc96da5cc 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/InvalidValidateTemplates/Schemas/InvalidTestSchema.schema.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/InvalidValidateTemplates/Schemas/InvalidTestSchema.schema.json @@ -1,3 +1,3 @@ { - "type": "invalidType" + "type": "InvalidType" } \ No newline at end of file diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema.schema.json b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema.schema.json index d59d0b605..9ea438813 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema.schema.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema.schema.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-04/schema#", "title": "Patient customized schema", "type": "object", "properties": { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema2.schema.json b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema2.schema.json index 6df67308d..dbff6c985 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema2.schema.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSchema2.schema.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-04/schema#", "title": "Patient customized schema", "type": "object", "properties": { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSubPropertySchema.schema.json b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSubPropertySchema.schema.json index 61f31e85c..8c51ec2f4 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSubPropertySchema.schema.json +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/Schemas/TestSubPropertySchema.schema.json @@ -1,4 +1,5 @@ { + "$schema": "http://json-schema.org/draft-04/schema#", "title": "Patient customized schema", "type": "object", "properties": { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/ValidUnmatchedTemplate3.liquid b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/ValidUnmatchedTemplate3.liquid index d8fdeff25..fa0dd238e 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/ValidUnmatchedTemplate3.liquid +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/TestData/TestTemplates/ValidValidateTemplates/ValidUnmatchedTemplate3.liquid @@ -1,4 +1,4 @@ -{% validate "Schemas/TestSchema3.schema.json" -%} +{% validate "Schemas/TestSchema2.schema.json" -%} { "resourceType": "{{ msg.resourceType }}" } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Utilities/TemplateUtilityTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Utilities/TemplateUtilityTests.cs index a80e6f6f5..2455b311f 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Utilities/TemplateUtilityTests.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Utilities/TemplateUtilityTests.cs @@ -118,5 +118,26 @@ public void GivenInvalidCcdaTemplateContents_WhenParseTemplates_ExceptionsShould exception = Assert.Throws(() => TemplateUtility.ParseTemplates(templates)); Assert.Equal(FhirConverterErrorCode.InvalidCodeMapping, exception.FhirConverterErrorCode); } + + [Fact] + public void GivenInvalidJsonSchemaTemplateContents_WhenParseTemplates_ExceptionsShouldBeThrown() + { + // Invalid schema content + var templates = new Dictionary { { "InvalidSchema.schema.json", @"{""type"": ""InvalidType"" }" } }; + var exception = Assert.Throws(() => TemplateUtility.ParseTemplates(templates)); + Assert.Equal(FhirConverterErrorCode.InvalidJsonSchema, exception.FhirConverterErrorCode); + + // Invalid JSON + templates = new Dictionary { { "InvalidSchema.schema.json", @"{""a""" } }; + exception = Assert.Throws(() => TemplateUtility.ParseTemplates(templates)); + Assert.Equal(FhirConverterErrorCode.InvalidJsonSchema, exception.FhirConverterErrorCode); + + // Null or empty schema + templates = new Dictionary { { "InvalidSchema.schema.json", string.Empty } }; + exception = Assert.Throws(() => TemplateUtility.ParseTemplates(templates)); + + templates = new Dictionary { { "InvalidSchema.schema.json", null} }; + exception = Assert.Throws(() => TemplateUtility.ParseTemplates(templates)); + } } } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/DotLiquids/Validate.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/DotLiquids/Validate.cs index bf7d8c7da..a1df3d512 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/DotLiquids/Validate.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/DotLiquids/Validate.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using DotLiquid; using DotLiquid.Exceptions; @@ -13,7 +14,7 @@ using Microsoft.Health.Fhir.Liquid.Converter.Models.Json; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Newtonsoft.Json.Schema; +using NJsonSchema; using RenderException = Microsoft.Health.Fhir.Liquid.Converter.Exceptions.RenderException; namespace Microsoft.Health.Fhir.Liquid.Converter.DotLiquids @@ -50,7 +51,7 @@ public override void Initialize(string tagName, string markup, List toke public override void Render(Context context, TextWriter result) { - JSchema validateSchema = LoadValidateSchema(context); + JsonSchema validateSchema = LoadValidateSchema(context); if (context is JSchemaContext jSchemaContext) { @@ -76,15 +77,17 @@ public override void Render(Context context, TextWriter result) throw new RenderException(FhirConverterErrorCode.InvalidValidateBlockContent, string.Format(Resources.InvalidValidateContentBlock, ex.Message)); } - if (!validateObject.IsValid(validateSchema, out IList messages)) + var errors = validateSchema.Validate(validateObject); + + if (errors.Any()) { - throw new RenderException(FhirConverterErrorCode.UnmatchedValidateBlockContent, string.Format(Resources.UnMatchedValidateBlockContent, _schemaFileName, string.Join(";", messages))); + throw new RenderException(FhirConverterErrorCode.UnmatchedValidateBlockContent, string.Format(Resources.UnMatchedValidateBlockContent, _schemaFileName, string.Join(";", errors))); } result.Write(validateContent); } - private JSchema LoadValidateSchema(Context context) + private JsonSchema LoadValidateSchema(Context context) { if (!(context.Registers["file_system"] is IFhirConverterTemplateFileSystem fileSystem)) { diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj b/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj index c758bd5e4..dbc41ddca 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Microsoft.Health.Fhir.Liquid.Converter.csproj @@ -13,7 +13,7 @@ - + @@ -28,6 +28,10 @@ + + + + True diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaContext.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaContext.cs index 1cf6b59ef..7b8c55384 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaContext.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaContext.cs @@ -6,7 +6,7 @@ using System; using System.Collections.Generic; using DotLiquid; -using Newtonsoft.Json.Schema; +using NJsonSchema; namespace Microsoft.Health.Fhir.Liquid.Converter.Models.Json { @@ -15,9 +15,9 @@ public class JSchemaContext : Context public JSchemaContext(List environments, Hash outerScope, Hash registers, ErrorsOutputMode errorsOutputMode, int maxIterations, int timeout, IFormatProvider formatProvider) : base(environments, outerScope, registers, errorsOutputMode, maxIterations, timeout, formatProvider) { - ValidateSchemas = new List(); + ValidateSchemas = new List(); } - public List ValidateSchemas { get; set; } + public List ValidateSchemas { get; set; } } } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaDocument.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaDocument.cs index c903bb578..33e3b7710 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaDocument.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaDocument.cs @@ -5,13 +5,13 @@ using System; using DotLiquid; -using Newtonsoft.Json.Schema; +using NJsonSchema; namespace Microsoft.Health.Fhir.Liquid.Converter.Models.Json { public class JSchemaDocument : Document { - public JSchemaDocument(JSchema schema) + public JSchemaDocument(JsonSchema schema) { if (schema == null) { @@ -21,6 +21,6 @@ public JSchemaDocument(JSchema schema) Schema = schema; } - public JSchema Schema { get; set; } + public JsonSchema Schema { get; set; } } } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaTraceInfo.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaTraceInfo.cs index 06ae1d0a3..0cc2f0d3a 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaTraceInfo.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Models/Json/JSchemaTraceInfo.cs @@ -4,7 +4,7 @@ // ------------------------------------------------------------------------------------------------- using System.Collections.Generic; -using Newtonsoft.Json.Schema; +using NJsonSchema; namespace Microsoft.Health.Fhir.Liquid.Converter.Models.Json { @@ -14,11 +14,11 @@ public JSchemaTraceInfo() { } - public JSchemaTraceInfo(List validateSchemas) + public JSchemaTraceInfo(List validateSchemas) { ValidateSchemas = validateSchemas; } - public List ValidateSchemas { get; set; } + public List ValidateSchemas { get; set; } } } diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/JsonProcessor.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/JsonProcessor.cs index cac3f263a..ac3e45401 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/JsonProcessor.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Processors/JsonProcessor.cs @@ -9,7 +9,7 @@ using Microsoft.Health.Fhir.Liquid.Converter.Models; using Microsoft.Health.Fhir.Liquid.Converter.Models.Json; using Microsoft.Health.Fhir.Liquid.Converter.Parsers; -using Newtonsoft.Json.Schema; +using NJsonSchema; namespace Microsoft.Health.Fhir.Liquid.Converter.Processors { @@ -41,7 +41,7 @@ protected override Context CreateContext(ITemplateProvider templateProvider, IDi timeout: timeout, formatProvider: CultureInfo.InvariantCulture) { - ValidateSchemas = new List(), + ValidateSchemas = new List(), }; // Load filters diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter/Utilities/TemplateUtility.cs b/src/Microsoft.Health.Fhir.Liquid.Converter/Utilities/TemplateUtility.cs index 616c0bd30..62b2671ad 100644 --- a/src/Microsoft.Health.Fhir.Liquid.Converter/Utilities/TemplateUtility.cs +++ b/src/Microsoft.Health.Fhir.Liquid.Converter/Utilities/TemplateUtility.cs @@ -6,6 +6,8 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Reflection; using System.Text.RegularExpressions; using DotLiquid; using DotLiquid.Exceptions; @@ -14,7 +16,9 @@ using Microsoft.Health.Fhir.Liquid.Converter.Models; using Microsoft.Health.Fhir.Liquid.Converter.Models.Json; using Newtonsoft.Json; -using Newtonsoft.Json.Schema; +using Newtonsoft.Json.Linq; +using NJsonSchema; +using NJsonSchema.Validation; namespace Microsoft.Health.Fhir.Liquid.Converter.Utilities { @@ -23,6 +27,8 @@ public static class TemplateUtility private static readonly Regex FormatRegex = new Regex(@"(\\|/)_?"); private const string LiquidTemplateFileExtension = ".liquid"; private const string JsonSchemaTemplateFileExtension = ".schema.json"; + private const string MetaJsonSchemaFileName = "meta-schema.json"; + private static readonly JsonSchema MetaJsonSchema; // Register "evaluate" tag in before Template.Parse static TemplateUtility() @@ -30,6 +36,7 @@ static TemplateUtility() Template.RegisterTag("evaluate"); Template.RegisterTag("mergeDiff"); Template.RegisterTag("validate"); + MetaJsonSchema = LoadEmbeddedMetaJsonSchema(); } /// @@ -51,6 +58,7 @@ public static Dictionary ParseTemplates(Dictionary errors; + try + { + var schemaObject = JObject.Parse(content); + errors = MetaJsonSchema.Validate(content); + } + catch (Exception ex) + { + throw new TemplateLoadException(FhirConverterErrorCode.InvalidJsonSchema, string.Format(Resources.InvalidJsonSchemaContent, ex.Message), ex); } - JSchema schema; + if (errors.Any()) + { + throw new TemplateLoadException(FhirConverterErrorCode.InvalidJsonSchema, string.Format(Resources.InvalidJsonSchemaContent, string.Join(";", errors))); + } + + JsonSchema schema; try { - schema = JSchema.Parse(content); + schema = JsonSchema.FromJsonAsync(content).GetAwaiter().GetResult(); } - catch (JSchemaReaderException ex) + catch (Exception ex) { throw new TemplateLoadException(FhirConverterErrorCode.InvalidJsonSchema, string.Format(Resources.InvalidJsonSchemaContent, ex.Message), ex); } @@ -170,5 +195,20 @@ public static bool IsJsonSchemaTemplate(string templateKey) { return templateKey.EndsWith(JsonSchemaTemplateFileExtension, StringComparison.InvariantCultureIgnoreCase); } + + private static JsonSchema LoadEmbeddedMetaJsonSchema() + { + var executingAssembly = Assembly.GetExecutingAssembly(); + var metaSchemaAssemblyName = string.Format("{0}.{1}", executingAssembly.GetName().Name, MetaJsonSchemaFileName); + + string metaSchemaContent; + using (Stream stream = executingAssembly.GetManifestResourceStream(metaSchemaAssemblyName)) + using (StreamReader reader = new StreamReader(stream)) + { + metaSchemaContent = reader.ReadToEnd(); + } + + return JsonSchema.FromJsonAsync(metaSchemaContent).GetAwaiter().GetResult(); + } } } diff --git a/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/TemplateCollectionFunctionalTests.cs b/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/TemplateCollectionFunctionalTests.cs index e61e25969..c910a0156 100644 --- a/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/TemplateCollectionFunctionalTests.cs +++ b/src/Microsoft.Health.Fhir.TemplateManagement.FunctionalTests/TemplateCollectionFunctionalTests.cs @@ -348,8 +348,16 @@ public async Task GiveDefaultImageReference_WhenGetTemplateCollectionWithEmptyTo var templateCollection = await templateCollectionProvider.GetTemplateCollectionAsync(); Assert.Single(templateCollection); - // metadata.json will not be returned as templates. - Assert.Equal(Directory.GetFiles(Path.Join(_templateDirectory, expectedTemplatesFolder), "*", SearchOption.AllDirectories).Length - 1, templateCollection.First().Count()); + // metadata.json will not be returned as template. + // Json/Schema/meta-schema.json will not be returned as template. + var excludeFiles = new HashSet() + { + Path.Join(_templateDirectory, expectedTemplatesFolder, "metadata.json"), + Path.Join(_templateDirectory, expectedTemplatesFolder, "Schema", "meta-schema.json"), + }; + var expectedTemplateFiles = Directory.GetFiles(Path.Join(_templateDirectory, expectedTemplatesFolder), "*", SearchOption.AllDirectories) + .Where(file => !excludeFiles.Contains(file)).ToList(); + Assert.Equal(expectedTemplateFiles.Count, templateCollection.First().Count()); } // Conversion results of DefaultTemplates.tar.gz and default template folder should be the same. From da89df4251254530a6d8554ceaae6bf8fe3b1126 Mon Sep 17 00:00:00 2001 From: QuanWanxx <68055742+QuanWanxx@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:49:38 +0800 Subject: [PATCH 4/4] Update version to 5.0.4 (#418) --- release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.yml b/release.yml index cd4a63ded..22e032fe5 100644 --- a/release.yml +++ b/release.yml @@ -18,7 +18,7 @@ variables: buildConfiguration: 'Release' major: 5 minor: 0 - patch: 3 + patch: 4 buildnum: $[counter(format('{0}.{1}.{2}',variables['major'],variables['minor'], variables['patch']), 1)] version: $(major).$(minor).$(patch).$(buildnum)