Skip to content

Commit ca01007

Browse files
committed
HIP | Zafar, Veena | Unmasks patient reference number and care context reference for further processing
- Adds a utility class to mask and unmask references
1 parent ced3f79 commit ca01007

File tree

20 files changed

+187
-108
lines changed

20 files changed

+187
-108
lines changed

src/In.ProjectEKA.DefaultHip/Link/PatientRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public Option<Patient> PatientWith(string referenceNumber)
3030
return Option.None<Patient>();
3131
}
3232
}
33-
33+
3434
private IEnumerable<Patient> All()
3535
{
3636
var patientsInfo = FileReader.ReadJson(filePath);

src/In.ProjectEKA.HipLibrary/Patient/Model/CareContextEnquiry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace In.ProjectEKA.HipLibrary.Patient.Model
22
{
33
public class CareContextEnquiry
44
{
5-
public string ReferenceNumber { get; }
5+
public string ReferenceNumber { get; set; }
66

77
public CareContextEnquiry(string referenceNumber)
88
{

src/In.ProjectEKA.HipLibrary/Patient/Model/CareContextRepresentation.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ namespace In.ProjectEKA.HipLibrary.Patient.Model
22
{
33
public class CareContextRepresentation
44
{
5-
public string ReferenceNumber { get; }
5+
public string ReferenceNumber { get; set; }
66

7-
public string Display { get; }
7+
public string Display { get; set; }
88

99
public CareContextRepresentation(string referenceNumber, string display)
1010
{

src/In.ProjectEKA.HipLibrary/Patient/Model/LinkConfirmationRepresentation.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
namespace In.ProjectEKA.HipLibrary.Patient.Model
22
{
33
using System.Collections.Generic;
4-
using System.Text.Json.Serialization;
5-
using System.Xml.Serialization;
64

75
public class LinkConfirmationRepresentation
86
{

src/In.ProjectEKA.HipLibrary/Patient/Model/Patient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace In.ProjectEKA.HipLibrary.Patient.Model
55
public class Patient
66
{
77
public string Identifier { get; set; }
8-
8+
99
public Gender Gender { get; set; }
1010

1111
public string PhoneNumber { get; set; }

src/In.ProjectEKA.HipLibrary/Patient/Model/PatientEnquiryRepresentation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ namespace In.ProjectEKA.HipLibrary.Patient.Model
44

55
public class PatientEnquiryRepresentation
66
{
7-
public string ReferenceNumber { get; }
7+
public string ReferenceNumber { get; set; }
88

99
public string Display { get; }
1010

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Linq;
2+
using In.ProjectEKA.HipLibrary.Patient.Model;
3+
4+
namespace In.ProjectEKA.HipService.Common
5+
{
6+
public static class MaskingUtility
7+
{
8+
public static PatientEnquiryRepresentation GetMaskedPatientEnquiryRepresentation(
9+
PatientEnquiryRepresentation patient)
10+
{
11+
patient.ReferenceNumber = new string(patient.ReferenceNumber.ToCharArray().Reverse().ToArray());
12+
foreach (var careContextRepresentation in patient.CareContexts.AsEnumerable())
13+
{
14+
careContextRepresentation.ReferenceNumber =
15+
new string(careContextRepresentation.ReferenceNumber.ToCharArray().Reverse().ToArray());
16+
}
17+
18+
return patient;
19+
}
20+
21+
public static string GetMaskedPatientReference(string patientReference)
22+
{
23+
return new string(patientReference.ToCharArray().Reverse().ToArray());
24+
}
25+
26+
public static LinkEnquiry GetUnmaskedLinkEnquiry(LinkEnquiry linkEnquiry)
27+
{
28+
foreach (var careContextEnquiry in linkEnquiry.CareContexts)
29+
{
30+
careContextEnquiry.ReferenceNumber =
31+
new string(careContextEnquiry.ReferenceNumber.ToCharArray().Reverse().ToArray());
32+
}
33+
34+
return linkEnquiry;
35+
}
36+
}
37+
}

src/In.ProjectEKA.HipService/Discovery/Database/Migrations/DiscoveryContextModelSnapshot.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
1616
#pragma warning disable 612, 618
1717
modelBuilder
1818
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn)
19-
.HasAnnotation("ProductVersion", "3.1.4")
19+
.HasAnnotation("ProductVersion", "3.1.5")
2020
.HasAnnotation("Relational:MaxIdentifierLength", 63);
2121

2222
modelBuilder.Entity("In.ProjectEKA.HipService.Discovery.Model.DiscoveryRequest", b =>

src/In.ProjectEKA.HipService/Discovery/DiscoveryRequestRepository.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using System.Linq;
2+
13
namespace In.ProjectEKA.HipService.Discovery
24
{
35
using System.Threading.Tasks;
@@ -46,5 +48,11 @@ public Task<bool> RequestExistsFor(string requestId)
4648
return discoveryContext.DiscoveryRequest
4749
.AnyAsync(request => request.TransactionId == requestId);
4850
}
51+
52+
public async Task<DiscoveryRequest> GetRequestFor(string transactionId)
53+
{
54+
return await discoveryContext.DiscoveryRequest
55+
.FirstOrDefaultAsync(request => request.TransactionId == transactionId);
56+
}
4957
}
5058
}

src/In.ProjectEKA.HipService/Discovery/IDiscoveryRequestRepository.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,7 @@ public interface IDiscoveryRequestRepository
1212
Task<bool> RequestExistsFor(string requestId, string consentManagerUserId, string patientReferenceNumber);
1313

1414
Task<bool> RequestExistsFor(string requestId);
15+
16+
Task<DiscoveryRequest> GetRequestFor(string requestTransactionId);
1517
}
1618
}

0 commit comments

Comments
 (0)