Skip to content

Commit

Permalink
feat: add IG version to messaging parameters (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptran265 authored Sep 5, 2024
1 parent b7d9fd8 commit ef133cb
Show file tree
Hide file tree
Showing 22 changed files with 164 additions and 3 deletions.
7 changes: 7 additions & 0 deletions projects/BFDR.Messaging/BFDR.Messaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<Authors>smacadam@mitre.org,rscalfani@mitre.org,pete@mitre.org</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PayloadVersionID>BFDR_STU2_0</PayloadVersionID>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.R4" Version="4.3.0" />
Expand All @@ -22,4 +23,10 @@
<ProjectReference Include="../BFDR/BFDR.csproj" />
<ProjectReference Include="../VitalRecord.Messaging/VitalRecord.Messaging.csproj" />
</ItemGroup>
<Target Name="GenerateCustomPropertyFile" BeforeTargets="BeforeCompile">
<WriteLinesToFile
File="GeneratedCustomProperty.cs"
Lines="/// &lt;summary&gt;Generated file from VRDR.Messaging.csproj&lt;/summary&gt;;public static class GeneratedCustomProperty {;/// &lt;summary&gt;Payload Version Identifier&lt;/summary&gt;;public const string Value = &quot;$(PayloadVersionID)&quot;%3B}"
Overwrite="true" />
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public BirthRecordAcknowledgementMessage(BirthRecordBaseMessage messageToAck) :
this.StateAuxiliaryId = messageToAck?.StateAuxiliaryId;
this.JurisdictionId = messageToAck?.JurisdictionId;
this.BirthYear = messageToAck?.BirthYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";

if(typeof(BirthRecordVoidMessage).IsInstanceOfType(messageToAck))
{
Expand Down
2 changes: 2 additions & 0 deletions projects/BFDR.Messaging/BirthRecordBaseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ protected BirthRecordBaseMessage(String messageType) : base(messageType)
MessageHeader.MessageDestinationComponent dest = new MessageHeader.MessageDestinationComponent();
dest.Endpoint = BirthRecordSubmissionMessage.MESSAGE_TYPE;
Header.Destination.Add(dest);
// Set payload version identifier
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

// TODO: Think about a common approach for extracting business identifiers across VRDR and BFDR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public BirthRecordDemographicsCodingMessage(BirthRecordBaseMessage messageToCode
this.StateAuxiliaryId = messageToCode?.StateAuxiliaryId;
this.JurisdictionId = messageToCode?.JurisdictionId;
this.BirthYear = messageToCode?.BirthYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>Constructor that creates a BirthRecordDemographicsCodingMessage for the specified message.</summary>
Expand Down
1 change: 1 addition & 0 deletions projects/BFDR.Messaging/BirthRecordErrorMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public BirthRecordErrorMessage(BirthRecordBaseMessage sourceMessage) : this(sour
this.StateAuxiliaryId = sourceMessage?.StateAuxiliaryId;
this.JurisdictionId = sourceMessage?.JurisdictionId;
this.BirthYear = sourceMessage?.BirthYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>
Expand Down
1 change: 1 addition & 0 deletions projects/BFDR.Messaging/BirthRecordStatusMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public BirthRecordStatusMessage(BirthRecordBaseMessage messageToStatus, string s
this.StateAuxiliaryId = messageToStatus?.StateAuxiliaryId;
this.JurisdictionId = messageToStatus?.JurisdictionId;
this.BirthYear = messageToStatus?.BirthYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

// TODO: The allowed status values will be different for birth
Expand Down
4 changes: 4 additions & 0 deletions projects/BFDR.Messaging/GeneratedCustomProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// <summary>Generated file from VRDR.Messaging.csproj</summary>
public static class GeneratedCustomProperty {
/// <summary>Payload Version Identifier</summary>
public const string Value = "BFDR_STU2_0";}
30 changes: 30 additions & 0 deletions projects/BFDR.Tests/Messaging_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void CreateEmptySubmission()
Assert.Null(submission.CertNo);
Assert.Null(submission.StateAuxiliaryId);
Assert.Null(submission.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -46,6 +47,7 @@ public void CreateSubmissionFromBirthRecord()
Assert.Equal("444455555", submission.StateAuxiliaryId);
Assert.Equal("2019UT015075", submission.NCHSIdentifier);
Assert.Equal(2019, submission.BirthRecord.BirthYear);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);

// Test with null record
submission = new BirthRecordSubmissionMessage(null);
Expand All @@ -54,6 +56,7 @@ public void CreateSubmissionFromBirthRecord()
Assert.Null(submission.CertNo);
Assert.Null(submission.StateAuxiliaryId);
Assert.Null(submission.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -67,6 +70,7 @@ public void LoadSubmissionFromJSON()
Assert.Equal("000000000042", submission.StateAuxiliaryId);
Assert.Equal(submission.JurisdictionId, submission.BirthRecord.BirthLocationJurisdiction);
Assert.Equal(2019, submission.BirthRecord.BirthYear);
Assert.Null(submission.PayloadVersionId);
}

[Fact]
Expand All @@ -82,6 +86,7 @@ public void CreateEmptyUpdate()
Assert.Null(submission.CertNo);
Assert.Null(submission.StateAuxiliaryId);
Assert.Null(submission.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -96,6 +101,7 @@ public void CreateUpdateFromBirthRecord()
Assert.Equal("444455555", submission.StateAuxiliaryId);
Assert.Equal("2019UT015075", submission.NCHSIdentifier);
Assert.Equal(2019, submission.BirthRecord.BirthYear);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);

// Test with null record
submission = new BirthRecordUpdateMessage(null);
Expand All @@ -104,6 +110,7 @@ public void CreateUpdateFromBirthRecord()
Assert.Null(submission.CertNo);
Assert.Null(submission.StateAuxiliaryId);
Assert.Null(submission.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -117,6 +124,7 @@ public void LoadUpdateFromJSON()
Assert.Equal("000000000042", submission.StateAuxiliaryId);
Assert.Equal(submission.JurisdictionId, submission.BirthRecord.BirthLocationJurisdiction);
Assert.Equal(2019, submission.BirthRecord.BirthYear);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -133,6 +141,7 @@ public void CreateMultipleDestinationsMessage()
submission.MessageDestination = destinationsString2;
Assert.Equal(destinationsArray2, submission.MessageDestinations);
Assert.Equal(destinationsString2, submission.MessageDestination);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -147,6 +156,7 @@ public void CreateAckForMessage()
Assert.Equal(submission.StateAuxiliaryId, ack.StateAuxiliaryId);
Assert.Equal(submission.CertNo, ack.CertNo);
Assert.Equal(submission.NCHSIdentifier, ack.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", submission.PayloadVersionId);
}

[Fact]
Expand All @@ -160,6 +170,7 @@ public void LoadAckFromJSON()
Assert.Equal((uint)48858, ack.CertNo);
Assert.Equal((uint)2019, ack.BirthYear);
Assert.Equal("000000000042", ack.StateAuxiliaryId);
Assert.Null(ack.PayloadVersionId);
}

[Fact]
Expand All @@ -185,6 +196,7 @@ public void CreateBirthRecordVoidMessage()
Assert.Equal((uint)100, message.BlockCount);
message.BlockCount = 0;
Assert.Equal((uint)0, message.BlockCount);
Assert.Equal("BFDR_STU2_0", message.PayloadVersionId);
}

[Fact]
Expand All @@ -198,6 +210,9 @@ public void LoadBirthRecordVoidMessageFromJson()
Assert.Equal("2019UT048858", message.NCHSIdentifier);
Assert.Equal("http://nchs.cdc.gov/bfdr_submission", message.MessageDestination);
Assert.Equal("http://mitre.org/bfdr", message.MessageSource);
Assert.Null(message.PayloadVersionId);
message.PayloadVersionId = "BFDR_STU2_0";
Assert.Equal("BFDR_STU2_0", message.PayloadVersionId);
}

[Fact]
Expand All @@ -213,6 +228,8 @@ public void CreateAckForBirthRecordVoidMessage()
Assert.Equal(voidMessage.CertNo, ack.CertNo);
Assert.Equal(voidMessage.NCHSIdentifier, ack.NCHSIdentifier);
Assert.Equal(voidMessage.BlockCount, ack.BlockCount);
Assert.Null(voidMessage.PayloadVersionId);
Assert.Equal("BFDR_STU2_0", ack.PayloadVersionId);
}

[Fact]
Expand All @@ -228,6 +245,8 @@ public void CreateStatusMessage()
Assert.Equal(submission.StateAuxiliaryId, status.StateAuxiliaryId);
Assert.Equal(submission.CertNo, status.CertNo);
Assert.Equal(submission.NCHSIdentifier, status.NCHSIdentifier);
Assert.Equal(submission.PayloadVersionId, status.PayloadVersionId);
Assert.Equal("BFDR_STU2_0", status.PayloadVersionId);
}

