Skip to content

Commit

Permalink
chore: Remove phone number uniqueness check when registering patients
Browse files Browse the repository at this point in the history
  • Loading branch information
st3v3nmw committed Jul 5, 2023
1 parent 54b7673 commit 170303e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 86 deletions.
10 changes: 0 additions & 10 deletions pkg/clinical/usecases/clinical/patient.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,16 +375,6 @@ func (c *UseCasesClinicalImpl) CreatePatient(ctx context.Context, input dto.Pati
IdentificationDocuments: documents,
}

exists, err := c.CheckPatientExistenceUsingPhoneNumber(ctx, registrationInput)
if err != nil {
utils.ReportErrorToSentry(err)
return nil, fmt.Errorf("unable to check patient existence: %w", err)
}

if exists {
return nil, fmt.Errorf("patient with phone number already exists")
}

patientInput, err := c.SimplePatientRegistrationInputToPatientInput(ctx, registrationInput)
if err != nil {
return nil, err
Expand Down
76 changes: 0 additions & 76 deletions pkg/clinical/usecases/clinical/patient_unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1548,64 +1548,6 @@ func TestUseCasesClinicalImpl_CreatePatient(t *testing.T) {
},
wantErr: false,
},
{
name: "sad case: patient already exists",
args: args{
ctx: addTenantIdentifierContext(context.Background()),
input: dto.PatientInput{
FirstName: gofakeit.Name(),
LastName: gofakeit.Name(),
BirthDate: scalarutils.Date{
Year: 1997,
Month: 12,
Day: 12,
},
Gender: dto.GenderFemale,
Identifiers: []dto.IdentifierInput{
{
Type: dto.IdentifierTypeNationalID,
Value: "12345678",
},
},
Contacts: []dto.ContactInput{
{
Type: dto.ContactTypePhoneNumber,
Value: "0700000000",
},
},
},
},
wantErr: true,
},
{
name: "sad case: error searching for patient",
args: args{
ctx: addTenantIdentifierContext(context.Background()),
input: dto.PatientInput{
FirstName: gofakeit.Name(),
LastName: gofakeit.Name(),
BirthDate: scalarutils.Date{
Year: 1997,
Month: 12,
Day: 12,
},
Gender: dto.GenderFemale,
Identifiers: []dto.IdentifierInput{
{
Type: dto.IdentifierTypeNationalID,
Value: "12345678",
},
},
Contacts: []dto.ContactInput{
{
Type: dto.ContactTypePhoneNumber,
Value: "0700000000",
},
},
},
},
wantErr: true,
},
{
name: "sad case: invalid phone number",
args: args{
Expand Down Expand Up @@ -1764,24 +1706,6 @@ func TestUseCasesClinicalImpl_CreatePatient(t *testing.T) {
infra := infrastructure.NewInfrastructureInteractor(fakeExt, fakeFHIR, fakeOCL, fakeUpload, fakePubSub)
c := clinicalUsecase.NewUseCasesClinicalImpl(infra)

if tt.name == "sad case: patient already exists" {
fakeFHIR.MockSearchFHIRPatientFn = func(ctx context.Context, searchParams string, tenant dto.TenantIdentifiers, pagination dto.Pagination) (*domain.PatientConnection, error) {
return &domain.PatientConnection{
Edges: []*domain.PatientEdge{
{
Node: &domain.FHIRPatient{},
},
},
}, nil
}
}

if tt.name == "sad case: error searching for patient" {
fakeFHIR.MockSearchFHIRPatientFn = func(ctx context.Context, searchParams string, tenant dto.TenantIdentifiers, pagination dto.Pagination) (*domain.PatientConnection, error) {
return nil, fmt.Errorf("failed to search for patient")
}
}

if tt.name == "sad case: fail to get tenant tags" {
fakeExt.MockGetTenantIdentifiersFn = func(ctx context.Context) (*dto.TenantIdentifiers, error) {
return nil, fmt.Errorf("failed to get tenant identifiers")
Expand Down

0 comments on commit 170303e

Please sign in to comment.