diff --git a/data/Templates/eCR/DataType/_Address.liquid b/data/Templates/eCR/DataType/_Address.liquid
index 587ae4eb..72bcac36 100644
--- a/data/Templates/eCR/DataType/_Address.liquid
+++ b/data/Templates/eCR/DataType/_Address.liquid
@@ -1,16 +1,16 @@
{% assign lines = Address.streetAddressLine | to_array -%}
{% if lines.first._ or Address.city._ or Address.state._ or Address.country._ or Address.postalCode._ or Address.county._ -%}
"use": "{{ Address.use | get_property: 'ValueSet/AddressUse' }}",
-
"line": [
- {% assign lines = Address.streetAddressLine | to_array -%}
- {% for l in lines -%}
+ {%- assign lines = Address.streetAddressLine | to_array -%}
+ {%- for l in lines -%}
"{{l._}}",
- {% endfor -%}
+ {%- endfor -%}
],
"city": "{{Address.city._}}",
"state": "{{Address.state._}}",
"country": "{{Address.country._}}",
"postalCode": "{{Address.postalCode._}}",
"district": "{{Address.county._}}",
-{% endif -%}
\ No newline at end of file
+ "period": { {% include 'DataType/Period' Period: Address.useablePeriod %} },
+{% endif -%}
diff --git a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Templates/eCR/BaseECRLiquidTests.cs b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Templates/eCR/BaseECRLiquidTests.cs
index 91e18c80..bb2a8689 100644
--- a/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Templates/eCR/BaseECRLiquidTests.cs
+++ b/src/Microsoft.Health.Fhir.Liquid.Converter.UnitTests/Templates/eCR/BaseECRLiquidTests.cs
@@ -11,14 +11,16 @@
namespace Microsoft.Health.Fhir.Liquid.Converter.UnitTests
{
- public class BaseConvertLiquidTemplate
+ public class BaseECRLiquidTests
{
-
///
/// Given a path to an eCR template, and attributes. Check that the rendered template
/// matches the expected contents.
///
- protected void ConvertCheckLiquidTemplate(string templatePath, Dictionary attributes, string expectedContent)
+ /// Path to the template being tested
+ /// Dictionary of attributes to hydrate the template
+ /// Serialized string that ought to be returned
+ protected static void ConvertCheckLiquidTemplate(string templatePath, Dictionary attributes, string expectedContent)
{
var templateContent = File.ReadAllText(templatePath);
var template = TemplateUtility.ParseLiquidTemplate(templatePath, templateContent);
@@ -53,7 +55,8 @@ protected void ConvertCheckLiquidTemplate(string templatePath, Dictionary(), string.Empty);
+ }
+
+ [Fact]
+ public void GivenSingleStreetAddresReturnsLines()
+ {
+ var attributes = new Dictionary{
+ {"Address", Hash.FromAnonymousObject(new { streetAddressLine = new { _ = "132 Main St" }})}
+ };
+ ConvertCheckLiquidTemplate(
+ ECRPath,
+ attributes,
+ @"""use"": """", ""line"": [ ""132 Main St"", ], ""city"": """", ""state"": """", ""country"": """", ""postalCode"": """", ""district"": """", ""period"": { ""start"":"""", ""end"":"""", },");
+ }
+
+ [Fact]
+ public void GivenArrayStreetAddresReturnsLines()
+ {
+ var attributes = new Dictionary{
+ {"Address", Hash.FromAnonymousObject(new { streetAddressLine = new List