[Fact]
Expand All @@ -242,6 +261,8 @@ public void CreateAckForStatusMessage()
Assert.Equal(statusMessage.StateAuxiliaryId, ack.StateAuxiliaryId);
Assert.Equal(statusMessage.CertNo, ack.CertNo);
Assert.Equal(statusMessage.NCHSIdentifier, ack.NCHSIdentifier);
Assert.Null(statusMessage.PayloadVersionId);
Assert.Equal("BFDR_STU2_0", ack.PayloadVersionId);
}

[Fact]
Expand All @@ -255,6 +276,8 @@ public void CreateExtractionErrorForMessage()
Assert.Equal(submission.StateAuxiliaryId, err.StateAuxiliaryId);
Assert.Equal(submission.CertNo, err.CertNo);
Assert.Equal(submission.NCHSIdentifier, err.NCHSIdentifier);
Assert.Null(submission.PayloadVersionId);
Assert.Equal("BFDR_STU2_0", err.PayloadVersionId);
Assert.Empty(err.Issues);
var issues = new List<Issue>();
var issue = new Issue(OperationOutcome.IssueSeverity.Fatal, OperationOutcome.IssueType.Invalid, "The message was invalid");
Expand All @@ -280,6 +303,7 @@ public void LoadExtractionErrorFromJson()
Assert.Equal((uint)1, err.CertNo);
Assert.Equal("42", err.StateAuxiliaryId);
Assert.Equal("2018MA000001", err.NCHSIdentifier);
Assert.Null(err.PayloadVersionId);
var issues = err.Issues;
Assert.Equal(2, (int)issues.Count);
Assert.Equal(OperationOutcome.IssueSeverity.Fatal, issues[0].Severity);
Expand All @@ -303,6 +327,8 @@ public void CreateDemographicForMessage()
Assert.Equal(submission.StateAuxiliaryId, coding.StateAuxiliaryId);
Assert.Equal(submission.CertNo, coding.CertNo);
Assert.Equal(submission.NCHSIdentifier, coding.NCHSIdentifier);
Assert.Null(submission.PayloadVersionId);
Assert.Equal("BFDR_STU2_0", coding.PayloadVersionId);
}

