-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe75aa0
commit 0adb57e
Showing
14 changed files
with
631 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/CdaExtractor/Extractor/ImmunisationRegisterExtractor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Xml; | ||
using Nehta.VendorLibrary.CdaExtractor.Model; | ||
|
||
namespace Nehta.VendorLibrary.CdaExtractor.Extractor | ||
{ | ||
public class ImmunisationRegisterExtractor : ICdaExtractor<List<ImmunisationRegister>> | ||
{ | ||
private readonly IDictionary<string, string> _documentXPaths; | ||
|
||
public ImmunisationRegisterExtractor(IDictionary<string, string> documentXPaths) | ||
{ | ||
_documentXPaths = documentXPaths; | ||
} | ||
|
||
public List<ImmunisationRegister> Extract(CdaXmlDocument document) | ||
{ | ||
var nodes = document.SelectNodes(_documentXPaths.Get("ImmunisationRegister")); | ||
if(nodes == null || nodes.Count == 0) return null; | ||
|
||
return | ||
(from XmlNode node in nodes | ||
select new ImmunisationRegister | ||
{ | ||
DateTime = document.GetDateTimeValue(node, _documentXPaths.Get("ImmunisationDateTime")), | ||
Immunisation = document.GetRelativeCode(node, _documentXPaths.Get("Immunisation")), | ||
BrandName = document.GetRelativeCode(node, _documentXPaths.Get("BrandName")) | ||
} | ||
).ToList(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Xml; | ||
using Nehta.VendorLibrary.CdaExtractor.Model; | ||
|
||
namespace Nehta.VendorLibrary.CdaExtractor.Extractor | ||
{ | ||
public class PsmlExtractor : ICdaExtractor<Psml> | ||
{ | ||
private readonly IDictionary<string, string> _documentXPaths; | ||
|
||
public PsmlExtractor(IDictionary<string, string> documentXPaths) | ||
{ | ||
_documentXPaths = documentXPaths; | ||
} | ||
|
||
public Psml Extract(CdaXmlDocument cdaDocument) | ||
{ | ||
var psml = new Psml(); | ||
|
||
var attachmentNode = cdaDocument.SelectSingleNode(_documentXPaths.Get("Attachment")); | ||
|
||
if (attachmentNode != null) | ||
{ | ||
var attachmentIntegrityCheck = cdaDocument.SelectSingleNode(attachmentNode, _documentXPaths.Get("AttachmentIntegrityCheck")); | ||
if (attachmentIntegrityCheck != null) psml.ReportIntegrityCheck = attachmentIntegrityCheck.Value; | ||
|
||
var attachmentMediaType = cdaDocument.SelectSingleNode(attachmentNode, _documentXPaths.Get("AttachmentMediaType")); | ||
if (attachmentMediaType != null) psml.ReportMediaType = attachmentMediaType.Value; | ||
|
||
var attachmentName = cdaDocument.SelectSingleNode(attachmentNode, _documentXPaths.Get("AttachmentName")); | ||
if (attachmentName != null) psml.ReportDocName = attachmentName.Value; | ||
} | ||
|
||
return psml; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using System; | ||
|
||
namespace Nehta.VendorLibrary.CdaExtractor.Model | ||
{ | ||
public class ImmunisationRegister | ||
{ | ||
public DateTime? DateTime { get; set; } | ||
public CodableText Immunisation { get; set; } | ||
public CodableText BrandName { get; set; } | ||
} | ||
} |
Oops, something went wrong.