Skip to content

Commit cbda553

Browse files
authored
Release 1.1.1
Merge pull request #425 from imotions/develop
2 parents 00848dd + 604638b commit cbda553

File tree

229 files changed

+1517
-1515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

229 files changed

+1517
-1515
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CARP Core is a software framework to help developers build research platforms to
66
It provides modules to define, deploy, and monitor research studies, and to collect data from multiple devices at multiple locations.
77

88
It is the result of a collaboration between [iMotions](https://imotions.com/) and the [Copenhagen Center for Health Technology (CACHET)](https://www.cachet.dk/).
9-
Both use CARP Core to implement their respective research platforms: the [iMotions Mobile Research Platform](https://imotions.com/mobile-platform-landing-page-submissions/) and the [CACHET Research Platform (CARP)](https://carp.cachet.dk/).
9+
Both use CARP Core to implement their respective research platforms: the [iMotions Mobile Research Platform](https://imotions.com/mobile-platform-landing-page-submissions/) and the [Copenhagen Research Platform (CARP)](https://carp.cachet.dk/).
1010
CARP Core is now maintained fully by iMotions (since 1.0), but [still part of CARP](https://carp.cachet.dk/core/) as an ongoing collaboration.
1111

1212
Following [domain-driven design](https://en.wikipedia.org/wiki/Domain-driven_design), this project contains all domain models and application services for all CARP subsystems ([depicted below](#architecture)), not having any dependencies on concrete infrastructure.

build.gradle

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@ buildscript {
33
ext {
44
// Version used for submodule artifacts.
55
// Snapshot publishing changes (or adds) the suffix after '-' with 'SNAPSHOT' prior to publishing.
6-
globalVersion = '1.1.0'
7-
clientsVersion = '1.1.0-alpha.1' // The clients subsystem is still expected to change drastically.
6+
globalVersion = '1.1.1'
7+
clientsVersion = '1.1.1-alpha.1' // The clients subsystem is still expected to change drastically.
88

99
versions = [
1010
// Kotlin multiplatform versions.
11-
kotlin:'1.6.10',
12-
serialization:'1.3.2',
13-
coroutines:'1.6.0',
14-
datetime:'0.3.2',
11+
kotlin:'1.8.0',
12+
serialization:'1.4.1',
13+
coroutines:'1.6.4',
14+
datetime:'0.4.0',
1515

1616
// JVM versions.
1717
jvmTarget:'1.8',
18-
dokkaPlugin:'1.6.10',
18+
dokkaPlugin:'1.7.20',
1919
reflections:'0.10.2',
2020

2121
// JS versions.
22-
nodePlugin:'3.2.1',
23-
bigJs:'6.1.1',
22+
nodePlugin:'3.5.0',
23+
bigJs:'6.2.1',
2424

2525
// DevOps versions.
26-
detektPlugin:'1.20.0-RC2',
27-
detektVerifyImplementation:'1.2.2',
26+
detektPlugin:'1.22.0',
27+
detektVerifyImplementation:'1.2.5',
2828
nexusPublishPlugin:'1.1.0',
2929
apacheCommons:'2.11.0'
3030
]
@@ -258,7 +258,7 @@ task copyTestJsSources(type: Copy, dependsOn: setupTsProject) {
258258
if (path == ".visited") return // We don't need this file.
259259

260260
// Remove intermediate version directory: e.g. "kotlin/1.5.10/kotlin.js"
261-
it.path = path.replaceFirst(/\d+\.\d+.\d+\//, "")
261+
it.path = path.replaceFirst(/\d+\.\d+.\d+(-.+)?\//, "")
262262
}
263263
}
264264
into "./$typescriptFolder/node_modules"

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/application/study/StudyStatus.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ sealed class StudyStatus
6060
is DeviceDeploymentStatus.NotDeployed ->
6161
if ( deploymentInformation == null || deviceStatus is DeviceDeploymentStatus.NeedsRedeployment )
6262
{
63-
if ( deviceStatus.canObtainDeviceDeployment ) AwaitingDeviceDeployment( id, deployingDevices )
63+
val readyToDeploy = deviceStatus.canObtainDeviceDeployment
64+
if ( readyToDeploy ) AwaitingDeviceDeployment( id, deployingDevices )
6465
else AwaitingOtherDeviceRegistrations( id, deployingDevices )
6566
}
6667
else

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/domain/SmartphoneClient.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ ClientManager<Smartphone, SmartphoneDeviceRegistration, SmartphoneDeviceRegistra
3434
dataCollectorFactory
3535
)
3636
{
37-
override fun createDeviceRegistrationBuilder(): SmartphoneDeviceRegistrationBuilder = SmartphoneDeviceRegistrationBuilder()
37+
override fun createDeviceRegistrationBuilder(): SmartphoneDeviceRegistrationBuilder =
38+
SmartphoneDeviceRegistrationBuilder()
3839
}

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/domain/data/DataListener.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@ import dk.cachet.carp.common.application.data.DataType
55
import dk.cachet.carp.common.application.devices.DeviceRegistration
66
import dk.cachet.carp.common.application.devices.DeviceType
77

8+
typealias DataCollectorMap = MutableMap<DeviceRegistration, AnyConnectedDeviceDataCollector>
9+
810

911
/**
1012
* Allows subscribing to [Data] (e.g., sensors, surveys) of requested [DataType]s on a primary device and connected devices
1113
* by using [DeviceDataCollector] instances provided by [dataCollectorFactory].
1214
*/
1315
class DataListener( private val dataCollectorFactory: DeviceDataCollectorFactory )
1416
{
15-
private val connectedDataCollectors: MutableMap<DeviceType, MutableMap<DeviceRegistration, AnyConnectedDeviceDataCollector>> = mutableMapOf()
17+
private val connectedDataCollectors: MutableMap<DeviceType, DataCollectorMap> = mutableMapOf()
1618

1719

1820
/**
@@ -40,7 +42,10 @@ class DataListener( private val dataCollectorFactory: DeviceDataCollectorFactory
4042
*
4143
* @return The [ConnectedDeviceDataCollector], or null in case it could not be created.
4244
*/
43-
fun tryGetConnectedDataCollector( connectedDeviceType: DeviceType, registration: DeviceRegistration ): AnyConnectedDeviceDataCollector?
45+
fun tryGetConnectedDataCollector(
46+
connectedDeviceType: DeviceType,
47+
registration: DeviceRegistration
48+
): AnyConnectedDeviceDataCollector?
4449
{
4550
return try
4651
{

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/domain/study/Study.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Study(
115115
fun validateDeviceDeployment( dataListener: DataListener )
116116
{
117117
val deployment = checkNotNull( deploymentInformation )
118-
val remainingDevicesToRegister = deploymentStatus?.getRemainingDevicesToRegister() ?: emptySet()
118+
val remainingDevicesToRegister = deploymentStatus?.getRemainingDevicesToRegister().orEmpty()
119119

120120
// All devices need to be registered before deployment can be validated.
121121
check( remainingDevicesToRegister.isEmpty() )
@@ -131,7 +131,9 @@ class Study(
131131
if ( device.isConnectedDevice )
132132
{
133133
dataListener.tryGetConnectedDataCollector( deviceType, registration )
134-
?: throw UnsupportedOperationException( "Connecting to device of type \"$deviceType\" is not supported on this client." )
134+
?: throw UnsupportedOperationException(
135+
"Connecting to device of type \"$deviceType\" is not supported on this client."
136+
)
135137
}
136138

137139
val dataTypes = device.tasks

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/domain/study/StudyDeploymentProxy.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ class StudyDeploymentProxy(
7171
study.deploymentStatusReceived( deployedStatus )
7272
}
7373
// Handle race conditions with competing clients modifying device registrations, invalidating this deployment.
74-
catch ( ignore: IllegalArgumentException ) { } // TODO: When deployment is out of date, maybe also use `IllegalStateException` for easier handling here.
74+
// TODO: When deployment is out of date, maybe also use `IllegalStateException` for easier handling here.
75+
catch ( ignore: IllegalArgumentException ) { }
7576
catch ( ignore: IllegalStateException ) { }
7677
}
7778

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/domain/study/StudySnapshot.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import dk.cachet.carp.common.domain.Snapshot
66
import dk.cachet.carp.deployments.application.PrimaryDeviceDeployment
77
import dk.cachet.carp.deployments.application.StudyDeploymentStatus
88
import kotlinx.datetime.Instant
9-
import kotlinx.serialization.Serializable
9+
import kotlinx.serialization.*
1010

1111

1212
@Serializable

carp.clients.core/src/commonMain/kotlin/dk/cachet/carp/clients/infrastructure/InMemoryClientRepository.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class InMemoryClientRepository : ClientRepository
7373
override suspend fun updateStudy( study: Study )
7474
{
7575
val storedStudy = findStudySnapshot( study )
76-
requireNotNull( storedStudy ) { "The repository does not contain an existing study matching the one to update." }
76+
requireNotNull( storedStudy )
77+
{ "The repository does not contain an existing study matching the one to update." }
7778

7879
studies.remove( storedStudy )
7980
studies.add( study.getSnapshot() )

carp.clients.core/src/commonTest/kotlin/dk/cachet/carp/clients/ClientCodeSamples.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ class ClientCodeSamples
124124
* A stub [DataListener] which supports the expected data types in [createExampleProtocol].
125125
*/
126126
private fun createDataCollectorFactory() = createDataCollectorFactory(
127-
CarpDataTypes.GEOLOCATION, CarpDataTypes.STEP_COUNT
127+
CarpDataTypes.GEOLOCATION,
128+
CarpDataTypes.STEP_COUNT
128129
)
129130

130131
private val accountService = InMemoryAccountService()

0 commit comments

Comments
 (0)