Skip to content

Commit

Permalink
feat: Restrict Patients and Encounters data
Browse files Browse the repository at this point in the history
  • Loading branch information
TanookiVerde committed Aug 28, 2024
1 parent 8d4172a commit 65be002
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions app/routers/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,15 @@ async def get_patient_header(

if len(results) == 0:
raise HTTPException(status_code=404, detail="Patient not found")
else:
return results[0]

dados = results[0]
configuracao_exibicao = dados.get('exibicao', {})

if configuracao_exibicao.get('indicador', False) is False:
message = ",".join(configuracao_exibicao.get('motivos', []))
raise HTTPException(status_code=204, detail=message)

return dados



Expand Down Expand Up @@ -123,7 +130,7 @@ async def get_patient_encounters(
f"""
SELECT *
FROM `{BIGQUERY_PROJECT}`.{BIGQUERY_PATIENT_ENCOUNTERS_TABLE_ID}
WHERE cpf = '{cpf}'
WHERE cpf = '{cpf}' and exibicao.indicador = true
""",
from_file="/tmp/credentials.json",
).to_json(orient="records")
Expand Down

0 comments on commit 65be002

Please sign in to comment.