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

Sweep: Create growth page #32

Closed
wants to merge 2 commits into from
Closed

Sweep: Create growth page #32

wants to merge 2 commits into from

Conversation

sweep-ai[bot]
Copy link
Contributor

@sweep-ai sweep-ai bot commented May 19, 2024

Description

This pull request introduces a new page dedicated to tracking and analyzing the growth of my newborn baby. It includes SQL queries for fetching growth events and displaying them in a line chart, showing the baby's weight over time.

Summary

  • Added a new page growth.md under pages directory for growth tracking and analysis.
  • The page includes a SQL query to select growth events by day.
  • Implemented a line chart to visualize the baby's weight over time using the growth_by_day SQL query results.
  • Modified events.sql query under queries directory to:
    • Adjust the select statement for better readability.
    • Include a new case in the select statement to handle Growth type events and calculate the weight in kilograms.
    • Group all selected columns properly to ensure accurate data retrieval.
  • These changes aim to provide a comprehensive view of the baby's growth progress, leveraging SQL for data manipulation and visualization tools for easy interpretation.

Fixes #29.


💡 To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

This is an automated message generated by Sweep AI.

Copy link
Contributor Author

sweep-ai bot commented May 19, 2024

Rollback Files For Sweep

  • Rollback changes to pages/growth.md
  • Rollback changes to queries/events.sql

This is an automated message generated by Sweep AI.

Copy link
Contributor Author

sweep-ai bot commented May 19, 2024

Sweep: PR Review

pages/growth.md

Introduced a new markdown file for tracking and analyzing growth data, including SQL queries and visualization components.

Sweep Found These Issues

  • The SQL query in the growth_by_day block may fail if the "Start Condition" field does not contain a space, causing split_part to return an error.
  • cast(split_part("Start Condition", ' ', 1) as decimal) as weight_kg

    View Diff


queries/events.sql

The query now includes 'Growth' and 'Pump' events and adds a new computed column weight_kg for 'Growth' events.

Sweep Found These Issues

  • The removal of the where clause that excluded 'Growth' and 'Pump' events may lead to unintended inclusion of these events in the results, potentially affecting downstream processing or analytics.
  • from events

    View Diff

  • The new weight_kg column assumes that the "Start Condition" field for 'Growth' events always contains a numeric value as the first part, which may not be the case and could lead to casting errors.
  • case
    when "Type" = 'Growth' then cast(split_part("Start Condition", ' ', 1) as decimal)
    else null
    end as weight_kg

    View Diff


@sweep-ai sweep-ai bot added the sweep label May 19, 2024
@sweep-ai sweep-ai bot mentioned this pull request May 19, 2024
@archiewood
Copy link
Owner

Here is the format of a typical growth entry. Note there is no space between the weight and kg

"Growth","2024-05-16 15:18",,,"4.48kg","54.5cm","38cm",

Copy link
Contributor Author

sweep-ai bot commented May 19, 2024

🚀 Resolved via 1fac84a

Here were the changes I made:

--- queries/events.sql
+++ queries/events.sql
--- 
+++ 
@@ -12,8 +12,16 @@
   "End Condition",
   notes,
   case
-    when "Type" = 'Growth' then cast(split_part("Start Condition", ' ', 1) as decimal)
+    when "Type" = 'Growth' then cast(split_part("Start Condition", 'kg', 1) as decimal)
     else null 
-  end as weight_kg
+  end as weight_kg,
+  case
+    when "Type" = 'Growth' then cast(split_part(split_part("Start Condition", 'kg', 2), 'cm', 1) as decimal)
+    else null
+  end as length_cm,
+  case
+    when "Type" = 'Growth' then cast(split_part(split_part("Start Condition", 'cm', 2), 'cm', 1) as decimal) 
+    else null
+  end as head_circumference_cm  
 from events
 GROUP BY all


This is an automated message generated by Sweep AI.

@archiewood archiewood closed this May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sweep: Create growth page
1 participant