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

Start saving local lastUpdated to resources for search operations. #2030

Merged
merged 17 commits into from
Jul 21, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
spotless apply
  • Loading branch information
aditya-07 committed Jul 19, 2023
commit 99ba9db06f03be56f3fa4432fcd9572f295169d5
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import org.hl7.fhir.r4.model.Quantity
import org.hl7.fhir.r4.model.Reference
import org.hl7.fhir.r4.model.Resource
import org.hl7.fhir.r4.model.ResourceType
import org.hl7.fhir.r4.model.SearchParameter
import org.hl7.fhir.r4.model.StringType
import org.hl7.fhir.r4.model.Timing
import org.hl7.fhir.r4.model.UriType
Expand Down Expand Up @@ -111,14 +110,14 @@ internal class ResourceIndexer(
}

companion object {

private fun numberIndex(searchParam: SearchParamDefinition, value: Base): NumberIndex? =
when (value.fhirType()) {
"integer" ->
NumberIndex(searchParam.name, searchParam.path, BigDecimal((value as IntegerType).value))
"decimal" -> NumberIndex(searchParam.name, searchParam.path, (value as DecimalType).value)
else -> null
}
when (value.fhirType()) {
"integer" ->
NumberIndex(searchParam.name, searchParam.path, BigDecimal((value as IntegerType).value))
"decimal" -> NumberIndex(searchParam.name, searchParam.path, (value as DecimalType).value)
else -> null
}

private fun dateIndex(searchParam: SearchParamDefinition, value: Base): DateIndex {
val date = value as DateType
Expand Down Expand Up @@ -290,7 +289,10 @@ internal class ResourceIndexer(
}
}

private fun quantityIndex(searchParam: SearchParamDefinition, value: Base): List<QuantityIndex> =
private fun quantityIndex(
searchParam: SearchParamDefinition,
value: Base
): List<QuantityIndex> =
when (value.fhirType()) {
"Money" -> {
val money = value as Money
Expand Down Expand Up @@ -320,7 +322,8 @@ internal class ResourceIndexer(
var canonicalValue = quantity.value
if (quantity.system == ucumUrl && quantity.code != null) {
try {
val ucumUnit = UnitConverter.getCanonicalForm(UcumValue(quantity.code, quantity.value))
val ucumUnit =
UnitConverter.getCanonicalForm(UcumValue(quantity.code, quantity.value))
canonicalCode = ucumUnit.code
canonicalValue = ucumUnit.value
} catch (exception: ConverterException) {
Expand Down
Loading