Пример #1
0
        public void WhenTwoPatientsEachHavingTwoEntries_ThenDuplicateGroupsAreMarked()
        {
            var record1          = CreateRecord();
            var record1BluePrint = JsonConvert.SerializeObject(record1);
            var record3          = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record3.serotype += "different";
            var record2 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record2.initials = "A.B.";
            var record4 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record4.initials  = "A.B.";
            record4.serotype += "different";
            var table = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2, record3, record4
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(4);

            table.Rows[0][DuplicatePatientResolver.ColDuplicateGroup].Should().Be("Group 1");
            table.Rows[2][DuplicatePatientResolver.ColDuplicateGroup].Should().Be("Group 1");
            table.Rows[1][DuplicatePatientResolver.ColDuplicateGroup].Should().Be("Group 2");
            table.Rows[3][DuplicatePatientResolver.ColDuplicateGroup].Should().Be("Group 2");
        }
Пример #2
0
        public void WhenEmptyRecords_ThenEntriesAreRemoved()
        {
            var record1 = CreateRecord();

            record1.isolate        = "H123";
            record1.beta_lactamase = "";
            record1.AMX_SIR        = "";
            var record2 = CreateRecord();

            record2.beta_lactamase = "";
            record2.AMX_SIR        = null;
            record2.serotype       = "";
            var record3 = CreateRecord();

            record3.beta_lactamase = "";
            record3.AMX_SIR        = "";
            record3.serotype       = "";

            var table = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2, record3
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(1);

            table.Rows[0][Col.StemNumber].Should().Be("H123");
        }
Пример #3
0
        public void WhenNonDuplicateEntries_ThenNoRowsAreRemoved()
        {
            var record1 = CreateRecord();
            var record2 = CreateRecord();

            record2.sex           = record1.sex;
            record2.initials      = record1.initials;
            record2.date_of_birth = record1.date_of_birth;
            var record3 = CreateRecord();

            record3.postal_code   = null;
            record3.date_of_birth = null;
            var record4 = CreateRecord();

            record4.sex           = record3.sex;
            record4.postal_code   = null;
            record4.date_of_birth = null;
            var table = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2, record3, record4
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(4);
            table.Columns.Contains(DuplicatePatientResolver.ColDuplicateGroup).Should().BeFalse();
        }
Пример #4
0
        public void WhenDuplicatePatients_ThenIdenticalEntriesMoreThenSixMonthApartStrainsAreKept()
        {
            var record1          = CreateRecord();
            var record1BluePrint = JsonConvert.SerializeObject(record1);

            record1.isolate = "H123";
            var record2 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record2.isolate       = "H135";
            record2.date_received = DateTime.Parse(record2.date_received).AddMonths(6).ToString("yyyy-MM-dd");
            var record3 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record3.isolate   = "H137";
            record3.serotype += "different";
            var table = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2, record3
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(3);

            table.Rows[0][Col.StemNumber].Should().Be("H123");
            table.Rows[1][Col.StemNumber].Should().Be("H135");
            table.Rows[2][Col.StemNumber].Should().Be("H137");
        }
Пример #5
0
        public void WhenCleanupFinished_PatientColumnsAreRemoved()
        {
            var record1 = CreateRecord();
            var record2 = CreateRecord();
            var table   = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(2);
            table.Columns.Contains(Col.Initials).Should().BeFalse();
            table.Columns.Contains(Col.DateOfBirth).Should().BeFalse();
            table.Columns.Contains(Col.PostalCode).Should().BeFalse();
        }
Пример #6
0
        public void WhenDuplicatePatients_ThenIdenticalOlderEntriesStrainsAreRemoved()
        {
            var record1          = CreateRecord();
            var record1BluePrint = JsonConvert.SerializeObject(record1);

            record1.isolate = "H123";
            var record2 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record2.isolate = "H135";
            var record3 = JsonConvert.DeserializeObject <DataTableRecord>(record1BluePrint);

            record3.isolate   = "H137";
            record3.serotype += "different";
            var table = new DataTableRecordExportDefinition().ToDataTable(new List <DataTableRecord> {
                record1, record2, record3
            });

            _sut.CleanOrMarkDuplicates(table);

            table.Rows.Count.Should().Be(2);

            table.Rows[0][Col.StemNumber].Should().Be("H123");
            table.Rows[1][Col.StemNumber].Should().Be("H137");
        }