Skip to content

Commit

Permalink
NPA-2676 Attempt to fix sandbox deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
JackPlowman committed May 16, 2024
1 parent 11e32fe commit 32b35d4
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions sandbox/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from flask import Flask, request

import sandbox.api.utils as utils
from .utils import *

app = Flask(__name__)
basicConfig(level=INFO, format="%(asctime)s - %(message)s")
Expand Down Expand Up @@ -32,51 +32,51 @@ def get_related_persons() -> Union[dict, tuple]:

try:
# Check Headers
if errors := utils.check_for_errors(request):
if errors := check_for_errors(request):
return errors

identifier = request.args.get("identifier")
patient_identifier = request.args.get("patient:identifier")
include = request.args.get("_include")

if empty := utils.check_for_empty(identifier, patient_identifier):
if empty := check_for_empty(identifier, patient_identifier):
return empty

# Successful request, select response
if zero_nine := utils.check_for_validate(
if zero_nine := check_for_validate(
"9000000009",
identifier,
patient_identifier,
include,
utils.VALIDATE_RELATIONSHIP_009,
utils.VALIDATE_RELATIONSHIP_INCLUDE_009,
VALIDATE_RELATIONSHIP_009,
VALIDATE_RELATIONSHIP_INCLUDE_009,
):
return zero_nine

if two_five := utils.check_for_validate(
if two_five := check_for_validate(
"9000000025",
identifier,
patient_identifier,
include,
utils.VALIDATE_RELATIONSHIP_025,
utils.VALIDATE_RELATIONSHIP_INCLUDE_025,
VALIDATE_RELATIONSHIP_025,
VALIDATE_RELATIONSHIP_INCLUDE_025,
):
return two_five

if one_seven := utils.check_for_list(
if one_seven := check_for_list(
"9000000017",
identifier,
include,
utils.LIST_RELATIONSHIP,
utils.LIST_RELATIONSHIP_INCLUDE,
LIST_RELATIONSHIP,
LIST_RELATIONSHIP_INCLUDE,
):
return one_seven

raise ValueError("Invalid request")

except Exception as e:
logger.error(e)
return utils.generate_response(utils.load_json_file(utils.ERROR_RESPONSE), 500)
return generate_response(load_json_file(ERROR_RESPONSE), 500)


@app.route(f"/{COMMON_PATH}/QuestionnaireResponse", methods=["POST"])
Expand All @@ -88,10 +88,10 @@ def post_questionnaire_response() -> Union[dict, tuple]:
"""

try:
utils.generate_response(
utils.load_json_file(utils.QUESTIONNAIRE_RESPONSE_SUCCESS), 200
generate_response(
load_json_file(QUESTIONNAIRE_RESPONSE_SUCCESS), 200
)

except Exception as e:
logger.error(e)
return utils.generate_response(utils.load_json_file(utils.ERROR_RESPONSE), 500)
return generate_response(load_json_file(ERROR_RESPONSE), 500)

0 comments on commit 32b35d4

Please sign in to comment.