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

move to production #4178

Merged
merged 12 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion k8s/auth-service/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-auth-api
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/auth-service/values-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 2
image:
repository: eu.gcr.io/airqo-250220/airqo-stage-auth-api
tag: stage-310a6bf1-1736029641
tag: stage-5d451842-1736194286
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/device-registry/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-device-registry-api
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/exceedance/values-prod-airqo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ app:
configmap: env-exceedance-production
image:
repository: eu.gcr.io/airqo-250220/airqo-exceedance-job
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
2 changes: 1 addition & 1 deletion k8s/exceedance/values-prod-kcca.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ app:
configmap: env-exceedance-production
image:
repository: eu.gcr.io/airqo-250220/kcca-exceedance-job
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
2 changes: 1 addition & 1 deletion k8s/meta-data/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ images:
repositories:
api: eu.gcr.io/airqo-250220/airqo-meta-data-api
sitesConsumer: eu.gcr.io/airqo-250220/airqo-meta-data-sites-consumer
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/predict/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ images:
predictJob: eu.gcr.io/airqo-250220/airqo-predict-job
trainJob: eu.gcr.io/airqo-250220/airqo-train-job
predictPlaces: eu.gcr.io/airqo-250220/airqo-predict-places-air-quality
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
api:
name: airqo-prediction-api
label: prediction-api
Expand Down
2 changes: 1 addition & 1 deletion k8s/spatial/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
replicaCount: 3
image:
repository: eu.gcr.io/airqo-250220/airqo-spatial-api
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
2 changes: 1 addition & 1 deletion k8s/workflows/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ images:
initContainer: eu.gcr.io/airqo-250220/airqo-workflows-xcom
redisContainer: eu.gcr.io/airqo-250220/airqo-redis
containers: eu.gcr.io/airqo-250220/airqo-workflows
tag: prod-77f37a6f-1736183306
tag: prod-6d2ca253-1736194337
nameOverride: ''
fullnameOverride: ''
podAnnotations: {}
Expand Down
29 changes: 19 additions & 10 deletions src/workflows/airqo_etl_utils/data_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,15 @@ def format_data_types(
for col in integers:
data[col] = (
data[col]
.fillna(
""
) # Replace NaNs with empty strings to avoid errors during string operations
.astype(str) # Ensure the column is a string
.str.replace(
r"[^\d]", "", regex=True
) # Remove non-numeric characters
.str.strip() # Strip leading/trailing whitespace
.replace("", -1) # Replace empty strings with -1
.astype(np.int64) # Convert to integer
.fillna("") # Replace NaN with empty strings
.astype(str) # Convert to string
.str.strip() # Remove leading/trailing whitespace
.replace("", np.nan) # Replace empty strings with NaN for clarity
.apply(
lambda x: pd.to_numeric(x, errors="coerce")
) # Convert to numeric
.fillna(-1) # Replace NaN with -1 for invalid/missing values
.astype(np.int64) # Convert to integer type
)

return data
Expand Down Expand Up @@ -275,6 +274,16 @@ def process_data_for_api(data: pd.DataFrame) -> list:
cols = bigquery_api.get_columns(bigquery_api.hourly_measurements_table)
cols.append("battery")
data = DataValidationUtils.fill_missing_columns(data, cols=cols)
data["device_number"] = (
data["device_number"]
.fillna("")
.astype(str)
.str.strip()
.replace("", np.nan)
.apply(lambda x: pd.to_numeric(x, errors="coerce"))
.fillna(-1)
.astype(np.int64)
)

for _, row in data.iterrows():
try:
Expand Down
Loading