Skip to content

Conversation

@amathew8
Copy link
Contributor

@amathew8 amathew8 commented Jul 25, 2019

Related JIRA tickets:

-https://jira.amida.com/browse/HL7-22

What exactly does this PR do?

  • Added getParsedMessages function that retrieves all parsed messages for a single file given the fileId
  • Eventually it should retrieve based on filename, but that needs to added in

Do ANY of these changes introduce a breaking change? (in-scope or otherwise)

  • No

Manual test cases?

  • Create a user, then login
  • Upload a file with more than one message
  • GET /api/hl7/files/parsedMessages/fileId and you should get a list of JSON objects with the same length as the number of messages in file

Any additional context/background?

  • N/A

Screenshots (if appropriate):

Copy link
Contributor

@Perry5 Perry5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part. One small comment.

Also, does your editor automatically fix linting issues? You should always pay attention to that because when you commit a PR it makes it look like you made changes that you actually didn't. In this case, it was good. But if a change not intentionally done by you is committed, it should be pointed out.

@orndorffgrant
Copy link

orndorffgrant commented Jul 30, 2019

Eventually it should retrieve based on filename, but that needs to added in

I don't think that is necessary

Copy link

@orndorffgrant orndorffgrant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Left a couple suggestions

/** GET /api/hl7/files - Retrieves all user files */
.get(hl7Ctrl.getUserFiles);

router.route('/files/parsedMessages/:fileId')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets change this route to /files/:fileId/messages/

We want the route structure to be a resource-centric tree - so the caller specifies that they care about files then they specify which file ( :fileId) then they specify that they want the messages in that file. This follows a nice hierarchy. Also I generally avoid upper case anything in HTTP URLs, and parsed seems unnecessary because I don't think we'll ever want to GET unparsed messages.

Duckduckgo "REST" and what it stands for to get some context on why I am suggesting this structure

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might have led @amathew8 astray here. I think I suggested /pasrsedmessage/ but valid point to take it out.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean I basically agree, I just suggest messages after the fileId instead of before to make it more hierarchical 🤷‍♂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that makes sense.

@orndorffgrant
Copy link

@amathew8
Sorry for just noticing this now, but this new endpoint should get at least one test. It can be simple for now. For example:
Request all messages from sample 500 messages file. Expect length to be 500. Expect first message's content to be correct in some way.
Let me know if you need any further direction

@Perry5
Copy link
Contributor

Perry5 commented Aug 7, 2019

+1 on test

@@ -0,0 +1,3 @@
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this file?

Copy link
Contributor

@Perry5 Perry5 Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
we should try to look out for files being added before committing. I guess that's why some people discourage using git add . 🤷‍♂

done();
done();
})
.catch(done);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.catch(done);
.catch(done);

@orndorffgrant
Copy link

@amathew8 test looks good!
Can you merge develop into this branch and resolve the conflicts? (or rebase if you prefer)

Copy link
Contributor

@Perry5 Perry5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to Grants comments & merge conflict.

I ran into a weird case where after I made a request (Upload file or anything) and I try to GET parsed messages, the request hangs.
Screen Shot 2019-08-16 at 9 56 18 AM

@amathew8, @orndorffgrant did either of you run into this problem at all?

@@ -0,0 +1,3 @@
{
Copy link
Contributor

@Perry5 Perry5 Aug 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1
we should try to look out for files being added before committing. I guess that's why some people discourage using git add . 🤷‍♂

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

Successfully merging this pull request may close these issues.

4 participants