Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
9c23c25
Add macOS Desktop Services Store file to gitignore
sahilds1 Feb 5, 2026
59b40f0
REFACTOR Pull apart get_closest_embeddings to make testing easier
sahilds1 Feb 13, 2026
3ffb74a
ADD Add infra required to run pytest
sahilds1 Feb 13, 2026
12b09a7
ADD Start adding tests for embedding_services"
sahilds1 Feb 13, 2026
2d2ccd1
Fix duplicate healthcheck key for db service build
amahuli03 Feb 16, 2026
01ccf9a
Enhance input sanitization and normalize pronouns
AkhilRB0204 Feb 17, 2026
aa3efcd
Merge remote-tracking branch 'upstream/develop' into bugfix-duplicate…
amahuli03 Feb 17, 2026
da9afaa
DOC Add a note about running pytest in the README
sahilds1 Feb 17, 2026
b08152f
fix: changed link to direct to balancer github page
amahuli03 Feb 18, 2026
b94e998
Fix error 1, added unit tests and more logging
amahuli03 Feb 20, 2026
530b90a
Changed button text from "donate" to "Support Developoment"
amahuli03 Feb 23, 2026
c409689
Merge pull request #462 from amahuli03/bugfix-duplicate-healthchecks-…
sahilds1 Feb 23, 2026
98599e5
Merge pull request #465 from amahuli03/445-update-donate-button
sahilds1 Feb 23, 2026
f96606d
Fix 401 by using adminApi instead of raw axios
amahuli03 Feb 23, 2026
662f29d
Merge pull request #468 from amahuli03/467/unauthorized-pdf-upload
sahilds1 Feb 26, 2026
bbf1034
Fixed wrong API url path in handleDownload
amahuli03 Feb 26, 2026
128418b
Fixed API URL in handleOpen as well
amahuli03 Feb 26, 2026
332af9f
drf-spectacular configuration
amahuli03 Feb 26, 2026
a34a9f8
Added URL routes for API docs generation
amahuli03 Feb 26, 2026
fe660d2
Added OpenAPI security scheme
amahuli03 Feb 26, 2026
3c83abd
Added extend_schema and serializer_class to endpoints that drf-specta…
amahuli03 Feb 26, 2026
5ce7782
Preload SentenceTransformer model at Django startup before traffic is…
sahilds1 Feb 27, 2026
7085aa0
Requested changes: fix patch decorators to point to where openAI is u…
amahuli03 Mar 2, 2026
669f939
Merge remote-tracking branch 'upstream/develop' into 390-bugfix-uploa…
amahuli03 Mar 2, 2026
e6754df
Requested changes: added comments explaining title truncation
amahuli03 Mar 2, 2026
4b4d727
Fix mock setups to match how generate_title accesses title
amahuli03 Mar 2, 2026
a8f5d90
Merge pull request #466 from amahuli03/390-bugfix-upload-file-endpoint
sahilds1 Mar 5, 2026
f2f4274
Merge pull request #471 from amahuli03/file-download-error
sahilds1 Mar 5, 2026
e8b0fc1
fix: treat openAIServices.openAI() return value as string
amahuli03 Mar 5, 2026
e0b7c23
fix mock test setup to return string instead of mocked response object
amahuli03 Mar 6, 2026
d68fa62
fix to make test_falls_back_to_chatgpt_if_no_title_found more robust
amahuli03 Mar 6, 2026
03b7639
Replace block-position title extraction with font-size-based approach
amahuli03 Mar 6, 2026
2a822f6
loosens the title regex to allow years, question
amahuli03 Mar 6, 2026
edf1eb6
Update tests for font-size-based title extraction
amahuli03 Mar 6, 2026
4bae746
update documentation to include instructions about how to use the API…
amahuli03 Mar 10, 2026
6f0deed
update site links on README
amahuli03 Mar 10, 2026
6ae14fe
Merge pull request #479 from amahuli03/update-readme-site-link
sahilds1 Mar 10, 2026
9fa287b
Merge pull request #472 from amahuli03/460/generate-api-documentation
sahilds1 Mar 11, 2026
50a8bd3
Merge branch 'develop' into 441-embedding-models
sahilds1 Mar 11, 2026
795f218
Run python-app workflow on pushes and PRs to develop branch
sahilds1 Mar 11, 2026
d0542df
Merge pull request #457 from sahilds1/456-update-gitignore
sahilds1 Mar 11, 2026
75c1a14
Merge pull request #474 from amahuli03/473/openai-title-generation-at…
sahilds1 Mar 11, 2026
d498a00
Pytest won’t automatically discover config files in subdirectories
sahilds1 Mar 19, 2026
6d3d8d1
Merge branch 'develop' into 441-embedding-models
sahilds1 Mar 19, 2026
3824d81
Suppress E402 import violations
sahilds1 Mar 19, 2026
46e9969
Add build_query tests and document coverage gaps in embedding_services
sahilds1 Mar 20, 2026
64a19ef
Fill test gaps in test_embedding_services
sahilds1 Mar 20, 2026
dec3c12
Fix incorrect build_query test assertions
sahilds1 Mar 20, 2026
25a16b9
feat: migrate manifests from Ingress to Gateway API (HTTPRoute)
TineoC Mar 21, 2026
1ea8894
feat: configure HTTPRoute for sandbox.balancerproject.org
TineoC Mar 21, 2026
1484428
feat: add sandbox and production overlays for HTTPRoute
TineoC Mar 21, 2026
6f50887
cleanup: remove unused dev overlay
TineoC Mar 21, 2026
f9e890a
Guard TransformerModel preload to runserver processes only
sahilds1 Mar 23, 2026
67176a8
Revert GitHub Workflow changes
sahilds1 Mar 25, 2026
d273921
Add section header comments to all four test groups in test_embedding…
sahilds1 Mar 26, 2026
8198574
Document why tests are split by responsibility
sahilds1 Mar 26, 2026
5d8c8b3
Improve logging and comments
sahilds1 Mar 31, 2026
31498dc
Fall back to lazy load using try except block
sahilds1 Mar 31, 2026
a39d33c
Revert settings.py to develop state
sahilds1 Mar 31, 2026
fe1eeca
Manually test fall back to lazy loading
sahilds1 Mar 31, 2026
13a0a21
Merge pull request #475 from amahuli03/title-generation-font-size
sahilds1 Mar 31, 2026
baa4438
Merge pull request #461 from sahilds1/441-embedding-models
sahilds1 Apr 14, 2026
88adfb1
Add issue template
sahilds1 Apr 14, 2026
55acb2e
Update README
sahilds1 Apr 14, 2026
fb3b272
Merge pull request #496 from sahilds1/187-add-docs
sahilds1 Apr 14, 2026
cedc58a
Add sandbox link to README usage section
sahilds1 Apr 14, 2026
4cbb380
feat(gateway): implement self-service TLS via ListenerSet
TineoC Apr 18, 2026
cc3fbe9
fix(gateway): update overlays to patch ListenerSet hostnames
TineoC Apr 18, 2026
b9c9591
feat(gateway): implement HTTP to HTTPS redirect via ListenerSet
TineoC Apr 18, 2026
fb7b270
fix(gateway): patch hostname for redirect HTTPRoute in overlays
TineoC Apr 18, 2026
b1e4918
Configure CORS Allowed Origins via ConfigMaps
TineoC Apr 18, 2026
00250ef
Update sandbox domain for CORS
TineoC Apr 18, 2026
8262de5
Refine ConfigMap overlays using env files and correct sandbox domain
TineoC Apr 18, 2026
d97f0c9
feat: add balancer database cluster manifest
TineoC Apr 18, 2026
92fd46d
remove redundant cluster manifest (moved to infra repo)
TineoC Apr 18, 2026
cf324fb
remove db.yaml from kustomization resources
TineoC Apr 18, 2026
c6f001d
feat: add sandbox overlay with shared db connection details
TineoC Apr 18, 2026
76af69f
feat: update sandbox overlay to use shared db password from secret
TineoC Apr 18, 2026
e48e52d
feat: add configmap for database settings in sandbox overlay
TineoC Apr 18, 2026
d725fe0
feat: update kustomization to use configmap and secret for db settings
TineoC Apr 18, 2026
99523c9
feat: move database manifest to base and update SQL_HOST for shared-c…
TineoC May 1, 2026
79a3232
Add YAML front matter to issue template
sahilds1 May 1, 2026
98ec6b4
Merge branch 'pr-482' into integrate-all-migration
TineoC May 7, 2026
7ab8480
Merge branch 'pr-500' into integrate-all-migration
TineoC May 7, 2026
920e0cd
Merge branch 'pr-501' into integrate-all-migration
TineoC May 7, 2026
06359c5
fix: remove redundant namespace patch on database.yaml
TineoC May 7, 2026
1af2d30
fix: move Database CRD to cfp-sandbox-cluster infra
TineoC May 7, 2026
e8bfa66
fix: move Database CRD to sandbox-only CNPG kustomization
TineoC May 7, 2026
7a0b6ad
fix: remove redundant balancer-redirect HTTPRoute (covered by global …
TineoC May 18, 2026
96c9612
fix: simplify balancer kustomize overlays and add common labels
TineoC May 18, 2026
f71f943
fix: update production to v1.1.5
TineoC May 18, 2026
e0ca2df
fix: use image tags without v prefix (1.1.5)
TineoC May 18, 2026
1072a98
fix: align version label with image tag format (1.1.5)
TineoC May 18, 2026
524d022
fix: remove version label, use image tag as source of truth
TineoC May 18, 2026
a033298
feat(sandbox): add balancer-db-credentials SealedSecret for CNPG
May 18, 2026
6249ed3
chore(sandbox): remove cnpg overlay — CNPG resources belong in cfp-sa…
May 18, 2026
5d740f6
Delete architectural issue template
sahilds1 May 23, 2026
ccf17b0
Merge pull request #506 from sahilds1/187-improve-docs
sahilds1 May 23, 2026
020e762
Merge branch 'develop' into integrate-all-migration
TineoC May 24, 2026
c88a4d8
Merge pull request #507 from TineoC/integrate-all-migration
TineoC May 24, 2026
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
27 changes: 0 additions & 27 deletions .github/ISSUE_TEMPLATE/architectural-issue.md

This file was deleted.

32 changes: 32 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: Issue template
about: Help push the project forward
title: ''
labels: ''
assignees: ''

---

## Title
<!-- Title: [Type]: Short description of the problem or goal -->

## Background
<!-- Why does this change need to happen? -->

## Existing Behavior
<!-- What code or docs are changing? Link or paste as needed -->

## Acceptance Criteria
- [] <!-- What does done look like? -->

## Approach
<!-- How are you tackling this? Update as you go -->

## References
<!-- Anything useful — docs, links, decisions -->

## Risks and Rollback
<!-- Anything that could go wrong, or leave blank if low risk -->

## Screenshots / Recordings
<!-- Before/after visuals or console output if helpful -->
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
config/env/*
!config/env/*.example
.idea/
.idea/
.DS_Store
10 changes: 10 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ Each module contains:
- Auth endpoints via Djoser: `/auth/`
- JWT token lifetime: 60 minutes (access), 1 day (refresh)

#### API Documentation
- Auto-generated using **drf-spectacular** (OpenAPI 3.0)
- **Swagger UI**: `http://localhost:8000/api/docs/` — interactive API explorer
- **ReDoc**: `http://localhost:8000/api/redoc/` — readable reference docs
- **Raw schema**: `http://localhost:8000/api/schema/`
- Configuration in `SPECTACULAR_SETTINGS` in `settings.py`
- Views use `@extend_schema` decorators and `serializer_class` attributes for schema generation
- JWT auth is configured in the schema — use `JWT <token>` (not `Bearer`) in Swagger UI's Authorize dialog
- To document a new endpoint: add `serializer_class` to the view if it has one, or add `@extend_schema` with `inline_serializer` for views returning raw dicts

#### Key Data Models
- **Medication** (`api.views.listMeds.models`) - Medication catalog with benefits/risks
- **MedRule** (`api.models.model_medRule`) - Include/Exclude rules for medications based on patient history
Expand Down
38 changes: 34 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ for patients with bipolar disorder, helping them shorten their journey to stabil

## Usage

You can view the current build of the website here: [https://balancertestsite.com](https://balancertestsite.com/)
You can view the current build of the website here: [https://balancerproject.org/](https://balancerproject.org/)

You can view the website in a sandbox here: [https://sandbox.balancerproject.org/](https://sandbox.balancerproject.org/)

## Contributing

Expand All @@ -31,11 +33,9 @@ Get the code using git by either forking or cloning `CodeForPhilly/balancer-main
```
2. (Optional) Add your API keys to `config/env/dev.env`:
- `OpenAI API`
- `Anthropic API`

Tools used for development:
1. `Docker`: Install Docker Desktop
2. `Postman`: Ask to get invited to the Balancer Postman team `balancer_dev`
3. `npm`: In the terminal run 1) 'cd frontend' 2) 'npm install' 3) 'cd ..'

### Running Balancer for development
Expand All @@ -53,7 +53,7 @@ The application supports connecting to PostgreSQL databases via:
See [Database Connection Documentation](./docs/DATABASE_CONNECTION.md) for detailed configuration.

**Local Development:**
- Download a sample of papers to upload from [https://balancertestsite.com](https://balancertestsite.com/)
- Download a sample of papers to upload from [https://balancerproject.org/](https://balancerproject.org/)
- The email and password of `pgAdmin` are specified in `balancer-main/docker-compose.yml`
- The first time you use `pgAdmin` after building the Docker containers you will need to register the server.
- The `Host name/address` is the Postgres server service name in the Docker Compose file
Expand All @@ -73,6 +73,36 @@ df = pd.read_sql(query, engine)

#### Django REST
- The email and password are set in `server/api/management/commands/createsu.py`
- Backend tests can be run using `pytest` by running the below command inside the running backend container:

```
docker compose exec backend pytest api/ -v
```

## API Documentation

Interactive API docs are auto-generated using [drf-spectacular](https://drf-spectacular.readthedocs.io/) and available at:

- **Swagger UI**: [http://localhost:8000/api/docs/](http://localhost:8000/api/docs/) — interactive explorer with "Try it out" functionality
- **ReDoc**: [http://localhost:8000/api/redoc/](http://localhost:8000/api/redoc/) — clean, readable reference docs
- **Raw schema**: [http://localhost:8000/api/schema/](http://localhost:8000/api/schema/) — OpenAPI 3.0 JSON/YAML

### Testing authenticated endpoints

Most endpoints require JWT authentication. To test them in Swagger UI:

1. **Get a token**: Find the `POST /auth/jwt/create/` endpoint in Swagger UI, click **Try it out**, enter an authorized `email` and `password`, and click **Execute**. Copy the `access` token from the response.
2. **Authorize**: Click the **Authorize** button (lock icon) at the top of the page. Enter `JWT <your-access-token>` in the value field. The prefix must be `JWT`, not `Bearer`.
3. **Test endpoints**: All subsequent requests will include your token. Use **Try it out** on any protected endpoint.
4. **Token refresh**: Access tokens expire after 60 minutes. Use `POST /auth/jwt/refresh/` with your `refresh` token, or repeat step 1.

### Deployment

1. Merging your PR into develop automatically triggers a GitHub Release
2. The release triggers a container build workflow that builds and pushes the Docker image
3. [Go to GitHub Packages](https://github.com/CodeForPhilly/balancer-main/pkgs/container/balancer-main%2Fapp) to find the new image tag
4. Update newTag in kustomization.yaml [in the cluster repo](https://github.com/CodeForPhilly/cfp-live-cluster/blob/main/balancer/kustomization.yaml)
5. Open a PR to [cfp-sandbox-cluster](https://github.com/CodeForPhilly/cfp-sandbox-cluster) (or [cfp-live-cluster](https://github.com/CodeForPhilly/cfp-live-cluster))

## Architecture

Expand Down
Empty file.
2 changes: 2 additions & 0 deletions deploy/manifests/balancer/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
envFrom:
- secretRef:
name: balancer-config
- configMapRef:
name: balancer-config
ports:
- containerPort: 8000
readinessProbe:
Expand Down
27 changes: 27 additions & 0 deletions deploy/manifests/balancer/base/gateway-listeners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: gateway.networking.k8s.io/v1
kind: ListenerSet
metadata:
name: balancer-listeners
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hostname: HOSTNAME_PLACEHOLDER
spec:
parentRef:
name: main-gateway
namespace: envoy-gateway-system
group: gateway.networking.k8s.io
kind: Gateway
listeners:
- name: http
protocol: HTTP
port: 80
hostname: HOSTNAME_PLACEHOLDER
- name: https
protocol: HTTPS
port: 443
hostname: HOSTNAME_PLACEHOLDER
tls:
mode: Terminate
certificateRefs:
- name: balancer-tls
kind: Secret
23 changes: 23 additions & 0 deletions deploy/manifests/balancer/base/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: balancer
annotations:
hostname: HOSTNAME_PLACEHOLDER
spec:
parentRefs:
- name: balancer-listeners
kind: ListenerSet
group: gateway.networking.k8s.io
sectionName: https
hostnames:
- HOSTNAME_PLACEHOLDER
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: balancer
port: 80
23 changes: 0 additions & 23 deletions deploy/manifests/balancer/base/ingress.yaml

This file was deleted.

18 changes: 17 additions & 1 deletion deploy/manifests/balancer/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,20 @@ resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- gateway-listeners.yaml
- httproute.yaml

labels:
- pairs:
app.kubernetes.io/name: balancer
app.kubernetes.io/part-of: balancer
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/component: web

images:
- name: ghcr.io/codeforphilly/balancer-main/app

configMapGenerator:
- name: balancer-config
envs:
- balancer.env
2 changes: 1 addition & 1 deletion deploy/manifests/balancer/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
ports:
- name: http
port: 8000
port: 80
targetPort: 8000
selector:
app: balancer
26 changes: 0 additions & 26 deletions deploy/manifests/balancer/overlays/dev/kustomization.yaml

This file was deleted.

1 change: 1 addition & 0 deletions deploy/manifests/balancer/overlays/production/balancer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CORS_ALLOWED_ORIGINS=https://balancerproject.org
44 changes: 44 additions & 0 deletions deploy/manifests/balancer/overlays/production/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: balancer

resources:
- ../../base

images:
- name: ghcr.io/codeforphilly/balancer-main/app
newTag: 1.1.5

configMapGenerator:
- name: balancer-config
behavior: merge
literals:
- HOSTNAME=balancerproject.org
envs:
- balancer.env

labels:
- includeSelectors: true
pairs:
environment: production
app.kubernetes.io/instance: balancer-production

patches:
- target:
kind: ListenerSet
name: balancer-listeners
patch: |
- op: replace
path: /spec/listeners/0/hostname
value: balancerproject.org
- op: replace
path: /spec/listeners/1/hostname
value: balancerproject.org
- target:
kind: HTTPRoute
name: balancer
patch: |
- op: replace
path: /spec/hostnames/0
value: balancerproject.org
1 change: 1 addition & 0 deletions deploy/manifests/balancer/overlays/sandbox/balancer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CORS_ALLOWED_ORIGINS=https://sandbox.balancerproject.org
10 changes: 10 additions & 0 deletions deploy/manifests/balancer/overlays/sandbox/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: balancer-db-config
data:
SQL_HOST: shared-cluster-rw.cloudnative-pg.svc.cluster.local
SQL_PORT: "5432"
SQL_DATABASE: balancer
SQL_USER: balancer
SQL_ENGINE: django.db.backends.postgresql
Loading
Loading