[Fact]
Expand All @@ -315,6 +341,7 @@ public void CreateDemographicCodingResponseFromJSON()
Assert.Equal((uint)2023, message.BirthYear);
Assert.Equal("123", message.StateAuxiliaryId);
Assert.Equal("2023YC000100", message.NCHSIdentifier);
Assert.Null(message.PayloadVersionId);
// TODO: Check demographic coding fields once implemented
}

Expand All @@ -328,6 +355,7 @@ public void CreateDemographicsCodingUpdateFromJSON()
Assert.Equal((uint)2023, message.BirthYear);
Assert.Equal("123", message.StateAuxiliaryId);
Assert.Equal("2023YC000100", message.NCHSIdentifier);
Assert.Null(message.PayloadVersionId);
// TODO: Check demographic coding fields once implemented
}

Expand All @@ -349,6 +377,7 @@ public void CreateDemographicCodingResponse()
Assert.Equal((uint)123, message.CertNo);
Assert.Equal((uint)2022, message.BirthYear);
Assert.Equal("2022YC000123", message.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", message.PayloadVersionId);
// TODO: Check demographic coding fields once implemented
}

Expand All @@ -370,6 +399,7 @@ public void CreateDemographicCodingUpdate()
Assert.Equal((uint)123, message.CertNo);
Assert.Equal((uint)2022, message.BirthYear);
Assert.Equal("2022YC000123", message.NCHSIdentifier);
Assert.Equal("BFDR_STU2_0", message.PayloadVersionId);
// TODO: Check demographic coding fields once implemented
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
{
"name": "jurisdiction_id",
"valueString": "UT"
},
{
"name": "payload_version_id",
"valueString": "BFDR_STU2_0"
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions projects/BFDR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Interactions with NCHS are governed by the CI build version of the BFDR and Birt
</tr>
</tr>
<tr>
<td style="text-align: center;"><a href="https://build.fhir.org/ig/HL7/fhir-bfdr/branches/master/index.html">STU2.0 CI build version</a></td>
<td style="text-align: center;"><a href="https://build.fhir.org/ig/nightingaleproject/vital_records_fhir_messaging_ig/">v1.1.0-ci-build</a></td>
<td style="text-align: center;"><a href="https://build.fhir.org/ig/HL7/fhir-bfdr/branches/v2.0.0-preview3/ije_mapping_natality.html">STU2.0 v2.0.0-preview3</a></td>
<td style="text-align: center;"><a href="https://nightingaleproject.github.io/vital_records_fhir_messaging_ig/v2.0.0-preview1/index.html">v2.0.0-preview1</a></td>
<td style="text-align: center;">R4</td>
<td style="text-align: center;">V4.0.3</td>
<td style="text-align: center;"><a href="">nuget</a> <a href=""> github</a></td>
Expand Down Expand Up @@ -432,6 +432,7 @@ With each commit to the default branch, a release pull request will be automatic
To create a new release of BFDR on NuGet:

1. Bump the version of the libraries listed in the [Directory.Build.props](Directory.Build.props) file. Whenever a commit is merged into the master branch that changes the Directory.Build.props file, [Github Actions](.github/workflows/publish.yml) will automatically build and publish a new version of the package based on the value specified.
1. Update the PayloadVersionID in BFDR.Messaging.csproj to match the IG version implemented by the library. See [Payload Version Identifier Values](https://nightingaleproject.github.io/vital_records_fhir_messaging_ig/v2.0.0-preview1/ValueSet-Payload-version-vs.html)
1. Update the version numbers listed in this README
1. Update the CHANGELOG.md file with information on what is changing in the release
1. Merge the above changes to master, causing the GitHub publishing workflow to fire
Expand Down
1 change: 1 addition & 0 deletions projects/VRDR.Messaging/AcknowledgementMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public AcknowledgementMessage(BaseMessage messageToAck) : this(messageToAck?.Mes
this.StateAuxiliaryId = messageToAck?.StateAuxiliaryId;
this.JurisdictionId = messageToAck?.JurisdictionId;
this.DeathYear = messageToAck?.DeathYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";

if(typeof(DeathRecordVoidMessage).IsInstanceOfType(messageToAck))
{
Expand Down
6 changes: 6 additions & 0 deletions projects/VRDR.Messaging/BaseMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,17 @@ protected BaseMessage(Bundle messageBundle, bool ignoreMissingEntries = false, b
Record = findEntry<Parameters>(ignoreMissingEntries);
}

/// <summary>
/// Constructor that creates a baseMessage for the specified message type.
/// </summary>
/// <param name="messageType">string specifying type of message</param>
protected BaseMessage(String messageType) : base(messageType)
{
MessageHeader.MessageDestinationComponent dest = new MessageHeader.MessageDestinationComponent();
dest.Endpoint = DeathRecordSubmissionMessage.MESSAGE_TYPE;
Header.Destination.Add(dest);
// Set payload version identifier
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

// TODO: Think about a common approach for extracting business identifiers across VRDR and BFDR
Expand Down
1 change: 1 addition & 0 deletions projects/VRDR.Messaging/CauseOfDeathCodingMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public CauseOfDeathCodingMessage(BaseMessage messageToCode) : this(messageToCode
this.StateAuxiliaryId = messageToCode?.StateAuxiliaryId;
this.JurisdictionId = messageToCode?.JurisdictionId;
this.DeathYear = messageToCode?.DeathYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>Constructor that creates a CauseOfDeathCoding message for the specified message.</summary>
Expand Down
1 change: 1 addition & 0 deletions projects/VRDR.Messaging/DemographicsCodingMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public DemographicsCodingMessage(BaseMessage messageToCode) : this(messageToCode
this.StateAuxiliaryId = messageToCode?.StateAuxiliaryId;
this.JurisdictionId = messageToCode?.JurisdictionId;
this.DeathYear = messageToCode?.DeathYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>Constructor that creates a DemographicsCodingMessage for the specified message.</summary>
Expand Down
1 change: 1 addition & 0 deletions projects/VRDR.Messaging/ErrorMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public ExtractionErrorMessage(BaseMessage sourceMessage) : this(sourceMessage?.M
this.StateAuxiliaryId = sourceMessage?.StateAuxiliaryId;
this.JurisdictionId = sourceMessage?.JurisdictionId;
this.DeathYear = sourceMessage?.DeathYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions projects/VRDR.Messaging/GeneratedCustomProperty.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/// <summary>Generated file from VRDR.Messaging.csproj</summary>
public static class GeneratedCustomProperty {
/// <summary>Payload Version Identifier</summary>
public const string Value = "VRDR_STU3_0";}
1 change: 1 addition & 0 deletions projects/VRDR.Messaging/StatusMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public StatusMessage(BaseMessage messageToStatus, string status) : this(messageT
this.StateAuxiliaryId = messageToStatus?.StateAuxiliaryId;
this.JurisdictionId = messageToStatus?.JurisdictionId;
this.DeathYear = messageToStatus?.DeathYear;
this.PayloadVersionId = $"{GeneratedCustomProperty.Value}";
}

/// <summary>Constructor that creates a status message for the specified message.</summary>
Expand Down
9 changes: 8 additions & 1 deletion projects/VRDR.Messaging/VRDR.Messaging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>VRDR</RootNamespace>
<Version>5.0.0</Version>
<Version>5.0.0-preview.1</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageId>VRDR.Messaging</PackageId>
<Title>FHIR VRDR Death Record Messaging</Title>
<PackageDescription>A library for supporting FHIR messaging for VRDR FHIR death records.</PackageDescription>
<Authors>aholmes@mitre.org</Authors>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PayloadVersionID>VRDR_STU3_0</PayloadVersionID>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Hl7.Fhir.R4" Version="4.3.0" />
Expand All @@ -18,4 +19,10 @@
<ProjectReference Include="..\VRDR\VRDR.csproj" />
<ProjectReference Include="..\VitalRecord.Messaging\VitalRecord.Messaging.csproj" />
</ItemGroup>
<Target Name="GenerateCustomPropertyFile" BeforeTargets="BeforeCompile">
<WriteLinesToFile
File="GeneratedCustomProperty.cs"
Lines="/// &lt;summary&gt;Generated file from VRDR.Messaging.csproj&lt;/summary&gt;;public static class GeneratedCustomProperty {;/// &lt;summary&gt;Payload Version Identifier&lt;/summary&gt;;public const string Value = &quot;$(PayloadVersionID)&quot;%3B}"
Overwrite="true" />
</Target>
</Project>
Loading

0 comments on commit ef133cb

Please sign in to comment.