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

Schema for home, case, billing period, and related data (no homeowner, coach yet) #251

Merged
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
fb43e4f
Modify schema.prisma
ethanstrominger Sep 10, 2024
149f1d4
Created home and case entries
ethanstrominger Sep 19, 2024
45ff6fb
Add file table
ethanstrominger Sep 20, 2024
4a8a40c
Created all tables related to Case
ethanstrominger Sep 23, 2024
9ad5606
Add summary output and relationships
ethanstrominger Sep 24, 2024
9fe9cfa
Implement user-case many to many and change id to int
ethanstrominger Sep 26, 2024
4825e02
Added contacts.
ethanstrominger Sep 30, 2024
d081bc9
Required caseId and userId combination to be unique.
ethanstrominger Sep 30, 2024
cd8e798
Reimplement schema.prisma based on ERD
ethanstrominger Oct 4, 2024
01f30a1
Remigrate scripts to have two clean scripts
ethanstrominger Oct 4, 2024
95d9b0a
Add comment to schema.prisma
ethanstrominger Oct 4, 2024
33c8670
Add test files
vladistan Sep 8, 2024
1083acd
Added experimental XML parsing.
AdamFinkle Aug 21, 2024
f5bffa2
WIP saving progress
vladistan Sep 4, 2024
0e7cfc5
Rename directory
ethanstrominger Oct 23, 2024
afe0653
Rename rules-engine to python
ethanstrominger Oct 23, 2024
e3d822a
Co-authored-by: AdamFinkle <AdamFinkle@users.noreply.github.com>
ethanstrominger Oct 25, 2024
549024e
Merge branch 'schema-prisma-124-v2' of https://github.com/ethanstromi…
AdamFinkle Oct 25, 2024
4ccc659
Changed prisma to match newly-modified ERD.
AdamFinkle Oct 25, 2024
c15842c
Co-authored-by: AdamFinkle <AdamFinkle@users.noreply.github.com>
ethanstrominger Oct 26, 2024
5c7d610
Restore package.json, package-lock.json from HEAD~v2 to fix prisma issue
ethanstrominger Oct 26, 2024
ca47512
Merge branch 'main' of github.com:codeforboston/home-energy-analysis-…
ethanstrominger Nov 11, 2024
934f406
Modify schema.prisma to match ERD
ethanstrominger Nov 11, 2024
7a2a149
Merge branch 'main' of github.com:codeforboston/home-energy-analysis-…
ethanstrominger Dec 9, 2024
d9e187a
Formatting
ethanstrominger Dec 9, 2024
d536a45
Formatting
ethanstrominger Dec 9, 2024
905e8b6
Fix incorrect change to var name
ethanstrominger Dec 10, 2024
5a889d3
Merge branch 'main' of github.com:codeforboston/home-energy-analysis-…
ethanstrominger Dec 10, 2024
2a30578
Merge branch 'main' into schema-prisma-124-v2
ethanstrominger Dec 10, 2024
6284ee5
Restore missing file
ethanstrominger Dec 10, 2024
486c0e0
Reconcile with main
ethanstrominger Dec 10, 2024
a984d13
Add return key
ethanstrominger Feb 7, 2025
66728ab
Merge branch 'main' of github.com:codeforboston/home-energy-analysis-…
ethanstrominger Feb 7, 2025
3be162f
Merge branch 'main' into schema-prisma-124-v2
ethanstrominger Feb 7, 2025
c2bf708
Remove return key
ethanstrominger Feb 7, 2025
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
Prev Previous commit
Next Next commit
Reconcile with main
ethanstrominger committed Dec 10, 2024
commit 486c0e0b33234578e0f84fb889fff40df5a2c878
98 changes: 0 additions & 98 deletions heat-stack/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions heat-stack/Dockerfile.dockerignore

This file was deleted.

1 change: 0 additions & 1 deletion python/requirements.txt
Original file line number Diff line number Diff line change
@@ -14,4 +14,3 @@ typing-extensions==4.8.0
# via
# pydantic
# pydantic-core
greenbutton_objects @ git+https://github.com/codeforboston/greenbutton_objects@main
19 changes: 0 additions & 19 deletions python/src/rules_engine/parser.py
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@
from datetime import datetime, timedelta
from enum import StrEnum

from greenbutton_objects import parse

from .pydantic_models import NaturalGasBillingInput, NaturalGasBillingRecordInput


@@ -89,23 +87,6 @@ def _detect_gas_company(data: str) -> NaturalGasCompany:
)


def parse_gas_bill_xml(data_file: str) -> NaturalGasBillingInput:
bill = parse.parse_feed(str(data_file))
records = []
for meter_reading in bill.usage_points[0].meter_readings:
for interval_reading in meter_reading.interval_readings:
records.append(
NaturalGasBillingRecordInput(
period_start_date=interval_reading.time_period.start, # datetime.utcfromtimestamp(interval_reading.time_period.start).date(),
period_end_date=interval_reading.time_period.start
+ interval_reading.time_period.duration, # datetime.utcfromtimestamp(interval_reading.time_period.start + interval_reading.time_period.duration).date(),
usage_therms=interval_reading.value,
inclusion_override=None,
)
)
return NaturalGasBillingInput(records=records)


def parse_gas_bill(
data: str, company: NaturalGasCompany | None = None
) -> NaturalGasBillingInput:
2 changes: 1 addition & 1 deletion python/src/rules_engine/pydantic_models.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"""

from dataclasses import dataclass
from datetime import datetime
from datetime import date, datetime
from enum import Enum
from functools import cached_property
from typing import Annotated, Any, Literal, Optional, Sequence

This file was deleted.

2 changes: 1 addition & 1 deletion python/tests/test_rules_engine/test_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from datetime import datetime
from datetime import date, datetime
from typing import Any

import pytest
27 changes: 0 additions & 27 deletions python/tests/test_rules_engine/test_parser.py
Original file line number Diff line number Diff line change
@@ -23,12 +23,6 @@ def _read_gas_bill_national_grid() -> str:
return f.read()


def _read_gas_bill_xml() -> str:
"""Read a test natural gas bill from a test National Grid CSV"""
# TODO: Pass the file as a string rather than passing the file name
return ROOT_DIR.parent / "parsing" / "xml" / "abridged" / "gas_direct.xml"


def _validate_eversource(result):
"""Validate the result of reading an Eversource CSV."""
assert len(result.records) == 36
@@ -63,23 +57,6 @@ def _validate_national_grid(result):
assert second_row.inclusion_override == None


def _validate_xml_natural_gas(result):
"""Validate the result of reading a National Grid CSV."""
assert len(result.records) == 5
for row in result.records:
assert isinstance(row, NaturalGasBillingRecordInput)

# input: Natural gas billing,11/5/2020,12/3/2020,36,therms,$65.60 ,
# from excel: 11/6/2020,12/3/2020,28,36,,1,1.29,0.99

second_row = result.records[1]
assert second_row.period_start_date == date(2021, 6, 30)
assert second_row.period_end_date == date(2021, 7, 28)
assert isinstance(second_row.usage_therms, float)
assert second_row.usage_therms == 14
assert second_row.inclusion_override == None


def test_parse_gas_bill():
"""
Tests the logic of parse_gas_bill.
@@ -110,10 +87,6 @@ def test_parse_gas_bill_national_grid():
)


def test_parse_xml_natural_gas():
_validate_xml_natural_gas(parser.parse_gas_bill_xml(_read_gas_bill_xml()))


def test_detect_natural_gas_company():
"""Tests if the natural gas company is correctly detected from the parsed csv."""
read_eversource = _read_gas_bill_eversource()

This file was deleted.

This file was deleted.

This file was deleted.


Unchanged files with check annotations Beta

import NonHeatingUsage from './assets/NonHeatingUsage.svg'
import NotAllowedInCalculations from './assets/NotAllowedInCalculations.svg'
import { tr } from '@faker-js/faker'

Check warning on line 20 in heat-stack/app/components/ui/heat/CaseSummaryComponents/EnergyUseHistoryChart.tsx

GitHub Actions / ⬣ Heat-Stack - ESLint

`@faker-js/faker` import should occur before import of `react`
// type NaturalGasBillRecord = z.infer<typeof NaturalGasBillRecordZod>
// const naturalGasBillRecord01: NaturalGasBillRecord = {
import * as React from 'react'
import { cn } from '#app/utils/misc.tsx'
import { cva, VariantProps } from 'class-variance-authority'

Check warning on line 4 in heat-stack/app/components/ui/table.tsx

GitHub Actions / ⬣ Heat-Stack - ESLint

`class-variance-authority` import should occur before import of `react`

Check warning on line 4 in heat-stack/app/components/ui/table.tsx

GitHub Actions / ⬣ Heat-Stack - ESLint

Imports "VariantProps" are only used as type
const Table = React.forwardRef<
HTMLTableElement,