feat: add CCA claim submission with Selenium automation

- Add CCA claim submit Selenium worker (login, fill form, attach docs, submit, capture dashboard PDF)
- Add CCA fee schedule (procedureCodesMH.json renamed, procedureCodesCCA.json added with D6010)
- Add backend route /api/claims/cca-claim, processor, and Selenium client
- Wire CCA claim handler in claims-page with job tracking and PDF preview popup
- Add insurance type dropdown in claim form (same options as eligibility page)
- Auto-populate insurance type from patient.insuranceProvider in claim form and patient edit form
- Map fee schedule by insurance type in Map Price button and combo buttons
- Fix CCA login speed (remove fixed sleeps, use readyState check)
- Fix CCA claim DOB format bug (was sending MM-DD-YYYY, now sends YYYY-MM-DD)
- Fix npiProviderId not saved for CCA claims
- Change Add Service → CCA Claim button (blue), MH → MH Claim

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-05-22 13:34:03 -04:00
co-authored by Claude Sonnet 4.6
parent 58b2e4af93
commit 0e664e4813
21 changed files with 4768 additions and 77 deletions
+29 -20
View File
@@ -3,11 +3,11 @@ const API_BASE_URL = import.meta.env.VITE_API_BASE_URL_BACKEND ?? "";
// Upload a document for a patient
export const uploadDocument = async (patientId, file) => {
const formData = new FormData();
formData.append('file', file);
formData.append('patientId', patientId.toString());
formData.append("file", file);
formData.append("patientId", patientId.toString());
const token = localStorage.getItem("token");
const response = await fetch(`${API_BASE_URL}/api/patient-documents/upload`, {
method: 'POST',
method: "POST",
headers: {
...(token ? { Authorization: `Bearer ${token}` } : {}),
},
@@ -22,12 +22,15 @@ export const uploadDocument = async (patientId, file) => {
};
// Get all documents for a patient
export const getPatientDocuments = async (patientId, limit, offset) => {
const url = new URL(`${API_BASE_URL}/api/patient-documents/patient/${patientId}`);
const urlPath = `/api/patient-documents/patient/${patientId}`;
const url = API_BASE_URL
? new URL(`${API_BASE_URL}${urlPath}`)
: new URL(urlPath, window.location.origin);
if (limit !== undefined) {
url.searchParams.append('limit', limit.toString());
url.searchParams.append("limit", limit.toString());
}
if (offset !== undefined) {
url.searchParams.append('offset', offset.toString());
url.searchParams.append("offset", offset.toString());
}
const token = localStorage.getItem("token");
const headers = {
@@ -45,11 +48,17 @@ export const getPatientDocuments = async (patientId, limit, offset) => {
};
// View a document (inline display)
export const viewDocument = (documentId) => {
return `${API_BASE_URL}/api/patient-documents/${documentId}/view`;
if (API_BASE_URL) {
return `${API_BASE_URL}/api/patient-documents/${documentId}/view`;
}
return `/api/patient-documents/${documentId}/view`;
};
// Download a document
export const downloadDocument = (documentId) => {
return `${API_BASE_URL}/api/patient-documents/${documentId}/download`;
if (API_BASE_URL) {
return `${API_BASE_URL}/api/patient-documents/${documentId}/download`;
}
return `/api/patient-documents/${documentId}/download`;
};
// Delete a document
export const deleteDocument = async (documentId) => {
@@ -74,21 +83,21 @@ export const scanDocument = async (patientId) => {
// Helper function to format file size
export const formatFileSize = (bytes) => {
if (bytes === 0)
return '0 Bytes';
return "0 Bytes";
const k = 1024;
const sizes = ['Bytes', 'KB', 'MB', 'GB'];
const sizes = ["Bytes", "KB", "MB", "GB"];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + ' ' + sizes[i];
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
};
// Helper function to get file icon based on MIME type
export const getFileIcon = (mimeType) => {
if (mimeType.startsWith('image/'))
return '🖼️';
if (mimeType === 'application/pdf')
return '📄';
if (mimeType.includes('word') || mimeType.includes('document'))
return '📝';
if (mimeType.includes('text'))
return '📄';
return '📎';
if (mimeType.startsWith("image/"))
return "🖼️";
if (mimeType === "application/pdf")
return "📄";
if (mimeType.includes("word") || mimeType.includes("document"))
return "📝";
if (mimeType.includes("text"))
return "📄";
return "📎";
};