Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unmask story #306

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Unmask story #306

wants to merge 15 commits into from

Conversation

Veena-tw
Copy link
Contributor

@Veena-tw Veena-tw commented Jul 7, 2020

  • Unmasks masked reference number to further process discovery and linking of the requests
  • Masks PII related information like name, mobile number, etc

@Veena-tw Veena-tw requested a review from a team as a code owner July 7, 2020 04:36
Comment on lines 143 to 133
"careContexts": [
{
"referenceNumber": "NCP1112",
"maskedReferenceNumber": "NCPXXXX",
"display": "National Cancer program"
},
{
"referenceNumber": "NCP11122",
"maskedReferenceNumber": "NCPXXXXX",
"display": "National Cancer program - Episode 2"
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep these masked in a different file to not pollute the patients.json.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved the mapping to maskedReferences.json and removed from demoPatients.json

@@ -12,5 +12,6 @@ public interface IDiscoveryRequestRepository
Task<bool> RequestExistsFor(string requestId, string consentManagerUserId, string patientReferenceNumber);

Task<bool> RequestExistsFor(string requestId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Task<bool> RequestExistsFor(string requestId);
Task<bool> RequestExistsFor(string requestId);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -20,12 +20,21 @@ public class DiscoveryRequest
public DateTime Timestamp { get; set; }

[Required, MaxLength(50)] public string PatientReferenceNumber { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[Required, MaxLength(50)] public string PatientReferenceNumber { get; set; }
[Required, MaxLength(50)] public string PatientReferenceNumber { get; set; }

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines -39 to +40
new ErrorRepresentation(new Error(ErrorCode.DuplicateDiscoveryRequest, "Discovery Request already exists")));
new ErrorRepresentation(new Error(ErrorCode.DuplicateDiscoveryRequest,
"Discovery Request already exists")));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember you mentioning in another PR that line should not exceed some 80 columns

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

120's the default column limit. I might have said 80/something whatever is default.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is at 120.

Comment on lines 67 to 68
if (!careContextRepresentations.Any() &&
!addToUnlinkedAccounts)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!careContextRepresentations.Any() &&
!addToUnlinkedAccounts)
if (!careContextRepresentations.Any() && !addToUnlinkedAccounts)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified this.

"Unable to update unlinked care contexts")));
}

patient.Identifier = patient.MaskedIdentifier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mutating this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the discovery response, masked patient identifier is sent back

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as what I gave for zafar.

"Unable to update unlinked care contexts")));
}

patient.Identifier = patient.MaskedIdentifier;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mutating this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the time of adding it into a DiscoveryRequest table these are two different fields, but at the time of returning output to CM as response we are only passing reference number and display, so we need to replace line 75 to show that on output
Screenshot 2020-07-09 at 10 53 22 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand the what you are doing, my question is why mutation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah we supposed to keep CM untouched, since they are reading and returning final response from CM, and they are returning reference field not a masked even, they don't even bother about it.

Comment on lines 119 to 88
private bool AddToUnlinkedAccounts(IEnumerable<CareContextRepresentation> careContexts,
string patientReferenceNumber)
{
return linkPatientRepository.SaveUnlinkedAccounts(careContexts, patientReferenceNumber).Result;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the way we are storing masked patient reference number in the discovery request, we are storing the masked carecontext reference numbers of the patient in the table called UnlinkedAccounts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? lets get on a call.

if (e != null)
{
Log.Error(e);
//TODO: Handle exception - Zafar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both are not pairing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are :). One name was enough to track.

@Veena-tw Veena-tw force-pushed the unmask_story branch 2 times, most recently from b88a640 to ca01007 Compare July 14, 2020 04:42
Veena-tw and others added 2 commits July 16, 2020 18:20
…t reference for further processing

- Adds a utility class to mask and unmask references
Comment on lines 4 to 17
using System;
using System.Threading.Tasks;
using Discovery;
using Gateway;
using Gateway.Model;
using Hangfire;
using HipLibrary.Patient.Model;
using Logger;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
using static Common.Constants;
using static Constants;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not supposed to be changed. using inside is the convention.

Comment on lines 219 to 246
<ItemGroup>
<Content Include="Resources\NCP1007DiagnosticReportDocument.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<Link>NCP1007DiagnosticReportDocument.json</Link>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\NCP1007PrescriptionDocument1.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<Link>NCP1007PrescriptionDocument1.json</Link>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\NCP1007PrescriptionDocument2.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<Link>NCP1007PrescriptionDocument2.json</Link>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\NCP1007PrescriptionDocument3.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
<Link>NCP1007PrescriptionDocument3.json</Link>
</Content>
</ItemGroup>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it required?

Veena-tw and others added 8 commits July 28, 2020 11:31
…t reference for further processing

- Adds a utility class to mask and unmask references
…t reference for further processing

- Adds a utility class to mask and unmask references
…t reference for further processing

- Adds masking of PII information
 into unmask_story

# Conflicts:
#	src/In.ProjectEKA.HipService/Link/LinkController.cs
Copy link
Contributor

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- src/In.ProjectEKA.DefaultHip/Patient/MaskingUtility.cs  3
         

Clones added
============
- test/In.ProjectEKA.HipServiceTest/Discovery/PatientDiscoveryTest.cs  4
         

Clones removed
==============
+ src/In.ProjectEKA.HipService/Discovery/Database/Migrations/DiscoveryContextModelSnapshot.cs  -1
         

See the complete overview on Codacy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants