Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with deepInputProperty and deepInputDate #36

Open
dancornell opened this issue Nov 15, 2023 · 0 comments
Open

Issues with deepInputProperty and deepInputDate #36

dancornell opened this issue Nov 15, 2023 · 0 comments

Comments

@dancornell
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant