Skip to content

Hannah#6

Open
hannahwn wants to merge 1 commit into
HackYourAssignment:mainfrom
hannahwn:main
Open

Hannah#6
hannahwn wants to merge 1 commit into
HackYourAssignment:mainfrom
hannahwn:main

Conversation

@hannahwn

Copy link
Copy Markdown

No description provided.

@lassebenni lassebenni closed this May 20, 2026
@lassebenni lassebenni reopened this May 20, 2026
@github-actions

Copy link
Copy Markdown

📝 HackYourFuture auto grade

Assignment Score: 85 / 100 ✅

Status: ✅ Passed
Minimum score to pass: 60
🧪 The auto grade is experimental and still being improved

Test Details
Tasks 1-6 (Ingestion Pipeline): 70/70 — pipeline + idempotency + code patterns all pass
Task 7  (Azure CLI + Portal):   0/15  — missing output/azure_resource_groups.json
Task 8  (AI Debug Report):      15/15  — AI_DEBUG.md is filled in
----------------------------------------
Total: 85/100 — pass=true (passing threshold: 60)

@hannahwn hannahwn changed the title ingesting data example Hannah May 21, 2026
@qiraahmad

Copy link
Copy Markdown

Nice work on the Python pipeline, this is the hardest part of the assignment and you got it working end-to-end.

What’s missing: Task 7 (Azure) was not submitted. You need output/azure_resource_groups.json and a filled-in output/azure_compare.md. Your AI_DEBUG.md documents an Azure login problem, which suggests you started Task 7 but didn’t finish the deliverables.

Before merge / resubmit:

Complete Task 7 (see AZURE_LOGIN.md in the repo)
Rewrite AI_DEBUG.md around a Python pipeline bug, not Azure login, as the assignment asks you to debug code you wrote
Run bash .hyf/test.sh locally before pushing, then you should see 100/100

Comment thread ingest_api.py
Comment on lines +56 to +75
for attempt in range(1, 4):
try:
data = fetch_with_retry(API_URL, params)
hourly = data.get("hourly", {})
times = hourly.get("time", [])
temps = hourly.get("temperature_2m", [])
hums = hourly.get("relative_humidity_2m", [])
records = []
for time_str, temp, hum in zip(times, temps, hums):
records.append({
"station": "Open-Meteo Copenhagen",
"timestamp": time_str,
"temperature_c": temp,
"humidity_pct": hum,
})
return records
except Exception as e:
logger.error(f"Failed to fetch API records: {e}")
return []
raise RuntimeError("Exceeded maximum retry attempts")

@qiraahmad qiraahmad Jun 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

fetch_with_retry() already retries with exponential backoff. Wrapping it in another for attempt in range(1, 4) loop is unnecessary.

Also, the except Exception block returns [] on the first failure, which skips retries entirely. If the API is temporarily down, you silently get zero records instead of retrying.

Suggested shape:

data = fetch_with_retry(API_URL, params)
hourly = data.get("hourly", {})
# ... flatten and return records

Only return [] when the API response has no hourly data, not when a network error occurs.

Comment thread ingest_api.py
try:
response = requests.get(url, params=params, timeout=timeout)
if response.status_code >= 500:
raise requests.HTTPError(f"Server error: {response.status_code}")

@qiraahmad qiraahmad Jun 4, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

raise requests.HTTPError(f"Server error: {response.status_code}") creates an error without a .response object. Your retry check on line 31 (e.response.status_code) can crash if that path is hit.

Prefer:

response.raise_for_status()  # after checking it's not 4xx

or attach the response: response.raise_for_status() already handles this correctly for 5xx.

Comment thread models.py
Comment on lines +21 to +37
def validate_readings(raw_records: list[dict]) -> tuple[list[WeatherReading], list[dict]]:
"""Validate a list of raw records, returning valid records and errors."""
valid = []
errors = []

for i, record in enumerate(raw_records):
try:
reading = WeatherReading(**record)
valid.append(reading)
except ValidationError as e:
errors.append({
"index": i,
"record": record,
"errors": e.errors(),
})

return valid, errors No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You implemented validation twice: here in validate_readings() and correctly in validate.py as validate_records(). You can remove this as pipeline only uses validate.py.

Comment thread pipeline.py
# Records in database: 169
# Error report: output/error_report.json

raise NotImplementedError

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can remove the TODO blocks after implementing

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.

3 participants