Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8c9c48e
feat: #309 - Add admin-only notice to login page
StubberG3 Aug 24, 2025
a596599
feat: #309 - add icon to login notice; add line break to return link
StubberG3 Aug 24, 2025
f81704f
feat: #309 - Remove extra padding above notice
StubberG3 Aug 24, 2025
757e712
feat: #309 - Remove forced login; update UI elements to reflect publi…
StubberG3 Aug 24, 2025
c9f3a31
feat: #309 - Add new logout page; restyle admin dropdown; restyle log…
StubberG3 Aug 24, 2025
2883471
feat: #309 - Separate public and admin api calls
StubberG3 Aug 25, 2025
8c4036e
feat: #309 - Disable JWT auth for newly public endpoints
StubberG3 Aug 26, 2025
3be42d3
feat: #309 - Make riskWithSources endpoint public
StubberG3 Aug 26, 2025
789442b
feat: #309 - Temporarily restrict chatbot to admins only
StubberG3 Aug 26, 2025
5e186a0
Merge branch 'CodeForPhilly:listOfMed' into balancer/309/login
StubberG3 Aug 26, 2025
0986a17
feat: #309 - Allow viewing and downloading of uploads to be public; e…
StubberG3 Aug 27, 2025
3a7614e
Merge branch 'balancer/309/login' of https://github.com/StubberG3/bal…
StubberG3 Aug 27, 2025
c8a605c
WIP
sahilds1 Oct 30, 2025
df27961
WIP
sahilds1 Nov 5, 2025
d617fc5
Revert formatting changes automatically made by Zed
sahilds1 Nov 13, 2025
ffe1d57
Update embedding_services.py
sahilds1 Nov 13, 2025
bae4e1c
Merge pull request #399 from sahilds1/393-make-the-chatbot-public
sahilds1 Nov 18, 2025
9a15d55
Merge branch '309-393-test-combined-prs' into balancer/309/login
sahilds1 Dec 1, 2025
11e84f5
Merge pull request #377 from StubberG3/balancer/309/login
sahilds1 Dec 1, 2025
addfcb9
Merge pull request #415 from CodeForPhilly/develop
sahilds1 Dec 1, 2025
456eb42
Remove auth requirement for Chat in both nav files
sahilds1 Dec 1, 2025
cd1ce44
Clear all session storage when auth state changes for chatbot
sahilds1 Dec 2, 2025
4dc8b39
Save patient history data to sessionStorage instead of localStorage
sahilds1 Dec 2, 2025
affe31e
Fix clearing sessionStorage on every page load for unauth users
sahilds1 Dec 2, 2025
74a0b8f
Clearing session storage on LOGIN_FAIL public access design of app
sahilds1 Dec 2, 2025
257b831
Enforce authentication at the route level for adminportal
sahilds1 Dec 2, 2025
7759377
Enforce authentication at the route level for non public routes
sahilds1 Dec 2, 2025
f0eeb35
Make the DrugSummary route and its API endpoints unprotected
sahilds1 Dec 3, 2025
7648a2c
Revert "Make the DrugSummary route and its API endpoints unprotected"
sahilds1 Dec 3, 2025
c792295
Remove comments from auth.ts
sahilds1 Dec 3, 2025
e994ef0
Remove final newline automatically added by Zed
sahilds1 Dec 3, 2025
6b97fa8
Simplify and make ProtectedRoute more robust
sahilds1 Dec 3, 2025
bd817ff
More targeted clearing of sessionStorage
sahilds1 Dec 3, 2025
4ebf265
Simplify ProtectedRoute.tsx
sahilds1 Dec 3, 2025
3cc46e0
Merge pull request #417 from sahilds1/416-fix-unauth-users-access
sahilds1 Dec 3, 2025
655dcf3
Merge remote-tracking branch 'origin/develop' into 309-393-test-combi…
taichan03 Dec 7, 2025
f165aeb
Handle the initial auth check state
sahilds1 Dec 9, 2025
5df35a8
Replace Loading Text with spinner
sahilds1 Dec 9, 2025
8190390
Fix the Type mismatch in RootState
sahilds1 Dec 9, 2025
3b82d63
Add TODO comments for improvements
sahilds1 Dec 9, 2025
1099665
Remov unecessary fragment
sahilds1 Dec 9, 2025
412e90b
STYLE: Format line length of comment
sahilds1 Dec 9, 2025
2b2e24c
Merge pull request #420 from sahilds1/416-bugfix-redirects
taichan03 Dec 12, 2025
1e39362
Merge branch '309-393-test-combined-prs' of https://github.com/CodeFo…
taichan03 Dec 12, 2025
8ca3f0f
this is for switching the button from view pdf to download pdf when t…
taichan03 Dec 12, 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
165 changes: 165 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- **Conditional PDF Access Based on Authentication** (2025-01-XX)
- Logged-in users see "View PDF" button that opens PDF viewer in new tab
- Non-logged-in users see "Download PDF" button that directly downloads the file
- Backend: Added `upload_file_guid` field to risk/source API responses
- Frontend: Conditional rendering based on Redux authentication state
- Fallback GUID extraction from URL if backend field is missing

