Skip to content
Open
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
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,4 @@ google_token.json
*tanslation.txt

# Docker
pg_data/
representable_plus/data
pg_data/
26 changes: 4 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# Representable PA +
# Representable

Representable is creating maps of communities to fight for equal and impartial representation. The core web app is written in Django with Javascript/HTML/CSS frontend and Postgres/PostGIS backend.

- There is a mapping & visualization app that allows orgs and users to draw their communities of interests. This is written in React & built using `createreactapp` and `Material UI`.
- In development is a dashboard component that allows orgs to define their turfs to do census outreach. This is build in Vue, Flask, and Airflow.
Representable is creating maps of communities to fight for equal and impartial representation. The core web app is written in Django with Javascript/HTML/CSS frontend and Postgres/PostGIS backend. Our mapping & visualization app, currently in beta, is written in React & built using `createreactapp` and `Material UI`.

[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Expand All @@ -27,25 +24,10 @@ python manage.py loaddata states.json
python manage.py collectstatic
python manage.py test

# run the django server
# run server
python manage.py runserver 0:8000 --settings=representable.settings.dev
```

In another terminal run

```bash
docker compose exec app-plus /bin/bash
uv run python app.py
```

If you need a live vue instance

```bash
docker compose exec app-plus /bin/bash
cd vue-project
bun run dev --port 8888 --host 0.0.0.0
```

###### Tips

- If you update .env, you must run `source .env` to refresh it in your container.
Expand All @@ -56,7 +38,7 @@ For bug reports and general feature requests, please open a [Github issue](https
### Reporting Security Issues
We take security very seriously at Representable.org. Please send an email to [team@representable.org](mailto:team@representable.org) with any security issues and we'll open a private issue request with your concerns. We aim to respond to all security issues in a timely manner.

### Representable Contributors
### Active Contributors
Our core team of engineers is currently 6 members strong, though we've been supported by many others along the way. See more about our team and how we work at [representable.org/about](https://representable.org/about/)

- Somya Arora
Expand Down
30 changes: 3 additions & 27 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,8 @@ services:
- "8000:8000"
tty: true
stdin_open: true
app-plus: # flask/vue app that uses django (app) as a proxy for auth
build: ./representable_plus
volumes:
- ./representable_plus:/app
depends_on:
- app
env_file:
- .env
ports:
- "8001:8001"
- "8888:8888"
tty: true
stdin_open: true
db:
image: postgis/postgis:17-3.4-alpine
image: postgis/postgis:17-3.5-alpine
restart: unless-stopped
environment:
- POSTGRES_DB=representable_db
Expand All @@ -36,20 +23,9 @@ services:
volumes:
- ./pg_data:/var/lib/postgresql/data
ports:
- "127.0.0.1:5433:5432" # access via port 5433 in dbeaver
- "127.0.0.1:5433:5432" # access via port 5433
# creating a new user
# psql -U public_test representable_db
# CREATE USER public_test WITH encrypted password 'test';
# change to select only for non-PII tables
# GRANT ALL PRIVILEGES ON DATABASE representable_db to public_test;
martin:
image: ghcr.io/maplibre/martin
restart: unless-stopped
environment:
- DATABASE_URL=postgresql://representable:password@db/representable_db
depends_on:
- db
volumes:
- ./martin:/files
ports:
- "3000:3000"
# GRANT ALL PRIVILEGES ON DATABASE representable_db to public_test;
30 changes: 0 additions & 30 deletions main/middleware/cors_middleware.py

This file was deleted.

25 changes: 0 additions & 25 deletions main/migrations/0102_turf.py

This file was deleted.

16 changes: 0 additions & 16 deletions main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,19 +517,3 @@ def approve(self):


# ******************************************************************************#

class Turf(models.Model):
organization = models.ForeignKey(
Organization,
on_delete=models.SET_NULL,
blank=True,
null=True
)
tracts = ArrayField(
ArrayField(
models.CharField(max_length=11, blank=True),
blank=False,
)
) # an array of tracts
description = models.JSONField(blank=True, null=True) # information submited by the org/ user
meta = models.JSONField(blank=True, null=True) # used for embeddings to find related tracts
7 changes: 1 addition & 6 deletions main/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from django.urls import include, path, re_path
from django.urls import include, path

from . import views
from representable.settings.base import MAPBOX_KEY
Expand Down Expand Up @@ -168,11 +168,6 @@
views.partners.PartnerView.as_view(),
name="partner_page",
),
re_path(
r"^partners/(?P<slug>[\w-]+)/turf/.*$",
views.partners_proxy.flask_proxy,
name="partner_turf",
),
path("map/<state>/", views.main.Map.as_view(), name="map"),
path("map/<state>/<lat>/<lng>", views.main.Map.as_view(), name="map"),
path(
Expand Down
1 change: 0 additions & 1 deletion main/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
from .main import *
from .dashboard import *
from .partners import *
from .partners_proxy import *
from .drives import *
73 changes: 36 additions & 37 deletions main/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,43 +145,42 @@ def form_valid(self, form):
admin = Membership(member=self.request.user, organization=org,)
admin.save()

# disable sending an email for now - need to get an email server / mailgun setup
# email_content = (
# "Dear Representable Team, "
# + self.request.user.email
# + " signed up to create an organization called "
# + org.name
# + ", in the state(s) of "
# + str(org.states)
# + " Their organization description: "
# + org.description
# + "."
# )

# send_mail(
# "[Action Required] New Organization Sign-up",
# email_content,
# "no-reply@representable.org",
# ["team@representable.org"],
# # ["acbeaton4@gmail.com"],
# fail_silently=False,
# )

# self.success_url = reverse_lazy(
# "main:thanks_org", kwargs=org.get_url_kwargs()
# )

# if not EmailAddress.objects.filter(
# user=self.request.user, verified=True
# ).exists():

# user_email_address = EmailAddress.objects.get(
# user=self.request.user
# )
# user_email_confirmation = EmailConfirmationHMAC(
# email_address=user_email_address
# )
# user_email_confirmation.send(self.request, False)
email_content = (
"Dear Representable Team, "
+ self.request.user.email
+ " signed up to create an organization called "
+ org.name
+ ", in the state(s) of "
+ str(org.states)
+ " Their organization description: "
+ org.description
+ "."
)

send_mail(
"[Action Required] New Organization Sign-up",
email_content,
"no-reply@representable.org",
["team@representable.org"],
# ["acbeaton4@gmail.com"],
fail_silently=False,
)

self.success_url = reverse_lazy(
"main:thanks_org", kwargs=org.get_url_kwargs()
)

if not EmailAddress.objects.filter(
user=self.request.user, verified=True
).exists():

user_email_address = EmailAddress.objects.get(
user=self.request.user
)
user_email_confirmation = EmailConfirmationHMAC(
email_address=user_email_address
)
user_email_confirmation.send(self.request, False)

return super().form_valid(form)

Expand Down
104 changes: 0 additions & 104 deletions main/views/partners_proxy.py

This file was deleted.

Loading