From 6e95c9a4079ac4fd312950c8f88b582ff5bdc2ff Mon Sep 17 00:00:00 2001 From: PINAKIN-KANSARA-EY Date: Wed, 14 Feb 2024 11:45:16 -0800 Subject: [PATCH] HAPP-1855 - fixed API date format changes - updated api version to 3 - updated app version to 2.1.0 --- .../gov/bchealth/compose/component/Button.kt | 6 +-- .../model/mapper/DtoToUIModelMapper.kt | 26 ++++++----- .../profile/DependentProfileViewModel.kt | 4 +- .../ui/healthrecord/HealthRecordViewModel.kt | 8 ++-- .../covidtests/CovidTestResultFragment.kt | 6 +-- .../HospitalVisitDetailViewModel.kt | 6 +-- .../labtest/LabTestDetailViewModel.kt | 8 ++-- .../SpecialAuthorityDetailViewModel.kt | 6 +-- .../FetchFederalTravelPassFragment.kt | 6 +-- .../bc/gov/common/utils/DateTimeExtentions.kt | 18 +++++++- .../model/dependents/DependentDtoTest.kt | 3 ++ .../model/base/TermsOfServicePayload.kt | 3 ++ .../data/model/mapper/ResponseToDtoMapper.kt | 46 +++++++++---------- .../repository/extensions/ShcDataExtension.kt | 3 +- scripts/versions.gradle | 6 +-- 15 files changed, 88 insertions(+), 67 deletions(-) diff --git a/app/src/main/java/ca/bc/gov/bchealth/compose/component/Button.kt b/app/src/main/java/ca/bc/gov/bchealth/compose/component/Button.kt index d209ae75d..5ff855c33 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/compose/component/Button.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/compose/component/Button.kt @@ -206,11 +206,7 @@ fun HGTextButton( modifier, enabled, defaultHeight, - contentPadding = if (leadingIcon != null) { - ButtonDefaults.TextButtonContentPadding - } else { - ButtonDefaults.TextButtonContentPadding - } + contentPadding = ButtonDefaults.TextButtonContentPadding ) { HGButtonContent( { diff --git a/app/src/main/java/ca/bc/gov/bchealth/model/mapper/DtoToUIModelMapper.kt b/app/src/main/java/ca/bc/gov/bchealth/model/mapper/DtoToUIModelMapper.kt index c15308c11..c2a2383c1 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/model/mapper/DtoToUIModelMapper.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/model/mapper/DtoToUIModelMapper.kt @@ -32,9 +32,11 @@ import ca.bc.gov.common.model.services.BcCancerScreeningDataDto import ca.bc.gov.common.model.services.DiagnosticImagingDataDto import ca.bc.gov.common.model.specialauthority.SpecialAuthorityDto import ca.bc.gov.common.model.test.CovidOrderWithCovidTestDto +import ca.bc.gov.common.utils.dateString import ca.bc.gov.common.utils.toDate import ca.bc.gov.common.utils.toDateTimeString import ca.bc.gov.common.utils.toLocalDateTimeInstant +import ca.bc.gov.common.utils.toPST import java.time.Instant import java.time.LocalDate @@ -101,7 +103,7 @@ fun ClinicalDocumentDto.toUiModel() = fun LabOrderWithLabTestDto.toUiModel(): HealthRecordItem { var description = "" description = mapOrderStatus(labOrder.orderStatus ?: "").plus(" • ") - .plus(labOrder.timelineDateTime.toDate()) + .plus(labOrder.timelineDateTime.dateString()) return HealthRecordItem( patientId = labOrder.patientId, title = labOrder.commonName ?: "", @@ -168,9 +170,9 @@ fun CovidOrderWithCovidTestDto.toUiModel(): HealthRecordItem { patientId = covidOrder.patientId, recordId = covidOrder.id, title = "COVID-19 test result", - description = "$testOutcome • ${date.toDate()}", + description = "$testOutcome • ${date.dateString()}", icon = R.drawable.ic_health_record_covid_test, - date = date, + date = date.toPST(), healthRecordType = HealthRecordType.COVID_TEST_RECORD, dataSource = covidOrder.dataSource.name ) @@ -182,7 +184,7 @@ fun ImmunizationRecordWithForecastDto.toUiModel(): HealthRecordItem { patientId = immunizationRecord.patientId, recordId = immunizationRecord.id, title = immunizationRecord.immunizationName ?: "", - description = immunizationRecord.dateOfImmunization.toDate(), + description = immunizationRecord.dateOfImmunization.dateString(), icon = R.drawable.ic_health_record_vaccine, date = immunizationRecord.dateOfImmunization, healthRecordType = HealthRecordType.IMMUNIZATION_RECORD, @@ -207,12 +209,12 @@ fun ImmunizationRecordWithForecastAndPatientDto.toUiModel(): ImmunizationRecordD return ImmunizationRecordDetailItem( id = immunizationRecordWithForecast.immunizationRecord.id, status = immunizationRecordWithForecast.immunizationRecord.status, - dueDate = immunizationRecordWithForecast.immunizationForecast?.dueDate?.toDate(), + dueDate = immunizationRecordWithForecast.immunizationForecast?.dueDate?.dateString(), name = immunizationRecordWithForecast.immunizationRecord.immunizationName, doseDetails = listOf( ImmunizationDoseDetailItem( id = immunizationRecordWithForecast.immunizationRecord.id, - date = immunizationRecordWithForecast.immunizationRecord.dateOfImmunization.toDate(), + date = immunizationRecordWithForecast.immunizationRecord.dateOfImmunization.dateString(), productName = immunizationRecordWithForecast.immunizationRecord.productName, immunizingAgent = immunizationRecordWithForecast.immunizationRecord.agentName, providerOrClinicName = immunizationRecordWithForecast.immunizationRecord.provideOrClinic, @@ -228,7 +230,7 @@ fun HealthVisitsDto.toUiModel() = patientId = patientId, recordId = healthVisitId, title = specialtyDescription.orEmpty(), - description = practitionerName.orEmpty() + " • " + encounterDate.toDate(), + description = practitionerName.orEmpty() + " • " + encounterDate.dateString(), icon = R.drawable.ic_health_record_health_visit, date = encounterDate, healthRecordType = HealthRecordType.HEALTH_VISIT_RECORD, @@ -239,7 +241,7 @@ fun SpecialAuthorityDto.toUiModel() = HealthRecordItem( patientId = patientId, recordId = specialAuthorityId, title = drugName.orEmpty(), - description = requestStatus.orEmpty() + " • " + requestedDate?.toDate(), + description = requestStatus.orEmpty() + " • " + requestedDate?.dateString(), icon = R.drawable.ic_health_record_special_authority, date = requestedDate!!, healthRecordType = HealthRecordType.SPECIAL_AUTHORITY_RECORD, @@ -261,7 +263,7 @@ fun HospitalVisitDto.toUiModel() = fun ImmunizationRecommendationsDto.toUiModel() = RecommendationDetailItem( title = this.recommendedVaccinations.orPlaceholder(), status = this.status, - date = this.agentDueDate?.toDate().orPlaceholder(), + date = this.agentDueDate?.dateString().orPlaceholder(), ) fun DependentDto.toUiModel(currentDate: LocalDate) = DependentDetailItem( @@ -288,7 +290,7 @@ fun CommentDto.toUiModel() = Comment( private fun ImmunizationForecastDto.toUiModel() = ForecastDetailItem( name = this.displayName.orPlaceholder(), status = this.status, - date = this.dueDate.toDate(), + date = this.dueDate.dateString(), ) enum class CovidTestResultStatus { @@ -305,7 +307,7 @@ private fun DiagnosticImagingDataDto.toUiModel() = HealthRecordItem( patientId = patientId, icon = R.drawable.ic_health_record_diagnostic_imaging, title = modality.orEmpty(), - description = if (isUpdated) { "Updated" } else { examStatus } + " • " + examDate?.toDate(), + description = if (isUpdated) { "Updated" } else { examStatus } + " • " + examDate?.dateString(), date = examDate!!, healthRecordType = HealthRecordType.DIAGNOSTIC_IMAGING, dataSource = null @@ -320,7 +322,7 @@ fun BcCancerScreeningDataDto.toUiModel() = HealthRecordItem( patientId = patientId, icon = R.drawable.ic_health_record_bc_cancer_screening, title = if (eventType == "Recall") { "BC Cancer Screening Reminder Letter" } else { "BC Cancer Screening Result Letter" }, - description = programName + " • " + if (eventType == "Recall") { eventDateTime } else { resultDateTime }?.toDate(), + description = programName + " • " + if (eventType == "Recall") { eventDateTime } else { resultDateTime }?.dateString(), date = if (eventType == "Recall") { eventDateTime !! } else { resultDateTime!! }, healthRecordType = HealthRecordType.BC_CANCER_SCREENING, dataSource = null diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/dependents/profile/DependentProfileViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/dependents/profile/DependentProfileViewModel.kt index 604a34b87..4bf3118f2 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/dependents/profile/DependentProfileViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/dependents/profile/DependentProfileViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import ca.bc.gov.bchealth.R import ca.bc.gov.common.model.dependents.DependentDto -import ca.bc.gov.common.utils.toDate +import ca.bc.gov.common.utils.dateString import ca.bc.gov.repository.DependentsRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -43,7 +43,7 @@ class DependentProfileViewModel @Inject constructor( ), DependentProfileItem( label = R.string.dependents_profile_dob, - value = dependentDto.dateOfBirth.toDate() + value = dependentDto.dateOfBirth.dateString() ), ) diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/HealthRecordViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/HealthRecordViewModel.kt index 7d36c2f8e..d8163e90b 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/HealthRecordViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/HealthRecordViewModel.kt @@ -11,7 +11,7 @@ import ca.bc.gov.common.exceptions.ServiceDownException import ca.bc.gov.common.model.AuthenticationStatus import ca.bc.gov.common.model.ProtectiveWordState import ca.bc.gov.common.model.relation.PatientWithMedicationRecordDto -import ca.bc.gov.common.utils.toDate +import ca.bc.gov.common.utils.dateToInstant import ca.bc.gov.common.utils.toStartOfDayInstant import ca.bc.gov.repository.CacheRepository import ca.bc.gov.repository.MedicationRecordRepository @@ -128,13 +128,13 @@ class HealthRecordViewModel @Inject constructor( private fun getFilterByDate(healthRecords: List, fromDate: String?, toDate: String?): MutableList { return if (!fromDate.isNullOrBlank() && !toDate.isNullOrBlank()) { - healthRecords.filter { it.date.toStartOfDayInstant() >= fromDate.toDate() && it.date <= toDate.toDate() } + healthRecords.filter { it.date.toStartOfDayInstant() >= fromDate.dateToInstant().toStartOfDayInstant() && it.date.toStartOfDayInstant() <= toDate.dateToInstant().toStartOfDayInstant() } .toMutableList() } else if (!fromDate.isNullOrBlank()) { - healthRecords.filter { it.date.toStartOfDayInstant() >= fromDate.toDate() } + healthRecords.filter { it.date.toStartOfDayInstant() >= fromDate.dateToInstant().toStartOfDayInstant() } .toMutableList() } else if (!toDate.isNullOrBlank()) { - healthRecords.filter { it.date.toStartOfDayInstant() <= toDate.toDate() }.toMutableList() + healthRecords.filter { it.date.toStartOfDayInstant() <= toDate.dateToInstant().toStartOfDayInstant() }.toMutableList() } else { healthRecords.toMutableList() } diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/covidtests/CovidTestResultFragment.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/covidtests/CovidTestResultFragment.kt index 7c263cdb2..fe23ada02 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/covidtests/CovidTestResultFragment.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/covidtests/CovidTestResultFragment.kt @@ -22,7 +22,7 @@ import ca.bc.gov.bchealth.widget.AddCommentLayout import ca.bc.gov.common.model.patient.PatientDto import ca.bc.gov.common.model.test.CovidOrderDto import ca.bc.gov.common.model.test.CovidTestDto -import ca.bc.gov.common.utils.toDateTimeString +import ca.bc.gov.common.utils.dateTimeString import dagger.hilt.android.AndroidEntryPoint private const val COVID_ORDER_ID = "COVID_ORDER_ID" @@ -99,10 +99,10 @@ class CovidTestResultFragment(private val itemClickListener: ItemClickListener) getString(R.string.tested_on) .plus(" ") .plus( - covidTest?.collectedDateTime?.toDateTimeString() + covidTest?.collectedDateTime?.dateTimeString() ) tvDot.text = - covidTest?.collectedDateTime?.toDateTimeString().showIfNullOrBlank(requireContext()) + covidTest?.collectedDateTime?.dateTimeString().showIfNullOrBlank(requireContext()) tvTestStatus.text = covidTest?.testStatus.showIfNullOrBlank(requireContext()) tvTypeName.text = covidTest?.testType.showIfNullOrBlank(requireContext()) tvProviderClinic.text = covidOrder.reportingLab.showIfNullOrBlank(requireContext()) diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/hospitalvisits/HospitalVisitDetailViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/hospitalvisits/HospitalVisitDetailViewModel.kt index fcc8b615e..b0eae290e 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/hospitalvisits/HospitalVisitDetailViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/hospitalvisits/HospitalVisitDetailViewModel.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.viewModelScope import ca.bc.gov.bchealth.R import ca.bc.gov.bchealth.ui.healthrecord.HealthRecordDetailItem import ca.bc.gov.common.model.hospitalvisits.HospitalVisitDto -import ca.bc.gov.common.utils.toDateTimeString +import ca.bc.gov.common.utils.dateTimeString import ca.bc.gov.repository.hospitalvisit.HospitalVisitRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -26,7 +26,7 @@ class HospitalVisitDetailViewModel @Inject constructor( try { val dto: HospitalVisitDto = repository.getHospitalVisit(hospitalVisitId) - val dischargeDate = dto.dischargeDate?.toDateTimeString().orEmpty() + val dischargeDate = dto.dischargeDate?.dateTimeString().orEmpty() val uiList: List = listOf( HealthRecordDetailItem( @@ -55,7 +55,7 @@ class HospitalVisitDetailViewModel @Inject constructor( HealthRecordDetailItem( title = R.string.hospital_visits_detail_visit_date_title, - description = dto.visitDate.toDateTimeString() + description = dto.visitDate.dateTimeString() ), HealthRecordDetailItem( diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/labtest/LabTestDetailViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/labtest/LabTestDetailViewModel.kt index 22fd99385..a1e1a282d 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/labtest/LabTestDetailViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/labtest/LabTestDetailViewModel.kt @@ -8,8 +8,8 @@ import ca.bc.gov.common.exceptions.NetworkConnectionException import ca.bc.gov.common.exceptions.ServiceDownException import ca.bc.gov.common.model.labtest.LabOrderWithLabTestDto import ca.bc.gov.common.model.labtest.LabOrderWithLabTestsAndPatientDto -import ca.bc.gov.common.utils.toDate -import ca.bc.gov.common.utils.toDateTimeString +import ca.bc.gov.common.utils.dateString +import ca.bc.gov.common.utils.dateTimeString import ca.bc.gov.repository.labtest.LabOrderRepository import ca.bc.gov.repository.worker.MobileConfigRepository import dagger.hilt.android.lifecycle.HiltViewModel @@ -71,8 +71,8 @@ class LabTestDetailViewModel @Inject constructor( labTestDetails.add( LabTestDetail( title1 = R.string.collection_date, - collectionDateTime = labOrderWithLabTestDto.labOrder.collectionDateTime?.toDate(), - timelineDateTime = labOrderWithLabTestDto.labOrder.timelineDateTime.toDateTimeString(), + collectionDateTime = labOrderWithLabTestDto.labOrder.collectionDateTime?.dateString(), + timelineDateTime = labOrderWithLabTestDto.labOrder.timelineDateTime.dateTimeString(), title2 = R.string.ordering_provider, orderingProvider = labOrderWithLabTestDto.labOrder.orderingProvider, title3 = R.string.reporting_lab, diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/specialauthority/SpecialAuthorityDetailViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/specialauthority/SpecialAuthorityDetailViewModel.kt index 8addd819e..d9643a328 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/specialauthority/SpecialAuthorityDetailViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/healthrecord/specialauthority/SpecialAuthorityDetailViewModel.kt @@ -3,7 +3,7 @@ package ca.bc.gov.bchealth.ui.healthrecord.specialauthority import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import ca.bc.gov.bchealth.R -import ca.bc.gov.common.utils.toDate +import ca.bc.gov.common.utils.dateString import ca.bc.gov.repository.specialauthority.SpecialAuthorityRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow @@ -50,13 +50,13 @@ class SpecialAuthorityDetailViewModel @Inject constructor( specialAuthorityDetailItems.add( SpecialAuthorityDetailItem( R.string.effective_date, - specialAuthorityDto?.effectiveDate?.toDate() ?: "--" + specialAuthorityDto?.effectiveDate?.dateString() ?: "--" ) ) specialAuthorityDetailItems.add( SpecialAuthorityDetailItem( R.string.expiry_date, - specialAuthorityDto?.expiryDate?.toDate() ?: "--" + specialAuthorityDto?.expiryDate?.dateString() ?: "--" ) ) specialAuthorityDetailItems.add( diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/travelpass/FetchFederalTravelPassFragment.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/travelpass/FetchFederalTravelPassFragment.kt index 3d771058f..fa74a62ec 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/travelpass/FetchFederalTravelPassFragment.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/travelpass/FetchFederalTravelPassFragment.kt @@ -32,7 +32,7 @@ import ca.bc.gov.bchealth.viewmodel.RecentPhnDobViewModel import ca.bc.gov.common.model.analytics.AnalyticsAction import ca.bc.gov.common.model.analytics.AnalyticsActionData import ca.bc.gov.common.model.relation.PatientWithVaccineAndDosesDto -import ca.bc.gov.common.utils.toDate +import ca.bc.gov.common.utils.dateString import ca.bc.gov.common.utils.yyyy_MM_dd import ca.bc.gov.repository.model.PatientVaccineRecord import dagger.hilt.android.AndroidEntryPoint @@ -168,8 +168,8 @@ class FetchFederalTravelPassFragment : BaseFragment(R.layout.fragment_fetch_trav patientDataDto.vaccineWithDoses?.doses?.let { doses -> viewModel.fetchVaccineRecord( phn, - patientDataDto.patient.dateOfBirth.toDate(yyyy_MM_dd), - doses.last().date.toDate(yyyy_MM_dd) + patientDataDto.patient.dateOfBirth.dateString(yyyy_MM_dd), + doses.last().date.dateString(yyyy_MM_dd) ) } } diff --git a/common/src/main/java/ca/bc/gov/common/utils/DateTimeExtentions.kt b/common/src/main/java/ca/bc/gov/common/utils/DateTimeExtentions.kt index c23749708..df40c0ad0 100644 --- a/common/src/main/java/ca/bc/gov/common/utils/DateTimeExtentions.kt +++ b/common/src/main/java/ca/bc/gov/common/utils/DateTimeExtentions.kt @@ -17,6 +17,7 @@ const val eee_dd_mmm_yyyy_hh_mm_ss_z = "EEE, dd MMM yyyy HH:mm:ss XXXX" private const val full_date_time_plus_time = "yyyy-MM-dd'T'HH:mm:ssXXX" private const val yyyy_MMM_dd_HH_mm_sss_long = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" private const val yyyy_MMM_dd_HH_mm_short = "yyyy-MM-dd'T'HH:mm:ss'Z'" +private const val PST_ZONE_ID = "America/Los_Angeles" fun Instant.toDateTimeString(dateFormat: String = yyyy_MMM_dd_HH_mm): String { val dateTime = LocalDateTime.ofInstant(this, ZoneOffset.UTC) @@ -93,9 +94,24 @@ fun Instant.toStartOfDayInstant(): Instant { * provides the date time in UTC+00:00 * */ fun Instant.toLocalDateTimeInstant(): Instant? { - return this.atZone(ZoneId.of("America/Los_Angeles")) + return this.atZone(ZoneId.of(PST_ZONE_ID)) ?.toLocalDateTime()?.toInstant(ZoneOffset.UTC) } +fun Instant.toPST(): Instant { + return this.atZone(ZoneId.of(PST_ZONE_ID)) + .toLocalDateTime().toInstant(ZoneOffset.UTC) +} + fun Instant.toLocalDate(): LocalDate = this.atZone(ZoneOffset.UTC).toLocalDate() + +fun String.dateTimeToInstant(): Instant = Instant.parse(this) + +fun String.dateToInstant(): Instant = LocalDate.parse(this).atStartOfDay(ZoneId.of(PST_ZONE_ID)).toInstant() + +fun Instant.dateTimeString(pattern: String = yyyy_MMM_dd_HH_mm): String { + return atZone(ZoneId.of(PST_ZONE_ID)).format(DateTimeFormatter.ofPattern(pattern)) +} + +fun Instant.dateString(pattern: String = yyyy_MMM_dd) = dateTimeString(pattern = pattern) diff --git a/common/src/test/java/ca/bc/gov/common/model/dependents/DependentDtoTest.kt b/common/src/test/java/ca/bc/gov/common/model/dependents/DependentDtoTest.kt index db01baf5f..d16fed4f1 100644 --- a/common/src/test/java/ca/bc/gov/common/model/dependents/DependentDtoTest.kt +++ b/common/src/test/java/ca/bc/gov/common/model/dependents/DependentDtoTest.kt @@ -49,6 +49,9 @@ internal class DependentDtoTest { ownerId = "", delegateId = "", reasonCode = 0L, + totalDelegateCount = 0, version = 0L, + patientId = 0, + isCacheValid = false ) } diff --git a/data/src/main/java/ca/bc/gov/data/datasource/remote/model/base/TermsOfServicePayload.kt b/data/src/main/java/ca/bc/gov/data/datasource/remote/model/base/TermsOfServicePayload.kt index 09968f822..fe48c0cdd 100644 --- a/data/src/main/java/ca/bc/gov/data/datasource/remote/model/base/TermsOfServicePayload.kt +++ b/data/src/main/java/ca/bc/gov/data/datasource/remote/model/base/TermsOfServicePayload.kt @@ -1,10 +1,13 @@ package ca.bc.gov.data.datasource.remote.model.base +import com.google.gson.annotations.SerializedName + /** * @author Pinakin Kansara */ data class TermsOfServicePayload( val id: String? = null, val content: String? = null, + @SerializedName("effectiveDateTime") val effectiveDate: String? = null ) diff --git a/data/src/main/java/ca/bc/gov/data/model/mapper/ResponseToDtoMapper.kt b/data/src/main/java/ca/bc/gov/data/model/mapper/ResponseToDtoMapper.kt index 52198a215..bbb4e0164 100644 --- a/data/src/main/java/ca/bc/gov/data/model/mapper/ResponseToDtoMapper.kt +++ b/data/src/main/java/ca/bc/gov/data/model/mapper/ResponseToDtoMapper.kt @@ -39,10 +39,10 @@ import ca.bc.gov.common.model.test.CovidOrderDto import ca.bc.gov.common.model.test.CovidOrderWithCovidTestDto import ca.bc.gov.common.model.test.CovidTestDto import ca.bc.gov.common.model.userprofile.UserProfileDto -import ca.bc.gov.common.utils.toDate +import ca.bc.gov.common.utils.dateTimeToInstant +import ca.bc.gov.common.utils.dateToInstant import ca.bc.gov.common.utils.toDateTime import ca.bc.gov.common.utils.toDateTimeZ -import ca.bc.gov.common.utils.toOffsetDateTime import ca.bc.gov.common.utils.toPstFromIsoZoned import ca.bc.gov.data.datasource.remote.model.base.CovidLabResult import ca.bc.gov.data.datasource.remote.model.base.CovidOrder @@ -126,7 +126,7 @@ fun MedicationStatementPayload.toMedicationRecordDto() = MedicationRecordDto( prescriptionIdentifier = prescriptionIdentifier, prescriptionStatus = prescriptionStatus.toString(), practitionerSurname = practitionerSurname, - dispenseDate = dispensedDate.toDateTime(), + dispenseDate = dispensedDate.dateToInstant(), directions = directions, dateEntered = dateEntered?.toDateTime() ?: Instant.EPOCH, dataSource = DataSource.BCSC @@ -138,7 +138,7 @@ fun MedicationSummary.toMedicationSummaryDto() = MedicationSummaryDto( genericName = genericName, quantity = quantity, maxDailyDosage = maxDailyDosage, - drugDiscontinueDate = drugDiscontinuedDate?.toDateTime() ?: Instant.EPOCH, + drugDiscontinueDate = drugDiscontinuedDate?.dateTimeToInstant() ?: Instant.EPOCH, form = form, manufacturer = manufacturer, strength = strength, @@ -187,8 +187,8 @@ fun LabTestResponse.toDto(): List { LabOrderDto( labPdfId = order.labPdfId, reportId = order.reportId, - collectionDateTime = order.collectionDateTime?.toDateTime(), - timelineDateTime = order.timelineDateTime.toDateTime(), + collectionDateTime = order.collectionDateTime?.dateTimeToInstant(), + timelineDateTime = order.timelineDateTime.dateTimeToInstant(), reportingSource = order.reportingSource, commonName = order.commonName, orderingProvider = order.orderingProvider, @@ -292,7 +292,7 @@ fun ImmunizationRecord.toDto(): ImmunizationRecordDto { return ImmunizationRecordDto( immunizationId = id, - dateOfImmunization = dateOfImmunization.toDateTime(), + dateOfImmunization = dateOfImmunization.dateTimeToInstant(), status = status, isValid = valid, provideOrClinic = providerOrClinic, @@ -307,11 +307,11 @@ fun ImmunizationRecord.toDto(): ImmunizationRecordDto { fun Forecast.toDto() = ImmunizationForecastDto( recommendationId = recommendationId, - createDate = createDate.toDateTime(), + createDate = createDate.dateToInstant(), status = ForecastStatus.getByText(status), displayName = displayName, - eligibleDate = eligibleDate.toDateTime(), - dueDate = dueDate.toDateTime() + eligibleDate = eligibleDate.dateToInstant(), + dueDate = dueDate.dateToInstant() ) fun ImmunizationResponse.toDto() = ImmunizationDto( @@ -338,7 +338,7 @@ fun HealthVisitsPayload.toDto() = HealthVisitsDto( healthVisitId = 0, patientId = 0, id, - encounterDate.toDateTime(), + encounterDate.dateToInstant(), specialtyDescription, practitionerName, clinic.toDto(), @@ -355,8 +355,8 @@ fun HospitalVisitInformation.toDto() = HospitalVisitDto( location = facility, provider = provider.orEmpty(), visitType = visitType.orEmpty(), - visitDate = admitDateTime.toDateTime(), - dischargeDate = endDateTime?.toDateTime(), + visitDate = admitDateTime.dateTimeToInstant(), + dischargeDate = endDateTime?.dateTimeToInstant(), encounterId = encounterId ) @@ -367,7 +367,7 @@ fun ClinicalDocumentResponse.toDto(): List = type = it.type, facilityName = it.facilityName, discipline = it.discipline, - serviceDate = it.serviceDate.toOffsetDateTime(), + serviceDate = it.serviceDate.dateToInstant(), fileId = it.fileId, ) } @@ -388,9 +388,9 @@ fun SpecialAuthorityPayload.toDto() = SpecialAuthorityDto( requestStatus, prescriberFirstName, prescriberLastName, - requestedDate?.toDateTime(), - effectiveDate?.toDateTime(), - expiryDate?.toDateTime(), + requestedDate?.dateToInstant(), + effectiveDate?.dateToInstant(), + expiryDate?.dateToInstant(), dataSource = DataSource.BCSC ) @@ -401,7 +401,7 @@ fun Recommendation.toDto(): ImmunizationRecommendationsDto { recommendationSetId = this.recommendationSetId, immunizationName = agent?.name, status = ForecastStatus.getByText(status), - agentDueDate = this.agentDueDate?.toDateTime(), + agentDueDate = this.agentDueDate?.dateToInstant(), recommendedVaccinations = this.recommendedVaccinations ) } @@ -429,7 +429,7 @@ fun DependentPayload.toDto() = DependentDto( firstname = dependentInformation.firstname, lastname = dependentInformation.lastname, phn = dependentInformation.phn, - dateOfBirth = dependentInformation.dateOfBirth.toDateTime(), + dateOfBirth = dependentInformation.dateOfBirth.dateToInstant(), gender = dependentInformation.gender, ownerId = ownerId, delegateId = delegateId, @@ -472,7 +472,7 @@ fun PatientResponse.toDto(): PatientDto { fullName = fullNameBuilder.toString(), firstName = patientName.givenName, lastName = patientName.surName, - dateOfBirth = date.toDateTime(), + dateOfBirth = date.dateToInstant(), legalName = legalName?.toDto(), preferredName = preferredName.toDto(), commonName = commonName?.toDto(), @@ -501,7 +501,7 @@ private fun OrganDonorData.toDto() = OrganDonorDto( private fun DiagnosticImagingData.toDto() = DiagnosticImagingDataDto( id = id, - examDate = examDate?.toDate(), + examDate = examDate?.dateToInstant(), isUpdated = isUpdated, fileId = fileId, examStatus = examStatus ?: "Unknown", @@ -514,8 +514,8 @@ private fun DiagnosticImagingData.toDto() = DiagnosticImagingDataDto( private fun BcCancerScreeningData.toDto() = BcCancerScreeningDataDto( id = id, - resultDateTime = resultDateTime?.toDateTimeZ(), - eventDateTime = eventDateTime?.toDateTimeZ(), + resultDateTime = resultDateTime?.dateTimeToInstant(), + eventDateTime = eventDateTime?.dateTimeToInstant(), fileId = fileId, programName = programName, eventType = eventType diff --git a/repository/src/main/java/ca/bc/gov/repository/extensions/ShcDataExtension.kt b/repository/src/main/java/ca/bc/gov/repository/extensions/ShcDataExtension.kt index e2f6f180f..c153263b1 100644 --- a/repository/src/main/java/ca/bc/gov/repository/extensions/ShcDataExtension.kt +++ b/repository/src/main/java/ca/bc/gov/repository/extensions/ShcDataExtension.kt @@ -4,6 +4,7 @@ import ca.bc.gov.common.model.ImmunizationStatus import ca.bc.gov.common.model.VaccineDoseDto import ca.bc.gov.common.model.VaccineRecordDto import ca.bc.gov.common.model.patient.PatientDto +import ca.bc.gov.common.utils.dateToInstant import ca.bc.gov.common.utils.toDate import ca.bc.gov.repository.model.PatientVaccineRecord import ca.bc.gov.shcdecoder.model.SHCData @@ -25,7 +26,7 @@ fun SHCData.toPatient(): PatientDto { } return PatientDto( fullName = fullNameBuilder.toString(), - dateOfBirth = patient.dateOfBirth?.toDate()!!, + dateOfBirth = patient.dateOfBirth?.dateToInstant()!!, firstName = patient.firstName.orEmpty(), lastName = patient.lastName.orEmpty(), physicalAddress = null, diff --git a/scripts/versions.gradle b/scripts/versions.gradle index 66a472b7e..c1ae35fe5 100644 --- a/scripts/versions.gradle +++ b/scripts/versions.gradle @@ -6,9 +6,9 @@ versions.targetSdkVersion = 33 versions.compileSdkVersion = 33 //App -versions.versionName = '2.0.5' -versions.versionCode = 234 -versions.localApiVersion = 2 +versions.versionName = '2.1.0' +versions.versionCode = 235 +versions.localApiVersion = 3 //Tools & Libs versions.kotlin_gradle_plugin = "1.8.20"