Skip to content

Issues with deepInputProperty and deepInputDate #36

@dancornell

Description

@dancornell

There are at least two issues in lib/leafLevel.js where properties are not properly accessed. Specifically deepInputProperty and deepInputDate do not work when the value of deepProperty needs to drill down into the input below the top-level.

For example, if the input to deepInputProperty is:

{
  "date_time": {
    "low": {
      "date": "2011-09-25T00:00:00.000Z",
      "precision": "day"
    }
  },
  "identifiers": [
    {
      "identifier": "2.16.840.1.113883.3.3388.1.1.1.310936.3.83899160.2.1",
      "extension": "A71337134-4d92-4550-983c-561dc595dd59"
    }
  ],
  "negation_indicator": false,
  "problem": {
    "code": {
      "name": "Asthma",
      "code": "195967001",
      "code_system_name": "SNOMED CT"
    },
    "date_time": {
      "low": {
        "date": "2011-09-25T00:00:00.000Z",
        "precision": "day"
      }
    }
  },
  "onset_age": "51",
  "onset_age_unit": "Year",
  "status": {
    "name": "Active",
    "date_time": {
      "low": {
        "date": "2011-09-25T00:00:00.000Z",
        "precision": "day"
      }
    }
  },
  "source_list_identifiers": [
    {
      "identifier": "2.16.840.1.113883.3.3388.1.1.1.310936.3",
      "extension": "83899160"
    }
  ]
}

And the value of deepProperty is: problem.code.name

The return would be undefined rather than the expected value of "Asthma"

This because the code:

var value = input[deepProperty];

Only works if deepProperty does not try to drill down below the top level (ie there are no '.' characters in it)

This behavior is present in at least deepInputProperty and deepInputDate but may exist elsewhere.

I've patched on my install and will submit a pull request here shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions