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

fix: Unable to do addSegment and then do ('PV1.1', <value>) --> Invalid Index #33

Open
Bugs5382 opened this issue Dec 16, 2023 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@Bugs5382
Copy link
Owner

const message = new Message({
    messageHeader: {
      msh_9_1: "ADT",
      msh_9_2: "AO1",
      msh_10: "CONTROL_ID"
    }
  })

  let segment = message.addSegment('PV1')
  segment.set('PV1.1', 1) // this should be a valid since it's not MSH, BHS, or FHS.

Current getting error:

Can't have an index < 1 or not be a valid number.
HL7FatalError: Can't have an index < 1 or not be a valid number.
    at Segment.writeCore (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/node-hl7-client/lib/cjs/builder/modules/segment.js:100:19)
    at Segment.write (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/node-hl7-client/lib/cjs/builder/modules/nodeBase.js:183:21)
    at Segment.set (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/node-hl7-client/lib/cjs/builder/modules/segment.js:71:22)
    at Object.<anonymous> (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/__tests__/fastify.tests.ts:31:14)
    at Promise.then.completed (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/utils.js:298:28)
    at new Promise (<anonymous>)
    at callAsyncCircusFn (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/utils.js:231:10)
    at _callCircusTest (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/run.js:316:40)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async _runTest (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/run.js:252:3)
    at async _runTestsForDescribeBlock (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/run.js:126:9)
    at async run (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/run.js:71:3)
    at async runAndTransformResultsToJestFormat (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
    at async jestAdapter (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
    at async runTestInternal (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-runner/build/runTest.js:367:16)
    at async runTest (/Users/userdirectory/Documents/projects/GIT.nosync/fastify-hl7/node_modules/jest-runner/build/runTest.js:444:34)

Need to figure out where it is. I check the based NPM that I used as a base, but can't find the cause. Backlog for now..

@Bugs5382 Bugs5382 added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Dec 16, 2023
@Bugs5382
Copy link
Owner Author

Still failing... help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant