How hackghosst001/cdr-ipdr-report-analyzer works
1. Overall shape
- This is a client-side React + Vite single-page application for analyzing CDR/IPDR Excel or CSV reports.
- There is no backend in the repository; all upload handling, filtering, table rendering, and export logic appears to run entirely in the browser.
2. Primary user flow
- The intended flow is:
1. Enter case metadata and target number.
2. Upload a report file.
3. Inspect the loaded sheet data.
4. Choose a query/analysis type.
5. Review results.
6. Export the filtered output to Excel.
- This flow is described in the README and maps directly to the app’s page structure.
3. App shell and routing
- src/main.jsx and src/App.jsx form the application entry and top-level composition.
- The presence of react-router-dom and page components under src/pages indicates route-based navigation across:
- QueryInput
- Sheet
- QueryResult
- About
- Contact
- UserGuide
- Header and Footer are shared layout components used across pages.
4. Global application state
- src/DataContext.jsx is the main shared state boundary.
- It likely stores the uploaded dataset, case metadata, selected target number, and computed query results so that different pages can access the same analysis state without prop drilling.
- This context is the key bridge between file ingestion, sheet inspection, and query result rendering.
5. Data ingestion and representation
- The app supports Excel and CSV upload, with SheetJS (xlsx) called out in the README.
- Uploaded report data is likely normalized into row objects and held in memory for client-side processing.
- src/utils/rowKey.js suggests rows may be assigned stable identifiers to support rendering, deduplication, or row tracking.
6. Sheet inspection subsystem
- src/Sheet.jsx and src/Sheet.css indicate a dedicated sheet-view screen for browsing raw uploaded rows.
- src/components/ReusableTable.jsx is the shared table renderer used for both sheet previews and query outputs.
- The README notes that query result tables hide “A Party” fields, so the reusable table likely accepts column visibility rules or a sanitized result shape.
7. Analysis engine: CDR filtering modules
- The src/cdrFilter directory is the core domain logic for investigations.
- Each file represents a focused analysis rule or query type:
- durationFilter.js
- maxCallDuration.js
- frequentContact.js
- timePattern.js
- imeiTracking.js
- imsiAnalysis.js
- locationBTS.js
- utils.js in the same folder likely contains shared parsing, normalization, and comparison helpers used by multiple filters.
- Architecturally, these modules are the “business logic” layer: they transform raw report rows into investigation outputs.
8. Query result generation
- src/pages/QueryInput.jsx probably selects the analysis type and invokes the corresponding filter module.
- src/pages/QueryResult.jsx displays the computed output in a table and exposes export actions.
- src/utils/reportUtils.js likely handles formatting and export preparation, especially converting results into Excel-friendly structures.
9. Formatting and presentation rules
- The README specifies two important presentation constraints:
- Date-time values are shown as DD-MM-YYYY HH:MM:SS
- Duration values are shown as mm:ss
- That implies there is a formatting layer between raw parsed data and display/export output, most likely in reportUtils.js and/or the filter utilities.
- The app is using Bootstrap 5 plus custom CSS files such as App.css, Sheet.css, and index.css for layout and styling.
10. Navigation and informational pages
- About, Contact, and UserGuide are separate informational pages, indicating the app is packaged as a guided operator tool rather than a thin utility screen.
- This is relevant for architecture because the analysis functionality is embedded in a broader workflow with documentation and operator guidance.
11. Important boundaries
- The main architectural boundary is between:
- UI concerns: pages, tables, navigation, styling
- Domain logic: CDR/IPDR query filters and report transformations
- Shared state: context-driven app data and selected analysis state
- Keeping filter logic in src/cdrFilter separates investigative rules from rendering, which is important for maintainability and for adding new query types.
12. External dependencies that matter
- React: component-based UI
- Vite: build/dev toolchain
- React Router DOM: page navigation
- Bootstrap 5: layout and styling primitives
- SheetJS (xlsx): file parsing and Excel export
- These are not incidental; they define the app as a browser-based data analysis tool with local file processing rather than a server-backed reporting system.
13. What to show in an architecture diagram
- A clear diagram should center on:
- Browser UI shell
- File upload/input page
- Shared context/store
- CDR/IPDR filter engine
- Sheet/result tables
- Excel export path
- The main data flow is: uploaded file → parsed rows → context state → query filter module → formatted result set → table display/export.
14. Operational characteristics
- Because processing happens in the browser, the app likely favors privacy and offline-style usage for sensitive police/case data.
- It also means memory and file-size constraints are architectural considerations, especially when loading large CDR/IPDR sheets.
Main entry points: App.jsx App Shell · QueryInput.jsx Query Input · utils.js CDR Utils · QueryResult.jsx Results
Components 22
UI Shell
App composition, routing, shared layout, and page screens.
- Main · Vite/React entry that boots the app.
src/main.jsx - App Shell · Top-level composition and route wiring.
src/App.jsx - Header · Shared top navigation and page chrome.
src/components/Header.jsx - Footer · Shared bottom page chrome.
src/components/Footer.jsx - Query Input · Case metadata entry and analysis selection screen.
src/pages/QueryInput.jsx - Sheet View · Raw uploaded sheet inspection screen.
src/Sheet.jsx - Results · Computed query output and export screen.
src/pages/QueryResult.jsx - About · Informational page about the tool.
src/pages/About.jsx - Contact · Support or contact information page.
src/pages/Contact.jsx - Guide · Operator guidance and usage instructions.
src/pages/UserGuide.jsx
Shared State
Browser-side shared data and cross-page analysis state.
- Data Context · Cross-page browser state for uploaded data and analysis selections.
src/DataContext.jsx
Analysis Engine
CDR/IPDR query and filtering logic.
- CDR Utils · Shared parsing and comparison helpers for investigative filters.
src/cdrFilter/utils.js - Duration Filter · Duration-based filtering and aggregation logic.
src/cdrFilter/durationFilter.js - Max Call · Finds the longest or peak-duration call record.
src/cdrFilter/maxCallDuration.js - Frequent Contact · Identifies repeated contacts and communication patterns.
src/cdrFilter/frequentContact.js - Time Pattern · Clusters calls by time-of-day or temporal pattern.
src/cdrFilter/timePattern.js - IMEI Tracking · Tracks device identifiers across report rows.
src/cdrFilter/imeiTracking.js - IMSI Analysis · Analyzes subscriber identifier usage and movement.
src/cdrFilter/imsiAnalysis.js - Location BTS · Infers location behavior from BTS or tower data.
src/cdrFilter/locationBTS.js
Presentation & Export
Table rendering and export/formatting helpers.
- Reusable Table · Shared table renderer for sheet preview and query results.
src/components/ReusableTable.jsx - Report Utils · Result shaping, formatting, and Excel export preparation.
src/utils/reportUtils.js - Row Key · Stable row identification helper for tracked records.
src/utils/rowKey.js
Connections 30
- Main → App Shell: boots · Application entry mounts the top-level app.
- App Shell → Header: renders · Shared header is included in the app shell.
- App Shell → Footer: renders · Shared footer is included in the app shell.
- App Shell → Query Input: route · Navigation opens the input and analysis setup page.
- App Shell → Sheet View: route · Navigation opens the raw sheet inspection page.
- App Shell → Results: route · Navigation opens the query result page.
- App Shell → About: route · Navigation opens the about page.
- App Shell → Contact: route · Navigation opens the contact page.
- App Shell → Guide: route · Navigation opens the user guide page.
- Query Input → Data Context: reads/writes · Case metadata, target number, and file state flow through shared context.
- Sheet View → Data Context: reads · Sheet view consumes uploaded rows from shared context.
- Results → Data Context: reads · Result view consumes computed analysis state from shared context.
- Query Input → Duration Filter: invokes · Query selection can dispatch to duration analysis.
- Query Input → Max Call: invokes · Query selection can dispatch to max call analysis.
- Query Input → Frequent Contact: invokes · Query selection can dispatch to frequent contact analysis.
- Query Input → Time Pattern: invokes · Query selection can dispatch to time-pattern analysis.
- Query Input → IMEI Tracking: invokes · Query selection can dispatch to IMEI tracking.
- Query Input → IMSI Analysis: invokes · Query selection can dispatch to IMSI analysis.
- Query Input → Location BTS: invokes · Query selection can dispatch to BTS location analysis.
- Duration Filter → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- Max Call → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- Frequent Contact → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- Time Pattern → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- IMEI Tracking → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- IMSI Analysis → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- Location BTS → CDR Utils: uses · Filter logic relies on shared normalization helpers.
- Sheet View → Reusable Table: renders · Sheet preview is shown through the shared table component.
- Results → Reusable Table: renders · Computed results are shown through the shared table component.
- Results → Report Utils: formats/export · Results are prepared and exported through report utilities.
- Report Utils → Row Key: uses · Export and formatting logic can preserve stable row identity.