TheJacksonLaboratory / PhenopacketLab

An Angular/Springboot web application for the loading, editing, saving of data that follows the Phenopacket Schema
BSD 3-Clause "New" or "Revised" License
7 stars 1 forks source link

Null value in a non-null field #292

Closed ielis closed 1 year ago

ielis commented 1 year ago
  1. Open the creator
  2. Start setting the age
    • select gestational age
    • type 9 to weeks
    • type 6 to days
    • delete 6 (change my mind, I actually do not know what to put here, so I'm leaving it blank)

      I expect this sets the text field to an empty string or null, and marks the field as "tampered with"

  3. Go to Validate section and hit complete

Issue

I get the following:

image

The validator in the backend correctly points out the issue - an int field is null. The corresponding (errorneous) phenopacket would look like:

{
  "id": "whatever-phenopacket-id",
   "subject": {
      "taxonomy": {
         "id": "NCBITaxon:9606",
         "label": "Homo sapiens"
      },
      "id": "jimmy",
      "timeAtLastEncounter": {
         "gestationalAge": {
            "weeks": 9,
            "days": null
         }
      }
   },
  ...

Note the null in subject > timeAtLastEncounter > gestationalAge > days

The issue can be "fixed" if the user types a value into the field. However, this is undesirable because gestational age of e.g. P22W and P22W0D have different interpretation.

DOD

Clearing optional field won't result in a null field.

Note - this likely applies to other fields as well. See #293 for a similar issue

BethSundberg commented 1 year ago

Looks fine