A dynamic web application that searches for USATF-certified running courses anywhere in the United States and automatically attempts to find their certification PDFs.
- Dynamic Course Search: Search by city, state, and distance
- USATF Database Integration: Real-time search of the official USATF course database
- Automatic PDF Discovery: Attempts to find and download course certification PDFs
- PDF Content Extraction: Extracts addresses and venue information from PDFs
- Interactive Map: Visual display of found courses with location markers
- Responsive Design: Works on desktop and mobile devices
- User Search: Users enter a city, state, and distance (5K, 10K, etc.)
- USATF Query: Backend scrapes the USATF database for matching courses
- PDF Discovery: System searches for certification PDFs using multiple strategies:
- Local PDF cache
- USATF direct links
- Race organization websites
- Running calendar sites
- Content Extraction: Python scripts extract key information from found PDFs
- Results Display: Courses are displayed with maps, details, and PDF links
-
Clone the repository:
git clone <repository-url> cd raceMap
-
Install Node.js dependencies:
npm install
-
Ensure Python is available (for PDF extraction):
python --version # Should be Python 3.x
-
Start the server:
npm start
-
Open your browser to
http://localhost:3000
- Enter a city name (e.g., "Boston")
- Select a state from the dropdown
- Choose a distance (default: 5K)
- Click "Search Courses"
- Boston, MA - Find courses in the Boston area
- Austin, TX - Discover Texas running courses
- Chicago, IL - Search Illinois certified courses
- Overland Park, KS - Find Kansas courses (includes the original local data)
- Course Details: View course ID, name, location, and expiration dates
- PDF Certification: Download and view official USATF certification documents
- Interactive Map: See course locations plotted on a map
- Cache System: Repeated searches use cached results for faster responses
Search for courses by location and distance.
Request Body:
{
"city": "Boston",
"state": "MA",
"distance": 5000
}
Response:
{
"courses": [
{
"id": "MA12345ABC",
"name": "Boston Marathon 5K",
"city": "Boston",
"state": "MA",
"distance": 5000,
"pdfUrl": "/api/pdf/MA12345ABC-course.pdf",
"extractedData": {
"addresses": ["123 Main St, Boston, MA"],
"venues": ["Boston Common"]
}
}
],
"message": "Found 1 courses",
"searchParams": {
"city": "Boston",
"state": "MA",
"distance": 5000
}
}
Serve PDF certification documents.
Get list of available states for search dropdown.
- server.js: Main Express server
- services/courseService.js: USATF search and PDF discovery logic
- downloads/: Directory for downloaded PDF files
- index.html: Main application interface with search and results
- viewer.html: PDF viewer for certification documents
- public/: Static assets and existing PDF files
- advanced_pdf_extractor.py: Extracts text and data from PDF files
- Outputs JSON for integration with Node.js backend
PORT
: Server port (default: 3000)NODE_ENV
: Environment mode (development/production)
- Default cache TTL: 1 hour (3600 seconds)
- Configurable in server.js
Extend the courseService.js
with new search strategies:
async function searchNewSource(course) {
// Implement new PDF discovery logic
return {
pdfPath: 'path/to/found.pdf',
source: 'new-source',
url: 'https://example.com/pdf'
};
}
Enhance advanced_pdf_extractor.py
with new extraction patterns:
def extract_new_data(pdf_text):
# Add new extraction logic
pattern = r'new-pattern-here'
matches = re.findall(pattern, pdf_text)
return matches
-
No courses found:
- Check spelling of city name
- Try nearby cities
- Verify state selection
-
PDF extraction fails:
- Ensure Python is in PATH
- Check file permissions
- Verify PDF file integrity
-
Server won't start:
- Check if port 3000 is available
- Verify all dependencies are installed
- Check Node.js version compatibility
Enable detailed logging by setting NODE_ENV=development
.
- Fork the repository
- Create a feature branch
- Implement your changes
- Test thoroughly
- Submit a pull request
MIT License - see LICENSE file for details.
- USATF for maintaining the course certification database
- OpenStreetMap for map tiles
- Leaflet.js for mapping functionality