-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1724 from ChildMindInstitute/release/2025.02.0
Release/2025.02.0 [main]
- Loading branch information
Showing
33 changed files
with
780 additions
and
945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# Startup script for feature branches on ECS Fargate with DataDog enabled | ||
|
||
set -eo pipefail | ||
set -o nounset | ||
|
||
ENV=testing /fastapi-migrate | ||
/fastapi-start-datadog | ||
/start-backend-datadog |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
if [ "${DD_TRACE_ENABLED}" == "true" ]; then | ||
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") && \ | ||
export DD_AGENT_HOST=$(curl http://169.254.169.254/latest/meta-data/local-ipv4 -H "X-aws-ec2-metadata-token: $TOKEN") | ||
export LOG_JSON_FORMAT=true | ||
fi | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
# https://www.uvicorn.org/settings/ | ||
export UVICORN_HOST="0.0.0.0" | ||
export UVICORN_PORT=80 | ||
|
||
uvicorn main:app \ | ||
--host ${UVICORN_HOST} --port ${UVICORN_PORT} \ | ||
--reload --proxy-headers \ | ||
--log-config uvicorn_disable_logging.json |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [ "${DD_TRACE_ENABLED}" == "true" ]; then | ||
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") && \ | ||
export DD_AGENT_HOST=$(curl http://169.254.169.254/latest/meta-data/local-ipv4 -H "X-aws-ec2-metadata-token: $TOKEN") | ||
export LOG_JSON_FORMAT=true | ||
fi | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
taskiq scheduler scheduler:scheduler -fsd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [ "${DD_TRACE_ENABLED}" == "true" ]; then | ||
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") && \ | ||
export DD_AGENT_HOST=$(curl http://169.254.169.254/latest/meta-data/local-ipv4 -H "X-aws-ec2-metadata-token: $TOKEN") | ||
export LOG_JSON_FORMAT=true | ||
fi | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
taskiq worker worker:worker -fsd |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
class AvailableIntegrations(str, Enum): | ||
LORIS = "LORIS" | ||
PROLIFIC = "PROLIFIC" | ||
FUTURE = "FUTURE" | ||
|
||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import json | ||
|
||
from pydantic import BaseModel | ||
|
||
from apps.integrations.db.schemas import IntegrationsSchema | ||
|
||
|
||
class ProlificIntegration(BaseModel): | ||
api_key: str | ||
|
||
@classmethod | ||
def from_schema(cls, schema: IntegrationsSchema): | ||
configuration = json.loads(schema.configuration.replace("'", '"')) | ||
return cls(api_key=configuration["api_key"]) | ||
|
||
def __repr__(self): | ||
return "ProlificIntegration()" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from gettext import gettext as _ | ||
|
||
from apps.shared.exception import UnauthorizedError | ||
|
||
|
||
class ProlificInvalidApiTokenError(UnauthorizedError): | ||
message = _("Prolific token is invalid.") |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import uuid | ||
|
||
import requests | ||
|
||
from apps.integrations.crud.integrations import IntegrationsCRUD | ||
from apps.integrations.db.schemas import IntegrationsSchema | ||
from apps.integrations.domain import AvailableIntegrations | ||
from apps.integrations.prolific.domain import ProlificIntegration | ||
from apps.integrations.prolific.errors import ProlificInvalidApiTokenError | ||
from apps.users.domain import User | ||
|
||
|
||
class ProlificIntegrationService: | ||
def __init__(self, applet_id: uuid.UUID, session, user: User) -> None: | ||
self.applet_id = applet_id | ||
self.session = session | ||
self.user = user | ||
self.type = AvailableIntegrations.PROLIFIC | ||
|
||
async def create_prolific_integration(self, api_key: str) -> ProlificIntegration: | ||
prolific_response = requests.get( | ||
"https://api.prolific.com/api/v1/users/me/", | ||
headers={"Authorization": f"Token {api_key}", "Content-Type": "application/json"}, | ||
) | ||
|
||
if prolific_response.status_code != 200: | ||
raise ProlificInvalidApiTokenError() | ||
|
||
integration_schema = await IntegrationsCRUD(self.session).create( | ||
IntegrationsSchema( | ||
applet_id=self.applet_id, | ||
type=self.type, | ||
configuration={ | ||
"api_key": api_key, | ||
}, | ||
) | ||
) | ||
|
||
return ProlificIntegration.from_schema(integration_schema) |
Oops, something went wrong.