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

Update HL7Monitor asset integration #877

Merged
merged 4 commits into from
Jun 27, 2022
Merged

Conversation

iamsdas
Copy link
Contributor

@iamsdas iamsdas commented Jun 23, 2022

fixes: #801
related to: ohcnetwork/care_fe#2159

@iamsdas iamsdas requested a review from a team as a code owner June 23, 2022 13:59
@iamsdas iamsdas marked this pull request as draft June 23, 2022 14:02
@iamsdas iamsdas requested a review from gigincg June 23, 2022 14:34
@iamsdas iamsdas marked this pull request as ready for review June 24, 2022 11:37
action = request.data["action"]
asset: Asset = self.get_object()
result = AssetClasses(asset.asset_class).handle_action(action)
asset_class = AssetClasses[asset.asset_class].value(asset.meta)
Copy link
Member

Choose a reason for hiding this comment

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

Handle unknown asset class in this method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The error details are only returned when there is some validation error (post request body has missing/invalid parameters) with a status of 400. In the case of all other errors, only a message of "Internal server error" is returned with a status of 500. So, will there be any point in raising a separate new error? In any case, it is all inside a try-except block.

Copy link
Member

Choose a reason for hiding this comment

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

ideally, internal server errors are reserved for errors that are unknown in nature. since these are known exceptions we try to handle as much as possible.

Copy link
Member

Choose a reason for hiding this comment

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

Make this a separate issue and start a separate PR if required.

@vigneshhari
Copy link
Member

@gigincg please review.

@iamsdas iamsdas requested a review from vigneshhari June 27, 2022 14:21
@vigneshhari vigneshhari merged commit bfe9a67 into ohcnetwork:master Jun 27, 2022
@iamsdas iamsdas deleted the assetint branch June 28, 2022 05:42
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.

Backend: Update asset/action API for proxying HL7 Monitor Requests through care_be (Details to be Added)
2 participants