Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Autonomous Maritime Seafarer Credential Verification System

An autonomous, modular maritime document verification pipeline combining Local LLMs, Frontier AI Models (Google Gemini), MCP Verifier Registries, and Playwright Browser Automation to ingest seafarer credentials (COC, CDC, FOC, Passport), discover official maritime administration portals, and execute verification in real time.


๐Ÿ“‘ Architecture Overview

                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 1. INGESTION (PDF / JPG / Multiple Scans)    โ”‚
                      โ”‚    - Drop into 'incoming_docs/'              โ”‚
                      โ”‚    - Or upload via Web UI (127.0.0.1:8000)   โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 2. PRIVATE DATA EXTRACTION (Local AI_Local)  โ”‚
                      โ”‚    - Extracts Seafarer Name, DOB, CDC, COC   โ”‚
                      โ”‚    - Strict privacy (No PII sent to cloud)   โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 3. MARITIME REGISTRY LOOKUP                  โ”‚
                      โ”‚    - IMO_STCW_Seafarer_Verification.xlsx     โ”‚
                      โ”‚    - Auto-resolves country & portal URL      โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚                               โ”‚
                [Cached Verifier Found]              [Unlisted Country]
                              โ”‚                               โ”‚
                              โ–ผ                               โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 4A. MCP SERVER โ”‚             โ”‚ 4B. GEMINI FRONTIER โ”‚
                      โ”‚ Cached Script  โ”‚             โ”‚ Autonomous Research โ”‚
                      โ”‚ Execution      โ”‚             โ”‚ & Script Synthesis  โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚                               โ”‚
                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 5. PLAYWRIGHT BROWSER AUTOMATION             โ”‚
                      โ”‚    - Real Chromium browser interaction       โ”‚
                      โ”‚    - Multimodal Vision CAPTCHA solving       โ”‚
                      โ”‚    - Certificate PDF file upload             โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                              โ–ผ
                      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                      โ”‚ 6. REPORT GENERATION & AUDIT LOGS            โ”‚
                      โ”‚    - verified_reports/<SEAFARER_TIMESTAMP>/  โ”‚
                      โ”‚    - JSON report + Full-page screenshot      โ”‚
                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start & Usage

1. Web Application Interface (Maritime AI Studio)

Launch the full-stack web UI with real-time model switching, drag-and-drop document upload, and interactive chat:

python web_app/server.py

Open http://127.0.0.1:8000 in your browser.


2. Autonomous Directory Watcher (Zero Manual Input)

The background service continuously monitors incoming_docs/ for new seafarer document folders:

python -u -m service.watcher
  1. Create a subfolder in incoming_docs/ (e.g. incoming_docs/Captain_Smith/).
  2. Drop in any number of PDF or JPG scans (COC, CDC, Passport, FOC).
  3. The watcher automatically classifies documents, executes verification, moves originals to processed_docs/, and generates reports in verified_reports/.

3. Country-Specific Live Verification Runners

You can test individual country portals directly with visible browser automation:

๐Ÿ‡ฎ๐Ÿ‡ณ India (DG Shipping - INDoS & CoC Checker)

python run_visible_verification.py --country India
# Or interactive INDoS checker:
python indos_checker.py
  • Portal: http://220.156.189.33/esamudraUI/jsp/examination/checker/COCSearch.jsp
  • Inputs: INDoS Number + Date of Birth

๐Ÿ‡ฒ๐Ÿ‡ฒ Myanmar (DMAOS All-In-One Self-Verification)

python verify_myanmar_aio.py
  • Portal: https://www.dmamyanmar.org/AllInOneCertificate/SelfVerification
  • Inputs: CDC No., CoC Serial No., Passport No., Requester Email

๐Ÿ‡ฎ๐Ÿ‡ฉ Indonesia (Direktorat Jenderal Perhubungan Laut)

# Visible browser on your screen:
python verify_indonesia_live.py --visible

# Headless background mode:
python verify_indonesia_live.py --headless
  • Portal: https://pelaut.dephub.go.id/index.php/verifikasi
  • Features:
    • Local Model (AI_Local) extracts Seafarer Code & Blanko Serial No.
    • Attaches certificate PDF to DOKUMEN_SERTIFIKAT
    • Captures live CAPTCHA and decodes with Frontier Gemini Vision
    • Automatically fills #captcha and submits Cek

4. End-to-End CLI Orchestrator

Run the full LangGraph pipeline on a specific PDF or custom seafarer parameters:

# Ingest PDF:
python main.py --pdf "path/to/document.pdf"

# Or manual profile:
python main.py --name "ANUP KAMBOJ" --nationality "India" --coc "09NL5250" --dob "07/09/1992"

5. Autonomous Unlisted Country Researcher

To research an unlisted maritime administration, discover its verification portal, and generate a new verification guide:

python research_country.py --country "Bahamas"

The report is saved to verified_reports/research_reports/Bahamas_Verification_Guide.md.


6. Local Model Interactive Chat & Vision CLI

