Skip to content

ncap23/fiche_terrain

Repository files navigation

Drilling Data Collection App

A mobile-friendly Streamlit web application for collecting drilling data in the field and generating professional Excel reports for lithosphere layer analysis.

🎯 Purpose

This application solves the problem of manually transcribing drilling data from paper forms to Excel spreadsheets. Field workers can now:

  • Collect drilling data directly on smartphones/tablets
  • Generate professional Excel reports automatically
  • Ensure data consistency and validation
  • Work offline (planned feature)

πŸš€ Features

  • Mobile-Responsive Interface: Optimized for smartphones and tablets
  • Form-Based Data Collection: Intuitive forms for site info and layer data
  • Real-Time Validation: Immediate feedback on data quality
  • Professional Excel Reports: Multiple report templates with charts
  • Data Visualization: Charts and graphs for layer analysis
  • Export Options: Multiple Excel formats and templates

πŸ“‹ Data Collection

Site Information

  • Site name and location
  • Drilling date and operator
  • Project details
  • Drilling method and depth
  • Weather conditions

Layer Information

  • Depth ranges (from/to)
  • Rock type classification
  • Hardness assessment
  • Physical properties (color, porosity)
  • Geological features (water, fractures, fossils)
  • Weathering degree
  • Detailed descriptions

πŸ› οΈ Technology Stack

  • Framework: Streamlit (Python web framework)
  • Data Processing: Pandas for data manipulation
  • Excel Generation: OpenPyXL for professional reports
  • Validation: Custom validation system
  • Charts: Plotly for interactive visualizations
  • Mobile Support: Responsive CSS and touch-friendly interface

πŸ“ Project Structure

appli_sondage/
β”œβ”€β”€ app.py                      # Main Streamlit application
β”œβ”€β”€ requirements.txt            # Python dependencies
β”œβ”€β”€ README.md                   # Project documentation
β”œβ”€β”€ config/
β”‚   └── settings.py            # Configuration settings
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   └── form_components.py # Form UI components
β”‚   └── utils/
β”‚       β”œβ”€β”€ excel_generator.py # Excel report generation
β”‚       └── data_validator.py  # Data validation utilities
β”œβ”€β”€ templates/                 # Excel templates
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ reports/              # Generated reports
β”‚   β”œβ”€β”€ samples/              # Sample data
β”‚   └── temp/                 # Temporary files
└── tests/                    # Unit tests

πŸ”§ Installation

Using Pixi (Recommended)

  1. Install Pixi: Follow instructions at pixi.sh

  2. Clone and setup:

git clone <repository-url>
cd appli_sondage
pixi install
  1. Run the application:
# Local development
pixi run dev

# Network access (for mobile devices)
pixi run dev-network

Using Traditional Python/Pip

  1. Clone the repository:
git clone <repository-url>
cd appli_sondage
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the application:
streamlit run app.py

Access the app:

πŸ“± Mobile Usage

  1. Connect to WiFi: Ensure mobile device is on same network as computer
  2. Open Browser: Navigate to the network URL shown in terminal
  3. Add to Home Screen: (Optional) Add as PWA for app-like experience
  4. Collect Data: Use touch-friendly interface to input drilling data
  5. Generate Reports: Create and download Excel reports directly to device

πŸ“Š Report Types

Standard Report

  • Site information summary
  • Layer data table
  • Basic statistics and analysis
  • Rock type distribution charts

Detailed Analysis

  • All standard features plus:
  • Advanced geological analysis
  • Engineering recommendations
  • Additional charts and visualizations

Summary Only

  • Condensed report with key information
  • Perfect for quick field reports

πŸ” Data Validation

The app includes comprehensive validation:

  • Required field checking
  • Depth sequence validation
  • Layer continuity verification
  • Rock type classification
  • Cross-validation between site and layer data

🎨 Customization

Adding Rock Types

Edit config/settings.py to add new rock types:

ROCK_TYPES = {
    "sedimentary": ["Clay", "Sand", "Your_New_Type"],
    # ...
}

Excel Templates

  • Place custom templates in templates/ directory
  • Update template list in config/settings.py
  • Templates should follow OpenPyXL format structure

πŸ§ͺ Testing

Run tests using Pixi:

# Run all tests
pixi run test

# Run tests with coverage
pixi run test-coverage

# Lint code
pixi run lint

# Format code
pixi run format

Or with traditional Python:

python -m pytest tests/

πŸ”§ Troubleshooting

Common Issues

App won't start: Check Python version (3.8+ required)

python --version
pip install --upgrade streamlit

Mobile access issues: Ensure devices are on same network

streamlit run app.py --server.address 0.0.0.0

Excel generation errors: Verify OpenPyXL installation

pip install --upgrade openpyxl

πŸš€ Deployment Options

Local Network (Recommended for field use)

# With Pixi
pixi run dev-network

# With traditional Python
streamlit run app.py --server.address 0.0.0.0 --server.port 8501

Cloud Deployment

  • Streamlit Cloud: Deploy directly from GitHub
  • Heroku: Use provided Procfile
  • Docker: Container-based deployment

PWA (Progressive Web App)

Add to app.py for offline capabilities:

st.set_page_config(
    page_title="Drilling Data",
    page_icon="πŸ—οΈ",
    layout="wide",
    initial_sidebar_state="expanded",
    menu_items={
        'Get Help': None,
        'Report a bug': None,
        'About': "Drilling Data Collection App v1.0"
    }
)

πŸ“ˆ Future Enhancements

  • Offline data collection with sync
  • GPS location integration
  • Photo attachments for layers
  • Database integration for data persistence
  • Multi-language support
  • Advanced geological analysis algorithms
  • User authentication and project management
  • Real-time collaboration features

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“ License

This project is licensed under the MIT License - see LICENSE file for details.

πŸ‘₯ Authors

  • Nathan - Initial development and geological expertise

πŸ™ Acknowledgments

  • Streamlit team for the excellent framework
  • OpenPyXL contributors for Excel generation capabilities
  • Geological survey teams for domain expertise and feedback

Built with ❀️ for field geologists and drilling professionals

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages