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

Issue 1308 remove duplicate patients #1310

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private List<PatientSearchResults> searchPatientInClientRegistry(String lastName
}
}

List<PatientSearchResults> finalResults = new ArrayList<>();
Set<PatientSearchResults> finalResults = new LinkedHashSet<>();
for (org.hl7.fhir.r4.model.Patient externalPatient : externalPatients) {
// convert fhir object to patient search result
PatientSearchResults transformedPatientSearchResult = SpringContext.getBean(FhirTransformService.class)
Expand All @@ -218,7 +218,7 @@ private List<PatientSearchResults> searchPatientInClientRegistry(String lastName
finalResults.add(transformedPatientSearchResult);
}

return finalResults;
return new ArrayList<>(finalResults);
}

// FIXME: get better fallback initials and gender
Expand Down
28 changes: 14 additions & 14 deletions src/main/resources/liquibase/2.0.x.x/base.xml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<include file="liquibase/2.0.x.x/convert_id_types.xml"/>
<include file="liquibase/2.0.x.x/validation_site_information.xml"/>
<include file="liquibase/2.0.x.x/fhir_data_export.xml"/>
<include file="liquibase/2.0.x.x/default_test.xml"/>
<include file="liquibase/2.0.x.x/patient_contact.xml"/>

</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<include file="liquibase/2.0.x.x/convert_id_types.xml"/>
<include file="liquibase/2.0.x.x/validation_site_information.xml"/>
<include file="liquibase/2.0.x.x/fhir_data_export.xml"/>
<include file="liquibase/2.0.x.x/default_test.xml"/>
<include file="liquibase/2.0.x.x/patient_contact.xml"/>
</databaseChangeLog>
94 changes: 47 additions & 47 deletions src/main/resources/liquibase/2.0.x.x/convert_id_types.xml
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<changeSet author="caleb" id="1">
<comment>modify login_user as an example</comment>

<modifyDataType columnName="id" newDataType="INTEGER"
schemaName="clinlims" tableName="login_user" />
<dropPrimaryKey schemaName="clinlims"
tableName="login_user" />
<addPrimaryKey schemaName="clinlims"
tableName="login_user" columnNames="id" />
<addColumn schemaName="clinlims" tableName="login_user">
<column name="last_updated" type="TIMESTAMP WITH TIME ZONE" />
</addColumn>

<rollback>
<modifyDataType columnName="id" newDataType="numeric"
schemaName="clinlims" tableName="login_user" />
<dropPrimaryKey schemaName="clinlims"
tableName="login_user" />
<addPrimaryKey schemaName="clinlims"
tableName="login_user" columnNames="login_name" />
</rollback>
</changeSet>

<changeSet author="caleb" id="2">
<comment>modify gender as a second example</comment>

<modifyDataType columnName="id" newDataType="INTEGER"
schemaName="clinlims" tableName="gender" />
<renameColumn oldColumnName="lastupdated"
newColumnName="last_updated" columnName="id" schemaName="clinlims"
tableName="gender"></renameColumn>

<rollback>
<modifyDataType columnName="id" newDataType="numeric"
schemaName="clinlims" tableName="gender" />
</rollback>

</changeSet>

</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="caleb" id="1">
<comment>modify login_user as an example</comment>
<modifyDataType columnName="id" newDataType="INTEGER"
schemaName="clinlims" tableName="login_user" />
<dropPrimaryKey schemaName="clinlims"
tableName="login_user" />
<addPrimaryKey schemaName="clinlims"
tableName="login_user" columnNames="id" />
<addColumn schemaName="clinlims" tableName="login_user">
<column name="last_updated" type="TIMESTAMP WITH TIME ZONE" />
</addColumn>
<rollback>
<modifyDataType columnName="id" newDataType="numeric"
schemaName="clinlims" tableName="login_user" />
<dropPrimaryKey schemaName="clinlims"
tableName="login_user" />
<addPrimaryKey schemaName="clinlims"
tableName="login_user" columnNames="login_name" />
</rollback>
</changeSet>
<changeSet author="caleb" id="2">
<comment>modify gender as a second example</comment>
<modifyDataType columnName="id" newDataType="INTEGER"
schemaName="clinlims" tableName="gender" />
<renameColumn oldColumnName="lastupdated"
newColumnName="last_updated" columnName="id" schemaName="clinlims"
tableName="gender"></renameColumn>
<rollback>
<modifyDataType columnName="id" newDataType="numeric"
schemaName="clinlims" tableName="gender" />
</rollback>
</changeSet>
</databaseChangeLog>
38 changes: 19 additions & 19 deletions src/main/resources/liquibase/2.0.x.x/default_test.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<changeSet author="caleb" id="1">
<comment>add lastupdated to site informations without to stop a bug</comment>

<!-- auto-rollsback -->
<addColumn schemaName="clinlims"
tableName="test">
<column name="default_test_result_id" type="numeric(10)"/>
</addColumn>

</changeSet>

</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="caleb" id="1">
<comment>add lastupdated to site informations without to stop a bug</comment>
<!-- auto-rollsback -->
<addColumn schemaName="clinlims"
tableName="test">
<column name="default_test_result_id" type="numeric(10)"/>
</addColumn>
</changeSet>
</databaseChangeLog>
130 changes: 65 additions & 65 deletions src/main/resources/liquibase/2.0.x.x/fhir_data_export.xml
Original file line number Diff line number Diff line change
@@ -1,65 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">

<changeSet author="caleb" id="1">
<comment>add functionality for fhir data export</comment>

<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_task">
<column name="id" type="BIGINT">
<constraints primaryKey="true" />
</column>
<column name="data_request_attempt_timeout" type="integer" />
<column name="max_data_export_interval" type="integer" />
<column name="endpoint" type="VARCHAR (255)" >
<constraints unique="true" />
</column>
</createTable>

<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_fhir_resources">
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_fhir_resources_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="fhir_resources" type="VARCHAR (255)" />
</createTable>

<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_headers">
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_headers_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="key" type="VARCHAR (255)" />
<column name="value" type="VARCHAR (255)" />
</createTable>

<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_attempt">
<column name="id" type="BIGINT">
<constraints primaryKey="true" />
</column>
<column name="start_time" type="DATETIME" />
<column name="end_time" type="DATETIME" />
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_attempt_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="data_export_status" type="VARCHAR (255)" />
</createTable>

</changeSet>

</databaseChangeLog>
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="caleb" id="1">
<comment>add functionality for fhir data export</comment>
<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_task">
<column name="id" type="BIGINT">
<constraints primaryKey="true" />
</column>
<column name="data_request_attempt_timeout" type="integer" />
<column name="max_data_export_interval" type="integer" />
<column name="endpoint" type="VARCHAR (255)" >
<constraints unique="true" />
</column>
</createTable>
<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_fhir_resources">
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_fhir_resources_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="fhir_resources" type="VARCHAR (255)" />
</createTable>
<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_headers">
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_headers_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="key" type="VARCHAR (255)" />
<column name="value" type="VARCHAR (255)" />
</createTable>
<!-- auto-rollsback -->
<createTable schemaName="clinlims"
tableName="data_export_attempt">
<column name="id" type="BIGINT">
<constraints primaryKey="true" />
</column>
<column name="start_time" type="DATETIME" />
<column name="end_time" type="DATETIME" />
<column name="data_export_task_id" type="BIGINT">
<constraints
foreignKeyName="fk_data_export_attempt_data_export_task"
references="data_export_task(id)"></constraints>
</column>
<column name="data_export_status" type="VARCHAR (255)" />
</createTable>
</changeSet>
</databaseChangeLog>
Loading