**Backend Changes:**

*File: `server/api/views/risk/views_riskWithSources.py`*
```python
# Added to source_info dictionary in 3 locations (lines ~138, ~252, ~359):
source_info = {
'filename': filename,
'title': getattr(embedding, 'title', None),
'publication': getattr(embedding, 'publication', ''),
'text': getattr(embedding, 'text', ''),
'rule_type': medrule.rule_type,
'history_type': medrule.history_type,
'upload_fileid': getattr(embedding, 'upload_file_id', None),
'page': getattr(embedding, 'page_num', None),
'link_url': self._build_pdf_link(embedding),
'upload_file_guid': str(embedding.upload_file.guid) if embedding.upload_file else None # NEW
}
```

**Frontend Changes:**

*File: `frontend/src/pages/PatientManager/PatientManager.tsx`*
```typescript
// Added imports:
import { useSelector } from "react-redux";
import { RootState } from "../../services/actions/types";

// Added hook to get auth state:
const { isAuthenticated } = useSelector((state: RootState) => state.auth);

// Passed to PatientSummary:
<PatientSummary
// ... existing props
isAuthenticated={isAuthenticated}
/>
```

*File: `frontend/src/pages/PatientManager/PatientSummary.tsx`*
```typescript
// Updated interface:
interface PatientSummaryProps {
// ... existing props
isAuthenticated?: boolean; // NEW
}

// Updated SourceItem type:
type SourceItem = {
// ... existing fields
upload_file_guid?: string | null; // NEW
};

// Added helper function:
const extractGuidFromUrl = (url: string): string | null => {
try {
const urlObj = new URL(url, window.location.origin);
return urlObj.searchParams.get('guid');
} catch {
return null;
}
};

// Updated component:
const PatientSummary = ({
// ... existing props
isAuthenticated = false, // NEW
}: PatientSummaryProps) => {
const baseURL = import.meta.env.VITE_API_BASE_URL || ''; // NEW

// Updated MedicationItem props:
const MedicationItem = ({
// ... existing props
isAuthenticated, // NEW
baseURL, // NEW
}: {
// ... existing types
isAuthenticated: boolean; // NEW
baseURL: string; // NEW
}) => {

// Updated MedicationTier props:
const MedicationTier = ({
// ... existing props
isAuthenticated, // NEW
baseURL, // NEW
}: {
// ... existing types
isAuthenticated: boolean; // NEW
baseURL: string; // NEW
}) => (
// ... passes to MedicationItem
<MedicationItem
// ... existing props
isAuthenticated={isAuthenticated}
baseURL={baseURL}
/>
);

// Conditional button rendering:
{s.link_url && (() => {
const guid = s.upload_file_guid || extractGuidFromUrl(s.link_url);
if (!guid) return null;

return isAuthenticated ? (
<a
href={s.link_url}
target="_blank"
rel="noopener noreferrer"
className="ml-2 px-2 py-1 text-xs bg-blue-100 text-blue-700 rounded hover:bg-blue-200 transition-colors"
>
View PDF
</a>
) : (
<a
href={`${baseURL}/v1/api/uploadFile/${guid}`}
download
className="ml-2 px-2 py-1 text-xs bg-green-100 text-green-700 rounded hover:bg-green-200 transition-colors"
>
Download PDF
</a>
);
})()}

// Updated all MedicationTier calls to pass new props:
<MedicationTier
// ... existing props
isAuthenticated={isAuthenticated}
baseURL={baseURL}
/>
```

### Fixed
- **URL Route Case Consistency** (2025-01-XX)
- Fixed case mismatch between backend URL generation (`/drugsummary`) and frontend route (`/drugSummary`)
- Updated all references to use consistent camelCase `/drugSummary` route
- Affected files: `views_riskWithSources.py`, `Layout_V2_Sidebar.tsx`, `Layout_V2_Header.tsx`, `FileRow.tsx`

- **Protected Route Authentication Flow** (2025-01-XX)
- Fixed blank page issue when opening protected routes in new tab
- `ProtectedRoute` now waits for authentication check to complete before redirecting
- Added `useAuth()` hook to `Layout_V2_Main` to trigger auth verification

### Changed
- **PatientSummary Component** (2025-01-XX)
- Now receives `isAuthenticated` prop from Redux state
- Props passed through component hierarchy: `PatientManager` → `PatientSummary` → `MedicationTier` → `MedicationItem`
- Added `baseURL` constant for API endpoint construction

## [Previous versions would go here]
Loading