A Django application for managing spatial data with user authentication, data import/export capabilities, interactive mapping features, and typology management for standardized data categorization.
- User Management: Registration, authentication, and role-based access control
- Dataset Management: Create, edit, and manage datasets with access control (users and groups)
- Spatial Data: Store and manage geometry points with associated data
- Data Import: Import CSV files with automatic coordinate system detection
- Data Export: Export datasets as CSV with year-prefixed columns
- Interactive Maps: View and edit data on interactive maps with clustering and overlapping point handling
- File Management: Upload and manage files associated with data entries
- Audit Logging: Track user actions and data changes
- Typology Creation: Create standardized categorization systems for data entries
- Typology Entries: Define codes, categories, and names for consistent data classification
- CSV Import/Export: Import typology entries from CSV files and export existing typologies
- Dataset Integration: Link typologies to datasets for standardized data entry
- Usage Code Dropdowns: Interactive dropdowns for selecting typology codes during data entry
- Staff/Admin Permissions: Role-based access control using Django's
is_staff
andis_superuser
fields - User Creation: Administrators can create new users with specific permissions
- User Editing: Edit user details, permissions, and group memberships
- Group Management: Create and manage user groups with member assignment
- Permission System: Restricted dataset and typology creation to staff and admin users only
- Custom Password Reset: Complete password reset workflow with custom templates
- Enhanced Login: Redesigned login form with modern styling
- User Registration: Mobile-friendly registration form with validation
- Profile Management: User profile page with email and password change functionality
- Responsive Data Tables: Transposed table layout with data entries as columns
- AJAX Photo Upload: Real-time file upload for data entry photos
- Map Improvements: Fixed zoom levels, circle markers, and overlapping point handling
- Auto-generation: Automatic ID generation for new geometry points
- Copy Functionality: Copy data from previous years to new entries
- ISR Brand Colors: Consistent color scheme using ISR brand colors (
#0047BB
,#001A70
,#92C1E9
) - Modern Templates: Card-based layouts with Bootstrap 5 styling
- Mobile Responsive: Optimized for mobile devices with responsive design
- Icon Integration: Bootstrap Icons throughout the interface
- Consistent Navigation: Updated navigation with conditional display based on user permissions
# Create database migrations
docker compose exec app python manage.py makemigrations
# Start the application
docker compose up -d
# Apply migrations
docker compose exec app python manage.py migrate
# Create superuser
docker compose exec app python manage.py createsuperuser
The application includes a production-ready Docker setup with GitHub Actions for automated builds.
- Development:
Dockerfile
- For local development - Production:
Dockerfile.prod
- Multi-stage build with optimizations
Images are automatically built and pushed to GitHub Container Registry on:
- Push to main/master branch
- Tagged releases (v*)
- Pull requests (for testing)
-
Set up environment variables:
cp env.example .env # Edit .env with your configuration
-
Test the production build:
./test-production-build.sh
-
Deploy using the script:
./deploy.sh
-
Manual deployment:
docker-compose -f docker-compose.prod.yml up -d
Required environment variables for production:
DJANGO_SECRET_KEY
: Django secret keyPOSTGRES_DB
: Database namePOSTGRES_USER
: Database userPOSTGRES_PASSWORD
: Database password
To enable password reset emails and other email functionality, configure SMTP settings:
# Email backend (use SMTP for production)
EMAIL_BACKEND=django.core.mail.backends.smtp.EmailBackend
# SMTP server configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_USE_SSL=False
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password
# Email settings
DEFAULT_FROM_EMAIL=noreply@isrfield.dataplexity.eu
SERVER_EMAIL=server@isrfield.dataplexity.eu
EMAIL_SUBJECT_PREFIX=[ISR Field]
Gmail:
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password # Use App Password, not regular password
Outlook/Hotmail:
EMAIL_HOST=smtp-mail.outlook.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@outlook.com
EMAIL_HOST_PASSWORD=your-password
Custom SMTP Server:
EMAIL_HOST=your-smtp-server.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-username
EMAIL_HOST_PASSWORD=your-password
Test your SMTP configuration:
docker compose exec app python manage.py test_email --to your-email@example.com
The application includes health check endpoints:
- Health endpoint:
http://localhost:8000/health/
- Docker health checks: Automatic container health monitoring
Typologies provide standardized categorization for data entries across datasets:
- Access Typology Management: Navigate to "Typologies" in the main menu
- Create New Typology: Click "Create New Typology" button (staff/admin only)
- Define Entries: Add typology entries with:
- Code: Integer identifier for the entry
- Category: Grouping category (e.g., "Residential", "Commercial")
- Name: Descriptive name for the entry
- CSV Import: Import typology entries from CSV files
- Assign to Datasets: Link typologies to datasets for standardized data entry
Import typology entries using CSV files with the following format:
code,category,name
100,Residential,Residential Building
200,Commercial,Office Building
300,Industrial,Factory
When a dataset has an assigned typology:
- Usage Code Fields: Display dropdown menus with typology entries
- Auto-completion: Select from predefined categories and codes
- Consistency: Ensures standardized data across datasets
- Automatic Coordinate Detection: Supports multiple coordinate systems:
- WGS84 (LAT/LON, LATITUDE/LONGITUDE)
- Austrian coordinate systems (EPSG:31256, 31257, 31258)
- Scaled coordinates for various projections
- Flexible Column Mapping: Supports both year-prefixed and generic column names
- Data Validation: Handles missing data with social science coding (999 = missing)
- Error Handling: Comprehensive error reporting and validation
The application supports various CSV formats:
Standard Format:
ID,ADRESSE,GEB_X,GEB_Y,2016_NUTZUNG,2016_CAT_INNO,2022_NUTZUNG,2022_CAT_INNO
test_001,Test Address 1,656610,3399131,870,999,870,999
test_002,Test Address 2,636410,3399724,640,0,640,0
Alternative Coordinate Formats:
ID,ADRESSE,X,Y,2016_NUTZUNG,2016_CAT_INNO
test_001,Test Address 1,16.3738,48.2082,870,999
With Entry Names:
ID,ADRESSE,GEB_X,GEB_Y,2016_NUTZUNG,2016_CAT_INNO,NUTZUNG_NAME
test_001,Test Address 1,656610,3399131,870,999,Residential Building
- Coordinate System Detection: Automatically detects coordinate system based on value ranges
- Missing Data Handling: Treats 'NA', 'N/A', 'NULL' as missing data
- Social Science Coding: Uses 999 for missing integer values
- Entry Name Support: Optional
NUTZUNG_NAME
column for entry descriptions
The application supports exporting datasets as CSV files with the following features:
- Geometry-based rows: Each geometry point becomes a row in the CSV
- Year-prefixed columns: Data entries are organized by year (e.g.,
2016_USAGE_CODE1
,2022_CAT_INNO
) - Configurable options: Choose whether to include coordinates and empty years
- Automatic formatting: Proper CSV formatting with headers and data validation
The exported CSV contains:
ID
: Unique identifier for each geometryADRESSE
: Address of the geometryGEB_X
,GEB_Y
: Coordinates (optional)- Year-prefixed columns for each data field:
USAGE_CODE1
,USAGE_CODE2
,USAGE_CODE3
CAT_INNO
,CAT_WERT
,CAT_FILI
ID,ADRESSE,GEB_X,GEB_Y,2016_USAGE_CODE1,2016_CAT_INNO,2022_USAGE_CODE1,2022_CAT_INNO
test_001,Test Address 1,16.3738,48.2082,100,1,100,1
test_002,Test Address 2,16.3748,48.2092,101,2,101,2
- Fixed Zoom Level: Maps maintain consistent zoom level (18) for detailed viewing
- Circle Markers: Data points displayed as circles instead of pins
- Clustering: Overlapping points are clustered for better visualization
- Point Selection: Interactive selection of overlapping points with detailed information
- Full-width Display: Maps use full available width for optimal viewing
- Responsive Tables: Data entries displayed in transposed table format
- Year-based Columns: Each year's data displayed in separate columns
- Copy Functionality: Copy data from previous years to new entries
- Photo Upload: AJAX-based photo upload for data entries
- Auto-generation: Automatic ID generation for new geometry points
The application supports flexible access control for datasets:
- Owner: The user who created the dataset (always has full access)
- Individual Users: Specific users granted direct access
- Groups: All members of selected user groups have access
- Public: Anyone can access the dataset (if enabled)
- Regular Users: Can view and interact with accessible datasets
- Staff Users: Can create datasets, typologies, and manage users
- Superusers: Full administrative access to all features
- Dataset Creation: Only staff and superusers can create new datasets
- Typology Creation: Only staff and superusers can create typologies
- User Management: Only staff and superusers can manage users and groups
- Dataset owners can manage access through the "Manage Access" interface
- Users can be added/removed individually or through group membership
- Access changes are logged for audit purposes
- Group membership automatically grants access to all datasets shared with that group
- Public datasets: Accessible to everyone
- Owner access: Dataset creator always has access
- Individual user access: Directly shared users have access
- Group access: Users in shared groups have access
- ISR Brand Colors: Primary (
#0047BB
), Secondary (#001A70
), Accent (#92C1E9
) - Bootstrap 5: Modern responsive framework
- Bootstrap Icons: Consistent iconography throughout
- Card-based Layout: Clean, organized interface design
- Mobile Optimized: Touch-friendly interface for mobile devices
- Tablet Support: Optimized layouts for tablet screens
- Desktop Experience: Full-featured interface for desktop users
- Conditional Display: Navigation items shown based on user permissions
- Breadcrumb Navigation: Clear navigation paths
- Quick Actions: Contextual action buttons throughout the interface
- Custom Password Reset: Secure password reset workflow
- Session Management: Proper session handling and security
- CSRF Protection: Cross-site request forgery protection
- Permission Checks: Server-side validation of all user actions
- Access Control: Granular access control for all data
- Audit Logging: Comprehensive logging of user actions
- Input Validation: Server-side validation of all user inputs
- File Upload Security: Secure file upload handling
- Django 5.2: Modern Python web framework
- PostgreSQL: Robust relational database with PostGIS extension
- Django ORM: Object-relational mapping for database operations
- Django Admin: Built-in administrative interface
- Bootstrap 5: Responsive CSS framework
- Leaflet.js: Interactive mapping library
- AJAX: Asynchronous data loading and form submission
- JavaScript: Modern ES6+ JavaScript for enhanced interactivity
- Docker: Containerized deployment
- Nginx: High-performance web server
- PostgreSQL: Production-ready database
- GitHub Actions: Automated CI/CD pipeline