Skip to content

Exception when submitting expected participant data #506

@Panosfunk

Description

@Panosfunk

@bardram, About the issue we talked yesterday.

When I submit the expected participant data, I get 2 log messages. First is the following exception that has to do with the phone number type.

E/flutter (19835): [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: SerializationException - A 'fromJson' function was not found in the FromJsonFactory for the type 'dk.carp.webservices.input.phone_number'. Register a Serializable class using the 'FromJsonFactory().register()' method.
E/flutter (19835): If you are using CARP Mobile Sensing, you can ensure json initialization by calling'CarpMobileSensing.ensureInitialized()' as part of your main method.
E/flutter (19835): #0      FromJsonFactory.fromJson (package:carp_serializable/carp_serializable.dart:199:9)
carp_serializable.dart:199
E/flutter (19835): #1      new Data.fromJson (package:carp_core/common/application/data.dart:32:25)
data.dart:32
E/flutter (19835): #2      _$RoleDataFromJson.<anonymous closure> (package:carp_core/deployment/carp_core_deployment.g.dart:179:44)
g.dart:179
E/flutter (19835): #3      MapBase.map (dart:collection/maps.dart:82:28)
maps.dart:82
E/flutter (19835): #4      _$RoleDataFromJson (package:carp_core/deployment/carp_core_deployment.g.dart:177:54)
g.dart:177
E/flutter (19835): #5      new RoleData.fromJson (package:carp_core/deployment/domain/participation.dart:47:7)
participation.dart:47
E/flutter (19835): #6      _$ParticipantDataFromJson.<anonymous closure> (package:carp_core/deployment/carp_core_deployment.g.dart:163:37)
g.dart:163
E/flutter (19835): #7      MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
iterable.dart:442
E/flutter (19835): #8      ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
iterable.dart:371
E/flutter (19835): #9      new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:194:27)
growable_array.dart:194
E/flutter (19835): #10     new _GrowableList.of (dart:core-patch/growable_array.dart:154:28)
growable_array.dart:154
E/flutter (19835): #11     new List.of (dart:core-patch/array_patch.dart:40:18)
array_patch.dart:40
E/flutter (19835): #12     ListIterable.toList (dart:_internal/iterable.dart:224:7)
iterable.dart:224
E/flutter (19835): #13     _$ParticipantDataFromJson (package:carp_core/deployment/carp_core_deployment.g.dart:164:16)
g.dart:164
E/flutter (19835): #14     new ParticipantData.fromJson (package:carp_core/deployment/domain/participation.dart:29:7)
participation.dart:29
E/flutter (19835): #15     ParticipationReference.setParticipantData (package:carp_webservices/carp_services/participation_reference.dart:71:23)
participation_reference.dart:71
E/flutter (19835): <asynchronous suspension>
E/flutter (19835): #16     CarpParticipationService.setParticipantData (package:carp_webservices/carp_services/participation_service.dart:137:7)
participation_service.dart:137
E/flutter (19835): <asynchronous suspension>
E/flutter (19835): 

The second one is a successful upload message:

{
  "studyDeploymentId": "9078c6d4-b1a3-4868-bd19-1fadcc92a0e8",
  "common": {},
  "roles": [
    {
      "roleName": "Participant",
      "data": {
        "dk.carp.webservices.input.address": {
          "__type": "dk.carp.webservices.input.address",
          "address1": "a",
          "address2": "f",
          "street": "f",
          "postalCode": "c",
          "country": "f"
        },
        "dk.carp.webservices.input.diagnosis": {
          "__type": "dk.carp.webservices.input.diagnosis",
          "effectiveDate": "2025-07-17T22:00:00Z",
          "diagnosis": "h",
          "icd11Code": "h",
          "conclusion": "h"
        },
        "dk.carp.webservices.input.full_name": {
          "__type": "dk.carp.webservices.input.full_name",
          "firstName": "h",
          "middleName": "",
          "lastName": "h"
        },
        "dk.cachet.carp.input.sex": null,
        "dk.carp.webservices.input.informed_consent": null,
        "dk.carp.webservices.input.phone_number": {
          "__type": "dk.carp.webservices.input.phone_number",
          "countryCode": "+45",
          "number": "66 4"
        },
        "dk.carp.webservices.input.ssn": {
          "__type": "dk.carp.webservices.input.ssn",
          "socialSecurityNumber": "676",
          "country": "676"
        }
      }
    }
  ]
}

Inside the portal, I can then see my data fine, besides the phone and SSN country code

Image

Metadata

Metadata

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions