Skip to content

Commit 697101c

Browse files
authored
Merge pull request #71 from gcivil-nyu-org/darsh
Made changes to develop so PR can be created to prod for deployment
2 parents 90b58e3 + e5b5467 commit 697101c

File tree

9 files changed

+275
-179
lines changed

9 files changed

+275
-179
lines changed

eblogs.txt

310 Bytes
Binary file not shown.

nomz/apps.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
class NomzConfig(AppConfig):
55
name = 'nomz'
6+
7+
def ready(self):
8+
from . import signals # noqa: F401
Lines changed: 153 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generated by Django 6.0.2 on 2026-03-06 23:44
1+
# Generated by Django 6.0.2 on 2026-03-06 23:44 (patched)
22

33
import django.db.models.deletion
44
from django.db import migrations, models
@@ -7,105 +7,178 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('nomz', '0001_initial'),
10+
("nomz", "0002_restaurant_restaurantphoto"),
11+
("nomz", "0002_loginlog"),
1112
]
1213

1314
operations = [
1415
migrations.CreateModel(
15-
name='DataIngestionRun',
16+
name="DataIngestionRun",
1617
fields=[
17-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18-
('dataset', models.CharField(max_length=64)),
19-
('status', models.CharField(choices=[('running', 'Running'), ('success', 'Success'), ('failed', 'Failed')], default='running', max_length=20)),
20-
('started_at', models.DateTimeField(auto_now_add=True)),
21-
('finished_at', models.DateTimeField(blank=True, null=True)),
22-
('records_fetched', models.IntegerField(default=0)),
23-
('records_processed', models.IntegerField(default=0)),
24-
('records_created', models.IntegerField(default=0)),
25-
('records_updated', models.IntegerField(default=0)),
26-
('records_matched', models.IntegerField(default=0)),
27-
('records_skipped', models.IntegerField(default=0)),
28-
('error_count', models.IntegerField(default=0)),
29-
('error_log', models.JSONField(blank=True, default=list)),
18+
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
19+
("dataset", models.CharField(max_length=64)),
20+
("status", models.CharField(choices=[("running", "Running"), ("success", "Success"), ("failed", "Failed")], default="running", max_length=20)),
21+
("started_at", models.DateTimeField(auto_now_add=True)),
22+
("finished_at", models.DateTimeField(blank=True, null=True)),
23+
("records_fetched", models.IntegerField(default=0)),
24+
("records_processed", models.IntegerField(default=0)),
25+
("records_created", models.IntegerField(default=0)),
26+
("records_updated", models.IntegerField(default=0)),
27+
("records_matched", models.IntegerField(default=0)),
28+
("records_skipped", models.IntegerField(default=0)),
29+
("error_count", models.IntegerField(default=0)),
30+
("error_log", models.JSONField(blank=True, default=list)),
3031
],
3132
options={
32-
'ordering': ['-started_at'],
33+
"ordering": ["-started_at"],
3334
},
3435
),
3536
migrations.CreateModel(
36-
name='Restaurant',
37+
name="RestaurantSourceRecord",
3738
fields=[
38-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
39-
('name', models.CharField(max_length=255)),
40-
('display_name', models.CharField(blank=True, max_length=255)),
41-
('name_normalized', models.CharField(db_index=True, max_length=255)),
42-
('building', models.CharField(blank=True, max_length=64, null=True)),
43-
('street', models.CharField(blank=True, max_length=255, null=True)),
44-
('borough', models.CharField(blank=True, max_length=80, null=True)),
45-
('zip_code', models.CharField(blank=True, db_index=True, max_length=10, null=True)),
46-
('phone', models.CharField(blank=True, max_length=30, null=True)),
47-
('website', models.URLField(blank=True, max_length=500, null=True)),
48-
('cuisine_tags', models.JSONField(blank=True, default=list)),
49-
('latitude', models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True)),
50-
('longitude', models.DecimalField(blank=True, decimal_places=6, max_digits=10, null=True)),
51-
('composite_score', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)),
52-
('grade_latest', models.CharField(blank=True, max_length=16, null=True)),
53-
('grade_score_latest', models.IntegerField(blank=True, null=True)),
54-
('last_inspection_date', models.DateField(blank=True, null=True)),
55-
('composite_score_calculated_at', models.DateTimeField(blank=True, null=True)),
56-
('is_active', models.BooleanField(default=True)),
57-
('created_at', models.DateTimeField(auto_now_add=True)),
58-
('updated_at', models.DateTimeField(auto_now=True)),
39+
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
40+
("source", models.CharField(choices=[("EATERIES", "Directory of Eateries"), ("DINING_OUT", "Dining Out NYC Locations"), ("DOHMH", "DOHMH Restaurant Inspection Results")], max_length=20)),
41+
("external_id", models.CharField(max_length=200)),
42+
("external_name", models.CharField(max_length=255)),
43+
("external_address", models.CharField(blank=True, max_length=255, null=True)),
44+
("raw_payload", models.JSONField(blank=True, null=True)),
45+
("confidence", models.DecimalField(decimal_places=3, default=0.0, max_digits=4)),
46+
("source_url", models.URLField(blank=True, max_length=500, null=True)),
47+
("first_seen_at", models.DateTimeField(auto_now_add=True)),
48+
("last_seen_at", models.DateTimeField(auto_now=True)),
49+
("restaurant", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="sources", to="nomz.restaurant")),
5950
],
6051
options={
61-
'ordering': ['name'],
62-
'indexes': [models.Index(fields=['name_normalized', 'zip_code'], name='nomz_restau_name_no_1bc4bb_idx'), models.Index(fields=['borough', 'zip_code'], name='nomz_restau_borough_8e6a1a_idx'), models.Index(fields=['is_active'], name='nomz_restau_is_acti_f59dd9_idx'), models.Index(fields=['latitude', 'longitude'], name='nomz_restau_latitud_09565a_idx')],
52+
"indexes": [
53+
models.Index(fields=["source", "external_id"], name="nomz_source_ext_1"),
54+
models.Index(fields=["restaurant", "source"], name="nomz_source_rest_2"),
55+
],
56+
"unique_together": {("source", "external_id")},
6357
},
6458
),
6559
migrations.CreateModel(
66-
name='InspectionRecord',
60+
name="InspectionRecord",
6761
fields=[
68-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
69-
('inspection_date', models.DateField()),
70-
('inspection_key', models.CharField(max_length=200)),
71-
('grade', models.CharField(blank=True, max_length=12, null=True)),
72-
('score', models.IntegerField(blank=True, null=True)),
73-
('critical_violations', models.IntegerField(default=0)),
74-
('noncritical_violations', models.IntegerField(default=0)),
75-
('violation_count', models.IntegerField(default=0)),
76-
('inspection_type', models.CharField(blank=True, max_length=128, null=True)),
77-
('action', models.CharField(blank=True, max_length=255, null=True)),
78-
('violations', models.JSONField(blank=True, default=list)),
79-
('camis', models.CharField(blank=True, max_length=80, null=True)),
80-
('boro', models.CharField(blank=True, max_length=80, null=True)),
81-
('raw_payload', models.JSONField(blank=True, null=True)),
82-
('created_at', models.DateTimeField(auto_now_add=True)),
83-
('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='inspections', to='nomz.restaurant')),
62+
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
63+
("inspection_date", models.DateField()),
64+
("inspection_key", models.CharField(max_length=200)),
65+
("grade", models.CharField(blank=True, max_length=12, null=True)),
66+
("score", models.IntegerField(blank=True, null=True)),
67+
("critical_violations", models.IntegerField(default=0)),
68+
("noncritical_violations", models.IntegerField(default=0)),
69+
("violation_count", models.IntegerField(default=0)),
70+
("inspection_type", models.CharField(blank=True, max_length=128, null=True)),
71+
("action", models.CharField(blank=True, max_length=255, null=True)),
72+
("violations", models.JSONField(blank=True, default=list)),
73+
("camis", models.CharField(blank=True, max_length=80, null=True)),
74+
("boro", models.CharField(blank=True, max_length=80, null=True)),
75+
("raw_payload", models.JSONField(blank=True, null=True)),
76+
("created_at", models.DateTimeField(auto_now_add=True)),
77+
("restaurant", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="inspections", to="nomz.restaurant")),
8478
],
8579
options={
86-
'ordering': ['-inspection_date'],
87-
'indexes': [models.Index(fields=['restaurant', 'inspection_date'], name='nomz_inspec_restaur_035d0b_idx'), models.Index(fields=['grade'], name='nomz_inspec_grade_c214b2_idx')],
88-
'unique_together': {('restaurant', 'inspection_key')},
80+
"ordering": ["-inspection_date"],
81+
"indexes": [
82+
models.Index(fields=["restaurant", "inspection_date"], name="nomz_insp_rest_1"),
83+
models.Index(fields=["grade"], name="nomz_insp_grade_1"),
84+
],
85+
"unique_together": {("restaurant", "inspection_key")},
8986
},
9087
),
91-
migrations.CreateModel(
92-
name='RestaurantSourceRecord',
93-
fields=[
94-
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
95-
('source', models.CharField(choices=[('EATERIES', 'Directory of Eateries'), ('DINING_OUT', 'Dining Out NYC Locations'), ('DOHMH', 'DOHMH Inspection Results')], max_length=20)),
96-
('external_id', models.CharField(max_length=200)),
97-
('external_name', models.CharField(max_length=255)),
98-
('external_address', models.CharField(blank=True, max_length=255, null=True)),
99-
('raw_payload', models.JSONField(blank=True, null=True)),
100-
('confidence', models.DecimalField(decimal_places=3, default=0.0, max_digits=4)),
101-
('source_url', models.URLField(blank=True, max_length=500, null=True)),
102-
('first_seen_at', models.DateTimeField(auto_now_add=True)),
103-
('last_seen_at', models.DateTimeField(auto_now=True)),
104-
('restaurant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='sources', to='nomz.restaurant')),
105-
],
106-
options={
107-
'indexes': [models.Index(fields=['source', 'external_id'], name='nomz_restau_source_160b12_idx'), models.Index(fields=['restaurant', 'source'], name='nomz_restau_restaur_446d59_idx')],
108-
'unique_together': {('source', 'external_id')},
109-
},
88+
migrations.AddField(
89+
model_name="restaurant",
90+
name="neighborhood",
91+
field=models.CharField(blank=True, default="", max_length=100),
92+
),
93+
migrations.AddField(
94+
model_name="restaurant",
95+
name="cuisine",
96+
field=models.CharField(blank=True, default="", max_length=100),
97+
),
98+
migrations.AddField(
99+
model_name="restaurant",
100+
name="display_name",
101+
field=models.CharField(blank=True, default="", max_length=255),
102+
),
103+
migrations.AddField(
104+
model_name="restaurant",
105+
name="name_normalized",
106+
field=models.CharField(blank=True, db_index=True, default="", max_length=255),
107+
),
108+
migrations.AddField(
109+
model_name="restaurant",
110+
name="building",
111+
field=models.CharField(blank=True, max_length=64, null=True),
112+
),
113+
migrations.AddField(
114+
model_name="restaurant",
115+
name="street",
116+
field=models.CharField(blank=True, max_length=255, null=True),
117+
),
118+
migrations.AddField(
119+
model_name="restaurant",
120+
name="borough",
121+
field=models.CharField(blank=True, max_length=80, null=True),
122+
),
123+
migrations.AddField(
124+
model_name="restaurant",
125+
name="zip_code",
126+
field=models.CharField(blank=True, db_index=True, max_length=10, null=True),
127+
),
128+
migrations.AddField(
129+
model_name="restaurant",
130+
name="cuisine_tags",
131+
field=models.JSONField(blank=True, default=list),
132+
),
133+
migrations.AddField(
134+
model_name="restaurant",
135+
name="latitude",
136+
field=models.DecimalField(blank=True, decimal_places=6, max_digits=9, null=True),
137+
),
138+
migrations.AddField(
139+
model_name="restaurant",
140+
name="longitude",
141+
field=models.DecimalField(blank=True, decimal_places=6, max_digits=10, null=True),
142+
),
143+
migrations.AddField(
144+
model_name="restaurant",
145+
name="composite_score",
146+
field=models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True),
147+
),
148+
migrations.AddField(
149+
model_name="restaurant",
150+
name="grade_latest",
151+
field=models.CharField(blank=True, max_length=16, null=True),
152+
),
153+
migrations.AddField(
154+
model_name="restaurant",
155+
name="grade_score_latest",
156+
field=models.IntegerField(blank=True, null=True),
157+
),
158+
migrations.AddField(
159+
model_name="restaurant",
160+
name="last_inspection_date",
161+
field=models.DateField(blank=True, null=True),
162+
),
163+
migrations.AddField(
164+
model_name="restaurant",
165+
name="composite_score_calculated_at",
166+
field=models.DateTimeField(blank=True, null=True),
167+
),
168+
migrations.AddIndex(
169+
model_name="restaurant",
170+
index=models.Index(fields=["name_normalized", "zip_code"], name="nomz_restau_name_no_1bc4bb_idx"),
171+
),
172+
migrations.AddIndex(
173+
model_name="restaurant",
174+
index=models.Index(fields=["borough", "zip_code"], name="nomz_restau_borough_8e6a1a_idx"),
175+
),
176+
migrations.AddIndex(
177+
model_name="restaurant",
178+
index=models.Index(fields=["is_active"], name="nomz_restau_is_acti_f59dd9_idx"),
179+
),
180+
migrations.AddIndex(
181+
model_name="restaurant",
182+
index=models.Index(fields=["latitude", "longitude"], name="nomz_restau_latitud_09565a_idx"),
110183
),
111184
]

