A lightweight, secure, browser-based app for a small nonprofit that distributes resources to people in need.
kindmesh is a simple application that allows nonprofit organizations to:
- Track semi-anonymous interactions where community members receive aid (e.g., food, services)
- Avoid personal identifiers unless explicitly added, instead using key-based lookups or pseudonyms
- Log what was accessed, by whom (by key), and when
The application consists of:
- Neo4j Community Edition (Dockerized) as a backend graph database, with APOC libraries installed
- Streamlit frontend for data entry and visualization
- A simple role-based login system, integrated directly into the Neo4j graph
The Neo4j graph database uses the following schema:
(User {username, password_hash, role})
: Represents system users(Interaction {timestamp, type, notes})
: Represents resource distribution events(Recipient {key, pseudonym})
: Represents recipients of resources (semi-anonymous)- Relationships:
(:User)-[:CREATED]->(:User)
: Tracks user creation(:User)-[:LOGGED]->(:Interaction)
: Tracks who logged an interaction(:Interaction)-[:INVOLVES]->(:Recipient)
: Links interactions to recipients(:User)-[:PROMOTED]->(:User)
: Tracks admin promotions(:User)-[:DEMOTED]->(:User)
: Tracks admin demotions
The system has three roles:
- Greeter: The initial user (username: Hello, password: World!) who can only create new users
- Admin: Users who can manage other users, log interactions, and export data
- Friend: Regular users who can log interactions and view basic data
The first user created after the Greeter automatically becomes an Admin. All subsequent users default to the Friend role unless explicitly promoted.
There are two ways to run kindmesh:
- Using Docker (recommended for most users)
- Local installation (for development or if Docker is not available)
- Docker (version 19.03 or later)
- Docker Compose (version 1.27 or later)
- Git (for cloning the repository)
If you don't have Docker and Docker Compose installed, you can use the provided installation script:
chmod +x install_docker.sh
./install_docker.sh
This script will:
- Detect your operating system
- Install Docker and Docker Compose if they are not already installed
- Set up appropriate permissions
- Verify the installations
- Optionally start the application
-
Clone the repository:
git clone https://github.com/patchmemory/kindmesh.git cd kindmesh
-
You can start the application in one of two ways:
Option A: Using the provided scripts (recommended for first-time users)
Make the startup scripts executable:
chmod +x start.sh stop.sh
Start the application using the provided script:
./start.sh
This script will:
- Check if Docker and Docker Compose are installed
- Start the Neo4j database and Streamlit application
- Provide instructions for accessing the application
Option B: Using Docker Compose directly
Start the Neo4j database and Streamlit application:
docker compose up -d
This command starts all services defined in the docker-compose.yml file in detached mode.
-
Access the application:
- Open your browser and navigate to
http://localhost:8501
- Log in with the default credentials:
- Username:
Hello
- Password:
World!
- Username:
- Open your browser and navigate to
-
Create your first user:
- This user will automatically become an Admin
- Use this Admin account to create additional users
You can stop the application in one of two ways:
Option A: Using the provided script
./stop.sh
Option B: Using Docker Compose directly
docker compose down
To stop and remove all data (including the database), run:
docker compose down -v
- Python 3.12 or later (required for latest Streamlit features)
- pip (Python package manager)
- Neo4j Community Edition (installed separately)
Singularity is a container platform designed for scientific computing and high-performance computing (HPC) environments. This option is useful for users who need to run Neo4j in environments where Docker is not available or not allowed.
- Singularity (version 3.5 or later)
- Git (for cloning the repository)
If you don't have Singularity installed, you can use the provided installation script:
chmod +x install_singularity.sh
./install_singularity.sh
This script will:
- Detect your operating system
- Install Singularity and its dependencies if they are not already installed
- Verify the installation
- Optionally build and start the Neo4j container
-
Clone the repository:
git clone https://github.com/patchmemory/kindmesh.git cd kindmesh
-
Make the Singularity scripts executable:
chmod +x singularity_build.sh singularity_start.sh
-
Build the Singularity container:
./singularity_build.sh
This script will:
- Check if Singularity is installed
- Build a Singularity container for Neo4j based on the neo4j.def definition file
-
Start the Neo4j Singularity container:
./singularity_start.sh
This script will:
- Check if the Singularity container exists
- Create directories for data persistence
- Start the container with the appropriate bind mounts
- Provide instructions for accessing Neo4j
-
Access Neo4j:
- Open your browser and navigate to
http://localhost:7474
- Log in with the default credentials:
- Username:
neo4j
- Password:
kindmesh
- Username:
- Open your browser and navigate to
-
Start the Streamlit application separately:
./local_setup.sh ./local_start.sh
This will set up the Python environment and start the Streamlit application.
To stop the Singularity container, run:
singularity instance stop neo4j
- Python 3.12 or later (required for latest Streamlit features)
- pip (Python package manager)
- Neo4j Community Edition (installed separately)
-
Clone the repository:
git clone https://github.com/patchmemory/kindmesh.git cd kindmesh
-
Make the setup scripts executable:
chmod +x local_setup.sh local_start.sh
-
Run the setup script to create a virtual environment and install dependencies:
./local_setup.sh
If you encounter any package compatibility issues, you can run the setup script with the clean option:
./local_setup.sh --clean
This will remove the existing virtual environment and create a fresh one.
-
Install and configure Neo4j:
- Download and install Neo4j Community Edition
- Set the Neo4j password to
kindmesh
- Install APOC libraries for Neo4j
- Run the initialization script in
scripts/init-db.cypher
-
Start the application:
./local_start.sh
-
Access the application:
- Open your browser and navigate to
http://localhost:8501
- Log in with the default credentials:
- Username:
Hello
- Password:
World!
- Username:
- Open your browser and navigate to
To stop the locally running application, press Ctrl+C
in the terminal where it's running.
- Log in with the default Greeter account:
- Username:
Hello
- Password:
World!
- Username:
- Create your first user (will automatically become an Admin)
- Log out and log in with your new Admin account
As an Admin, you can:
-
Manage Users:
- Create new users (Friend or Admin role)
- Promote Friends to Admins
- Demote Admins to Friends (requires at least 2 Admins to confirm)
-
Log Interactions:
- Record resource distributions using recipient keys
- Optionally add pseudonyms for recipients
- Specify the type of resource and add notes
-
View Data:
- See summary statistics
- View recent interactions
- Analyze resource distribution by type
-
Export Data:
- Download interaction data as CSV or JSON
- Use for reporting or further analysis
As a Friend, you can:
-
Log Interactions:
- Record resource distributions
- Add notes and recipient information
-
View Basic Data:
- See summary statistics
- View recent interactions
-
Batch Entry:
- Import multiple interactions from a spreadsheet
- Automatically detect sections in the spreadsheet
- Select which sections to import
- Map spreadsheet columns to required fields
- Process and import data in bulk
-
Whole Person Approach Questionnaire:
- Complete comprehensive assessments for recipients
- Track needs across multiple life domains
- Save and resume questionnaires
- View summary of completed assessments
The Batch Entry feature allows Friends to import multiple interactions from a spreadsheet. This is useful for organizations that collect data in spreadsheets before entering it into kindmesh.
- Excel (.xlsx, .xls)
- CSV (.csv)
The spreadsheet can have multiple sections, each with its own set of columns. A typical spreadsheet might include:
-
Main section with columns like:
- ID # (used as Recipient Key)
- Name (can be used as Recipient Pseudonym)
- Date
- Agency
- Additional Family
- Address
- City
- Phone #
- Referrals
- Notes
-
Special sections that start with keywords like:
- "Yearly Follow-Up Calls"
- "Pledge Letters"
- "Additional Notes"
- Rows starting with "Update:" or "Referred:"
- Navigate to the "Batch Entry" tab in the Friend interface
- Upload your spreadsheet using the file uploader
- Review the preview of your data
- The system will automatically detect sections in your spreadsheet
- Select which sections you want to import
- For each selected section:
- Map the columns to the required fields (Recipient Key is required)
- Set a default Interaction Type if not mapped to a column
- Click "Process and Import Data" to start the import
- Review the results, including the number of successfully imported interactions and any errors
- Make sure your spreadsheet has a column that can be used as a Recipient Key
- If your spreadsheet has multiple sections, make sure they're clearly separated
- For sections with only a few rows, you can still import them by mapping the relevant columns
- If you encounter errors, check the error messages for specific information about what went wrong
The Whole Person Approach Questionnaire feature allows Friends to conduct comprehensive assessments of recipients' needs across multiple life domains. This feature implements the holistic intake process described in the organization's approach to helping individuals and families.
The questionnaire is divided into the following sections, based on the social determinants of health:
-
Financial Assessment
- Ability to pay bills
- Utility service status
-
Employment Assessment
- Current employment status
- Education level
-
Transportation Assessment
- Access to transportation for medical appointments
- Impact of transportation limitations
-
Food, Clothing, and Furniture Assessment
- Food security
- Resource sustainability
-
Child Care, Elder Care, Sick Spouse or Partner Assessment
- Challenges with dependent care
-
Medical and Dental Care Assessment
- Persistent pain or illness
- Access to healthcare
-
Federal and State Benefits Assessment
- Veteran status
- Assistance program participation
-
Mental Health Assessment
- Psychological symptoms
- Emotional well-being
-
Housing/Safe Shelter Assessment
- Housing stability
- Living conditions
-
Legal Services Assessment
- Legal needs across various domains
-
Relationships Assessment
- Family dynamics
- Safety concerns
-
Community Involvement Assessment
- Participation in community activities
-
Mentor Assessment
- Support network
-
Spiritual Focused Care Assessment
- Spiritual support resources
- Navigate to the "Questionnaire" tab in the Friend interface
- Enter the recipient's key identifier (required) and optional pseudonym
- If the recipient has existing questionnaire responses, you can view or edit them
- Complete each section of the questionnaire, saving as you go
- Navigate between sections using the "Back" and "Continue" buttons
- At any point, you can save your progress without moving to the next section
- After completing all sections, you'll see a summary of all completed assessments
- From the summary page, you can start a new questionnaire or edit the current one
- Complete all sections for a comprehensive view of the recipient's needs
- Pay special attention to sections where the recipient indicates significant challenges
- Use the questionnaire as a starting point for developing a holistic assistance plan
- Review previous questionnaire responses to track changes over time
- Consider the interconnections between different life domains when planning assistance
- Passwords are hashed using bcrypt
- No personal identifiers are required for recipients
- The application runs in a containerized environment
- Role-based access control limits user capabilities
kindmesh/
├── app/
│ ├── app.py # Main Streamlit application
│ └── utils/
│ └── graph.py # Neo4j database interaction module
├── scripts/
│ ├── init-db.cypher # Database initialization script
│ ├── generate_password_hash.py # Utility to generate password hashes
│ └── test_setup.sh # Test script for Docker setup
├── start.sh # Script to start the application with Docker
├── stop.sh # Script to stop the Docker containers
├── local_setup.sh # Script to set up local development environment
├── local_start.sh # Script to start the application locally
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Application container definition
├── requirements.txt # Python dependencies
└── README.md # This documentation
To add new features:
- Modify
app/utils/graph.py
to add new database interactions - Update
app/app.py
to add new UI components - Rebuild the Docker containers:
docker-compose up -d --build
-
Can't connect to Neo4j:
- Ensure the Neo4j container is running:
docker ps
- Check Neo4j logs:
docker-compose logs neo4j
- Ensure the Neo4j container is running:
-
Login issues:
- Verify you're using the correct credentials
- Check if the database was initialized properly
-
Data not showing up:
- Ensure interactions are being logged correctly
- Check database connection in the application logs
-
Package compatibility issues:
- If you see errors like
numpy.dtype size changed, may indicate binary incompatibility
, run:./local_setup.sh --clean
- This error typically occurs when there's a mismatch between numpy and pandas versions
- The clean option will create a fresh virtual environment with compatible package versions
- If you see errors like
-
Missing Altair module error:
- If you see an error like
ModuleNotFoundError: No module named 'altair.vegalite.v4'
, run:./local_setup.sh --clean
- This error occurs because Streamlit requires a specific version of Altair (4.2.0)
- The clean option will ensure all dependencies are correctly installed
- If you see an error like
-
Streamlit cache_resource error:
- If you see an error like
AttributeError: module 'streamlit' has no attribute 'cache_resource'
, this is because the application is using Streamlit 1.15.1 which doesn't support this feature - The application has been updated to use Streamlit 1.32.0 which supports
st.cache_resource
- If you're still seeing this error, make sure you're using the latest version of the code and have updated your dependencies with
pip install -r requirements.txt
- If you see an error like
-
Neo4j GraphDatabase name conflict error:
- If you see an error like
AttributeError: type object 'GraphDatabase' has no attribute 'driver'
, this is due to a name conflict between the imported Neo4j GraphDatabase class and the custom GraphDatabase class - The application has been updated to use an alias for the imported class to avoid this conflict
- If you're still seeing this error, make sure you're using the latest version of the code
- If you see an error like
-
Coroutine 'expire_cache' was never awaited warning:
- If you see a warning like
RuntimeWarning: coroutine 'expire_cache' was never awaited
, this is related to how Streamlit handles cache expiration - The application has been updated to include a TTL (Time To Live) parameter for the cache_resource decorator and to enable tracemalloc for better debugging
- These changes should resolve the warning and improve cache handling
- If you see a warning like
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Neo4j for the graph database
- Streamlit for the web interface
- The nonprofit community for their valuable feedback
- Special thanks to Junie for significant contributions to the project