Add exact code/tag service filters with date support#291
Merged
Conversation
…ti-type maps - Add 4 new filters: ServiceByHcPartyCodesFilter, ServiceByHcPartyTagCodesFilter, ServiceByHcPartyPatientCodesFilter, ServiceByHcPartyPatientTagCodesFilter - These accept Map<String, Collection<String>> for type->codes, enabling multi-type queries in a single filter - Add startValueDate/endValueDate to existing prefix filters (ServiceByHcPartyCodePrefixFilter, ServiceByHcPartyTagPrefixFilter) - Update CouchDB views to emit [serviceId, date] tuples for date filtering - Add month-range optimization for date-bounded queries - Add FuzzyDates.getMonthRange utility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR extends the service filtering API to support (1) exact code/tag matching across multiple code/tag types in one call, and (2) value-date bounded querying for existing prefix-based filters, with DAO/view changes to support date-aware filtering and a month-partition optimization path.
Changes:
- Added 4 new “exact match” service filters (DTO + domain + core resolvers) accepting
Map<String, Collection<String>>plus optionalstartValueDate/endValueDate. - Extended existing code/tag prefix filters (DTO + domain + core resolvers) with optional
startValueDate/endValueDate. - Updated CouchDB views and DAO methods to return/consume
[serviceId, date]values and added month-range optimization viaFuzzyDates.getMonthRange.
Reviewed changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| mapper/src/main/kotlin/org/taktik/icure/services/external/rest/v2/mapper/filter/FilterMapper.kt | Adds mapping support for the new exact-match DTO filters to domain filters. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyTagPrefixFilter.kt | Adds optional value-date bounds to existing tag prefix filter DTO. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyCodePrefixFilter.kt | Adds optional value-date bounds to existing code prefix filter DTO. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyCodesFilter.kt | New DTO for exact code matching across multiple code types with optional date bounds. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyTagCodesFilter.kt | New DTO for exact tag matching across multiple tag types with optional date bounds. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyPatientCodesFilter.kt | New DTO for exact patient-scoped code matching across types with optional date bounds. |
| dto/src/main/kotlin/org/taktik/icure/services/external/rest/v2/dto/filter/service/ServiceByHcPartyPatientTagCodesFilter.kt | New DTO for exact patient-scoped tag matching across types with optional date bounds. |
| domain/src/main/kotlin/org/taktik/icure/utils/FuzzyDates.kt | Adds getMonthRange helper for month-bucket query optimization. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyTagPrefixFilter.kt | Extends domain interface to include optional value-date bounds. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyCodePrefixFilter.kt | Extends domain interface to include optional value-date bounds. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyCodesFilter.kt | New domain filter interface for exact code matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyTagCodesFilter.kt | New domain filter interface for exact tag matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyPatientCodesFilter.kt | New domain filter interface for exact patient-scoped code matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/service/ServiceByHcPartyPatientTagCodesFilter.kt | New domain filter interface for exact patient-scoped tag matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyTagPrefixFilter.kt | Adds date bounds to the domain implementation for tag prefix filter. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyCodePrefixFilter.kt | Adds date bounds to the domain implementation for code prefix filter. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyCodesFilter.kt | New domain implementation for exact code matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyTagCodesFilter.kt | New domain implementation for exact tag matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyPatientCodesFilter.kt | New domain implementation for exact patient-scoped code matching. |
| domain/src/main/kotlin/org/taktik/icure/domain/filter/impl/service/ServiceByHcPartyPatientTagCodesFilter.kt | New domain implementation for exact patient-scoped tag matching. |
| dao/src/main/resources/org/taktik/icure/asyncdao/impl/js/contact/Service_by_data_owner_tag_prefix.js | Changes emitted view values to include [serviceId, valueDate/openingDate]. |
| dao/src/main/resources/org/taktik/icure/asyncdao/impl/js/contact/Service_by_data_owner_code_prefix.js | Changes emitted view values to include [serviceId, valueDate/openingDate]. |
| dao/src/main/kotlin/org/taktik/icure/asyncdao/ContactDAO.kt | Adds new DAO methods for exact match queries + date-bounded variants of prefix queries. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyTagPrefixFilter.kt | Adds date bounds + month-bucket optimization path for tag prefix filter resolution. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyCodePrefixFilter.kt | Adds date bounds + month-bucket optimization path for code prefix filter resolution. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyTagCodesFilter.kt | New core resolver for exact tag matching (multi-type map) with date bounds and month optimization. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyCodesFilter.kt | New core resolver for exact code matching (multi-type map) with date bounds and month optimization. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyPatientTagCodesFilter.kt | New core resolver for exact patient-scoped tag matching (multi-type map) with date bounds. |
| core/src/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyPatientCodesFilter.kt | New core resolver for exact patient-scoped code matching (multi-type map) with date bounds. |
| core/src/main/kotlin/org/taktik/icure/asyncdao/impl/ContactDAOImpl.kt | Implements new DAO methods, adds date filtering for updated views, and adds exact-match query helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...in/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyTagPrefixFilter.kt
Show resolved
Hide resolved
...n/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyCodePrefixFilter.kt
Show resolved
Hide resolved
...c/main/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyCodesFilter.kt
Outdated
Show resolved
Hide resolved
...ain/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyTagCodesFilter.kt
Show resolved
Hide resolved
core/src/main/kotlin/org/taktik/icure/asyncdao/impl/ContactDAOImpl.kt
Outdated
Show resolved
Hide resolved
…tion The cross-product of searchKeys × types × codes (and patientSfks where applicable) is now built in a single list of keys at the DAO level, producing one CouchDB query instead of N queries per type. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…Impl.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 30 out of 30 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ain/kotlin/org/taktik/icure/asynclogic/impl/filter/service/ServiceByHcPartyTagCodesFilter.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/taktik/icure/asyncdao/impl/ContactDAOImpl.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/taktik/icure/asyncdao/impl/ContactDAOImpl.kt
Outdated
Show resolved
Hide resolved
core/src/main/kotlin/org/taktik/icure/asyncdao/impl/ContactDAOImpl.kt
Outdated
Show resolved
Hide resolved
Add queryViewByKeysInChunks helper that splits large keys lists into chunks of daoConfig.viewQueryChunkSize (default 1000) and executes them in parallel with max daoConfig.viewQueryMaxConcurrency (default 4) concurrent queries. Applied to all 3 exact-match private helpers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add toFullFuzzyDateTime(), isFuzzyDateAfterOrEqual(), and isFuzzyDateBeforeOrEqual() to handle comparisons between YYYYMMDD and YYYYMMDDHHmmss formats correctly: - Start dates (YYYYMMDD) are padded to 000000 (start of day) - End dates (YYYYMMDD) are padded to 235959 (end of day, inclusive) Updated all date comparisons in ContactDAOImpl and domain filter matches() methods to use the new utilities. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…imit - Change ContactDAOImpl key cross-products to Sequence<ComplexKey> to avoid materializing potentially large lists before chunking - Update queryViewByKeysInChunks to accept Sequence instead of List - Move MAX_MONTHS constant from FuzzyDates to filter resolvers and add maxMonths parameter to getMonthRange - Extract maxPossibleFuzzyNowInAllTimeZones() helper in FuzzyDates Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
trema96
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ServiceByHcPartyCodesFilter,ServiceByHcPartyTagCodesFilter,ServiceByHcPartyPatientCodesFilter,ServiceByHcPartyPatientTagCodesFilterMap<String, Collection<String>>(type → codes) enabling multi-type queries in a single filter callstartValueDate/endValueDatesupport to existing prefix filters (ServiceByHcPartyCodePrefixFilter,ServiceByHcPartyTagPrefixFilter)Service_by_data_owner_code_prefix.js,Service_by_data_owner_tag_prefix.js) to emit[serviceId, date]tuples for date-based filteringFuzzyDates.getMonthRangeTest plan
🤖 Generated with Claude Code