opensrp / opensrp-client-goldsmith

0 stars 0 forks source link

Pregnancy outcome from the ANC register is failing #46

Open ekigamba opened 3 years ago

ekigamba commented 3 years ago

First error

2020-12-18 20:58:16.539 11948-12113/org.smartregister.goldsmith E/EventClientRepository: Error saving client {"birthdateApprox":false,"deathdateApprox":false,"firstName":"roddy","gender":"Male","lastName":"","middleName":"","relationships":{},"addresses":[],"attributes":{},"baseEntityId":"4caf2d81-33e8-493a-92c0-7350a9c3414d","identifiers":{},"clientApplicationVersion":2,"clientDatabaseVersion":5,"dateCreated":"2020-12-18T20:58:16.512Z","type":"Client"}
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.smartregister.domain.ClientRelationship.getBaseEntityId()' on a null object reference
        at org.smartregister.repository.ClientRelationshipRepository.saveRelationship(ClientRelationshipRepository.java:57)
        at org.smartregister.repository.EventClientRepository.addorUpdateClient(EventClientRepository.java:1869)
        at org.smartregister.repository.EventClientRepository.addorUpdateClient(EventClientRepository.java:1813)
        at org.smartregister.sync.helper.ECSyncHelper.addClient(ECSyncHelper.java:126)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor.saveRegistration(BaseConfigurableRegisterActivityInteractor.java:186)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor.access$000(BaseConfigurableRegisterActivityInteractor.java:42)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor$2.run(BaseConfigurableRegisterActivityInteractor.java:93)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
2020-12-18 20:58:16.540 11948-12113/org.smartregister.goldsmith E/EventClientRepository: Error saving client {"birthdateApprox":false,"deathdateApprox":false,"firstName":"roddy","gender":"Male","lastName":"","middleName":"","relationships":{},"addresses":[],"attributes":{},"baseEntityId":"4caf2d81-33e8-493a-92c0-7350a9c3414d","identifiers":{},"clientApplicationVersion":2,"clientDatabaseVersion":5,"dateCreated":"2020-12-18T20:58:16.512Z","type":"Client"}
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String org.smartregister.domain.ClientRelationship.getBaseEntityId()' on a null object reference
        at org.smartregister.repository.ClientRelationshipRepository.saveRelationship(ClientRelationshipRepository.java:57)
        at org.smartregister.repository.EventClientRepository.addorUpdateClient(EventClientRepository.java:1869)
        at org.smartregister.repository.EventClientRepository.addorUpdateClient(EventClientRepository.java:1813)
        at org.smartregister.sync.helper.ECSyncHelper.addClient(ECSyncHelper.java:126)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor.saveRegistration(BaseConfigurableRegisterActivityInteractor.java:186)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor.access$000(BaseConfigurableRegisterActivityInteractor.java:42)
        at org.smartregister.view.interactor.BaseConfigurableRegisterActivityInteractor$2.run(BaseConfigurableRegisterActivityInteractor.java:93)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

Second and FATAL error

2020-12-18 20:58:16.666 11948-12076/org.smartregister.goldsmith E/ClientConverter: error conveting client org.smartregister.domain.Client@92ff098[birthdate=<null>,birthdateApprox=false,clientType=<null>,deathdate=<null>,deathdateApprox=false,firstName=roddy,gender=Male,lastName=,locationId=<null>,middleName=,relationships={},teamId=<null>,addresses=[],attributes={},baseEntityId=4caf2d81-33e8-493a-92c0-7350a9c3414d,contactPoints=<null>,identifiers={},photos=<null>,clientApplicationVersion=2,clientDatabaseVersion=5,creator=<null>,dateCreated=2020-12-18T23:58:16.512+03:00,dateEdited=<null>,dateVoided=<null>,editor=<null>,serverVersion=0,voidReason=<null>,voided=<null>,voider=<null>,conflicts=<null>,id=<null>,revision=<null>,type=Client]
    java.lang.IllegalStateException: Trimmed String value length: 0 is less than minimum required length: 1
        at com.ibm.fhir.model.util.ValidationSupport.checkString(ValidationSupport.java:101)
        at com.ibm.fhir.model.type.String.<init>(String.java:29)
        at com.ibm.fhir.model.type.String$Builder.build(String.java:197)
        at com.ibm.fhir.model.type.String.of(String.java:54)
        at org.smartregister.converters.ClientConverter.convertClientToPatientResource(ClientConverter.java:43)
        at org.smartregister.sync.ClientProcessorForJava.lambda$processPlanEvaluation$0(ClientProcessorForJava.java:132)
        at org.smartregister.sync.-$$Lambda$ClientProcessorForJava$HxXhSIaNrH6PbuEPRvK3VC04xEM.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
2020-12-18 20:58:16.667 11948-12076/org.smartregister.goldsmith E/AndroidRuntime: FATAL EXCEPTION: pool-35-thread-1
    Process: org.smartregister.goldsmith, PID: 11948
    java.lang.IllegalStateException: Repeating element: 'contained' does not permit null elements
        at com.ibm.fhir.model.util.ValidationSupport.requireNonNull(ValidationSupport.java:342)
        at com.ibm.fhir.model.resource.DomainResource.<init>(DomainResource.java:72)
        at com.ibm.fhir.model.resource.QuestionnaireResponse.<init>(QuestionnaireResponse.java:96)
        at com.ibm.fhir.model.resource.QuestionnaireResponse.<init>(QuestionnaireResponse.java:60)
        at com.ibm.fhir.model.resource.QuestionnaireResponse$Builder.build(QuestionnaireResponse.java:818)
        at org.smartregister.sync.ClientProcessorForJava.lambda$processPlanEvaluation$0(ClientProcessorForJava.java:132)
        at org.smartregister.sync.-$$Lambda$ClientProcessorForJava$HxXhSIaNrH6PbuEPRvK3VC04xEM.run(Unknown Source:2)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)

How to replicate

  1. Register a woman family member
  2. Register them in the ANC register through the family member profile
  3. Go to the ANC register
  4. Select the woman and register a pregnancy outcome through the ANC member profile
  5. Fill in details and submit - The app crashes and kicks you to the login page

    The result client JSON in the client table has an empty relationships object & does not have the identifiers object

allan-on commented 3 years ago

This will be investigated & fixed in https://github.com/OpenSRP/opensrp-client-goldsmith/issues/49