"""
Utility helpers for the library app.
"""

import logging

logger = logging.getLogger(__name__)


def neo4j_available():
    """
    Check whether Neo4j is reachable.

    Returns True if a simple Cypher query succeeds, False otherwise.
    Used to guard views/tests that require Neo4j.
    """
    try:
        from neomodel import db

        db.cypher_query("RETURN 1")
        return True
    except Exception:
        return False
