-
Notifications
You must be signed in to change notification settings - Fork 4
Drop/Create EHR Index Page #1084
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
base: release25.7-SNAPSHOT
Are you sure you want to change the base?
Conversation
| String[] indexCols = new String[]{"participantid", "date", "include:taskid,lsid,category,observation,area,remark"}; | ||
| String indexName = getIndexName(schema.getSqlDialect(), tableName, indexCols); | ||
|
|
||
| List<String> cols = Arrays.asList("participantid", "date"); | ||
| String[] includedCols = new String[]{"taskid", "lsid", "category", "observation", "area", "remark"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these column lists hard-coded twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the hard coded values in this file and the common index here.
| { | ||
| List<String> messages = new ArrayList<>(); | ||
|
|
||
| EHRIndexContext ctx = prepareEHRIndexContext(c, messages); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels over-engineered for a single index and under-engineered for supporting more indices in the future. Consider making prepareEHRIndexContext() return a List with a single entry for now, and iterate over the list when creating or dropping indices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm anticipating a lot of refactoring in this file as we look into these indices. I was planning on doing more refactoring at that point but went ahead and set this up more generically for more indices.
| messages.add("Dropping index on column(s): " + StringUtils.join(cols, ", ") + " for dataset: " + tableName); | ||
| String sqlString = "DROP INDEX " + indexName + " ON " + realTable.getSelectName(); | ||
| String sqlString; | ||
| if (realTable.getSqlDialect().isSqlServer()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we share index dropping code with ensureDatasetProperyDescriptor() instead of duplicating?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ensureDatasetProperyDescriptor() was previously using dropIndex in one place and not in another. Fixed.
Rationale
Initially this page allows dropping and recreating the EHR index on the clinical_observations dataset to resolve an issue introduced in 25.7 (and fixed in 25.11) with recreating indices by name after updating a domain. This creates actions to drop the index manually and recreate it manually after the domain update is complete.
Additionally we'll keep these actions and page as we prepare for migration from SQL Server to Postgres and go through the other EHR indices to see which are still needed. Or if new ones are needed.
Changes