nomz/migrations/0002_restaurant_alter_userprofile_id.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@
66
class Migration(migrations.Migration):
77

88
dependencies = [
9-
('nomz', '0001_initial'),
9+
('nomz', '0002_add_nyc_ingestion_models'),
1010
]
1111

1212
operations = [
13-
migrations.CreateModel(
14-
name='Restaurant',
15-
fields=[
16-
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
17-
('name', models.CharField(max_length=200)),
18-
('neighborhood', models.CharField(max_length=100)),
19-
('description', models.TextField()),
20-
('cuisine', models.CharField(max_length=100)),
21-
],
22-
),
2313
migrations.AlterField(
2414
model_name='userprofile',
2515
name='id',

nomz/migrations/0003_diningoutlocation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Migration(migrations.Migration):
88

99
dependencies = [
10-
('nomz', '0002_add_nyc_ingestion_models'),
10+
('nomz', '0002_restaurant_alter_userprofile_id'),
1111
]
1212

1313
operations = [
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Generated by Django 6.0.2 on 2026-03-08 19:37
2+
3+
import django.db.models.deletion
4+
from django.conf import settings
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('nomz', '0003_loginlog_is_suspicious'),
12+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
13+
]
14+
15+
operations = [
16+
migrations.AlterField(
17+
model_name='restaurant',
18+
name='owner',
19+
field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='restaurant_profile', to=settings.AUTH_USER_MODEL),
20+
),
21+
]

0 commit comments

Comments
 (0)