Interact directly with the local LiteLLM model with text and image attachment support:

python chat_local_model.py
  • Type /image path/to/image.png to attach an image for analysis.
  • Type exit to quit.

๐Ÿ“ Repository Directory Structure

โ”œโ”€โ”€ .env                                # API keys and local endpoint configs
โ”œโ”€โ”€ README.md                           # This user guide
โ”œโ”€โ”€ memory.md                           # Project state, history & handoff context
โ”œโ”€โ”€ main.py                             # Master CLI pipeline orchestrator
โ”œโ”€โ”€ IMO_STCW_Seafarer_Verification.xlsx # Master IMO maritime authority database
โ”‚
โ”œโ”€โ”€ core/                               # Core schemas and configuration
โ”‚   โ”œโ”€โ”€ config.py                       # Environment variables and URLs
โ”‚   โ”œโ”€โ”€ schemas.py                      # Pydantic data contracts (SeafarerProfile, VerificationResult)
โ”‚   โ””โ”€โ”€ ocr_client.py                   # Document OCR client with retry logic
โ”‚
โ”œโ”€โ”€ local_llm/                          # Private Local Model Layer (AI_Local)
โ”‚   โ”œโ”€โ”€ extractor.py                    # Seafarer entity extraction from text
โ”‚   โ””โ”€โ”€ multi_doc_classifier.py         # Multi-document classifier (COC, CDC, FOC)
โ”‚
โ”œโ”€โ”€ frontier_llm/                       # Frontier Model Layer (Google Gemini)
โ”‚   โ””โ”€โ”€ gemini_client.py                # Verifier script synthesis & CAPTCHA vision solving
โ”‚
โ”œโ”€โ”€ registry/                           # Maritime Authority Registry
โ”‚   โ””โ”€โ”€ excel_registry.py               # Excel country & portal lookup with ISO aliases
โ”‚
โ”œโ”€โ”€ mcp_server/                         # MCP Verifier Tool Registry
โ”‚   โ”œโ”€โ”€ server.py                       # FastMCP server definition
โ”‚   โ””โ”€โ”€ registry_service.py             # Script discovery and registration service
โ”‚
โ”œโ”€โ”€ orchestrator/                       # LangGraph Orchestration State Machine
โ”‚   โ”œโ”€โ”€ workflow.py                     # Compiled LangGraph state machine
โ”‚   โ”œโ”€โ”€ auto_scraper_agent.py           # Playwright scraper generation agent
โ”‚   โ””โ”€โ”€ unlisted_country_researcher.py  # Unlisted country web researcher
โ”‚
โ”œโ”€โ”€ verifiers/                          # Country-Specific Playwright Verifiers
โ”‚   โ”œโ”€โ”€ base_verifier.py                # Abstract BaseVerifier class
โ”‚   โ”œโ”€โ”€ india_verifier.py               # Indian DG Shipping verifier
โ”‚   โ”œโ”€โ”€ myanmar_verifier.py             # Myanmar DMAOS verifier
โ”‚   โ””โ”€โ”€ indonesia_verifier.py           # Indonesian Dephub verifier (with CAPTCHA + Upload)
โ”‚
โ”œโ”€โ”€ service/                            # Background Services
โ”‚   โ””โ”€โ”€ watcher.py                      # Automated dropzone directory watcher
โ”‚
โ”œโ”€โ”€ web_app/                            # Full-Stack Web Application
โ”‚   โ”œโ”€โ”€ server.py                       # Threaded backend server & API proxy
โ”‚   โ””โ”€โ”€ static/                         # Glassmorphism HTML/CSS/JS interface
โ”‚
โ”œโ”€โ”€ incoming_docs/                      # Dropzone for incoming seafarer document folders
โ”œโ”€โ”€ processed_docs/                     # Archive of successfully processed documents
โ”œโ”€โ”€ verified_reports/                   # Output verification reports (JSON & screenshots)
โ””โ”€โ”€ screenshots/                        # Reference verification screenshots

โš™๏ธ Configuration (.env)

# Local Model Endpoint (LiteLLM OpenAI-Compatible)
LLM_URL=https://ai.edot-solutions.com/v1/chat/completions
LLM_MODEL=AI_Local
LLM_API_KEY=your_local_key_here

# Local Document OCR Endpoint
OCR_URL=http://192.168.1.34:8007/api/extract?mode=structured

# Google Gemini Frontier Model API Key
GEMINI_API_KEY=your_gemini_api_key_here

๐Ÿ”’ Privacy & Architecture Principles

  • Strict Data Privacy: All private seafarer identification (names, DOB, document numbers) is processed exclusively by the in-house Local Model (AI_Local).
  • Frontier Intelligence Isolation: Cloud Frontier models (Google Gemini gemini-3.6-flash) are utilized strictly for non-sensitive technical operations (analyzing public DOM trees, generating Playwright verifier code, and solving visual challenge puzzles).
  • Physical Browser UI Automation: Verifications are conducted exclusively via real browser rendering (Playwright Chromium) matching official maritime authority requirements.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages