Pedigree fails to apply automatic layout in some cases

Description

Automatic layout may fail in some cases. This includes import (since auto-layout is one of the steps performed for each import), which prevents the data from being imported in any form (for the affected pedigree)

To reproduce: [[ trying to find a minimal example. For now have a sample import JSON which triggers the bug, but turns out steps to reproduce are not as simple as I thought. The code line which triggers the bug is obvious though ]]

The problem: when a date is defined as an empty date object (no fields are set), as opposed to `null`, pedigree layout algorithm is interrupted by an exception (it calls empty-date-object.toJavascriptDate().someMethod(), but empty-date-object.toJavascriptDate() returns null and thus invocation of null.someMethod() triggers an exception)

Environment

None

Activity

Show:
Andrew Misyura
March 20, 2017, 8:49 PM

Sample JSON which 1.3rc1 can not import (before this fix):

[{"id":"1","proband":true,"father":"3","mother":"2","adoptedStatus":"","twinGroup":null,"monozygotic":false,"nodeNumber":"","sex":"unknown","birthDate":{},"deathDate":{},"lifeStatus":"alive","externalId":"","genes":[]},{"id":"2","father":"7","mother":"6","genes":[],"birthDate":{"month":12,"year":1962,"day":1},"features":[],"aliveAndWell":true,"sex":"female","lastName":"Williams","nonstandard_features":[],"firstName":"Wilma"},{"id":"3","father":"5","mother":"4","comments":"hfghfghfghfgh\nfghfghfghfghfgh\nfghfghfghfgh\nfghfghfghfgh\nfhfghfghfgh\nfghfghfgh\ndgdgfdfdg\nfdgfdgfdg\nfdgdfg","sex":"male","firstName":"Charles","lastName":"Williams","externalId":"ll","birthDate":{"year":1962},"lifeStatus":"deceased","deceasedAge":"h","deceasedCause":"uuuuu","deathDate":{"year":2017},"disorders":["173900"],"features":[],"nonstandard_features":[],"genes":[],"carrierStatus":"affected"},{"id":"4","deceasedCause":"stroke","genes":[],"birthDate":{"year":1944},"features":[],"sex":"female","deathDate":{"year":1984},"lifeStatus":"deceased","nonstandard_features":[]},{"id":"5","genes":[],"deceasedCause":"pneumonia","birthDate":{"range":{"years":10},"year":1940},"features":[],"sex":"male","deathDate":{"range":{"years":10},"year":2000},"lifeStatus":"deceased","nonstandard_features":[]},{"id":"6","deceasedAge":"77","deceasedCause":"gjhg","genes":[],"features":[],"sex":"female","deathDate":{"year":2016},"lifeStatus":"deceased","externalId":"ID 12345","nonstandard_features":[]},{"id":"7","deceasedAge":"77","deceasedCause":"vnbnvbn","genes":[],"features":[],"sex":"male","lifeStatus":"deceased","nonstandard_features":[]},{"id":"8","father":"3","mother":"2","lastNameAtBirth":"Williams","carrierStatus":"presymptomatic","firstName":"Mark","lastName":"Williams","sex":"male","birthDate":{"year":1991,"month":8,"day":5},"deathDate":{},"lifeStatus":"alive","externalId":"380293","disorders":["173900"],"genes":[{"id":"ENSG00000008710","gene":"PKD1","status":"solved","strategy":["familial_mutation"]}]},{"id":"9","father":"5","mother":"4","genes":[],"birthDate":{"range":{"years":10},"year":1950},"features":[],"aliveAndWell":true,"sex":"female","lastName":"Williams","nonstandard_features":[],"comments":"reportedly no kidney cysts","firstName":"Emily"},{"id":"10","sex":"male","externalId":"hgfgfg","birthDate":{"year":1900},"lifeStatus":"deceased","deceasedAge":"99","deceasedCause":"stroke","deathDate":{"year":1999},"features":[],"nonstandard_features":[],"genes":[]},{"id":"11","father":"10","mother":"9","genes":[],"features":[],"aliveAndWell":true,"sex":"female","nonstandard_features":[]},{"id":"12","father":"7","mother":"6","numPersons":"4","genes":[],"features":[],"sex":"male","nonstandard_features":[]},{"id":"13","father":"7","mother":"6","genes":[],"birthDate":{"range":{"years":10},"year":1960},"features":[],"sex":"female","lastName":"Farley","nonstandard_features":[],"firstName":"May"},{"id":"14","genes":[],"features":[],"sex":"male","nonstandard_features":[]},{"id":"15","father":"14","mother":"13","genes":[],"carrierStatus":"affected","birthDate":{"month":9,"year":2016},"features":[],"sex":"male","deathDate":{"month":1,"year":2017,"day":11},"lifeStatus":"deceased","nonstandard_features":[],"disorders":["190685"],"firstName":"Seth"},{"id":"16","sex":"male"},{"id":"17","father":"16","mother":"13","genes":[],"birthDate":{"year":1988},"features":[],"aliveAndWell":true,"sex":"female","nonstandard_features":[],"firstName":"Quinn"}]

Fixed

Assignee

Andrew Misyura

Reporter

Andrew Misyura

Labels

None

External issue ID

None

Epic Link

Components

Fix versions

Affects versions

Priority

Medium