[go: nahoru, domu]

Skip to content

baditaflorin/LibreFOIA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibreFOIA

LibreFOIA is a comprehensive tool designed to handle various tasks related to email processing, data extraction, and database management.

This repository contains scripts and configurations for reading emails, extracting data from different file types, storing information in a database, and sending emails.

Table of Contents

Installation

To install the necessary dependencies, run:

npm install

Usage

Pre-requirements

You need to setup a Google Service Account https://cloud.google.com/iam/docs/service-accounts-create

Create a new Project

https://console.cloud.google.com/home/dashboard?project=autocereri544&authuser=8

To get the permissions that you need to create service accounts, ask your administrator to grant you the Create Service Accounts (roles/iam.serviceAccountCreator) IAM role on the project.

Download the json file that you will generate and add it to ./src/config/service_account.json

Running the scripts

Navigate to the src folder

cd ./src

Sending Emails

To send an email:

node step_1_0_send_email.js --from <email_address> --to <email_address> --subject "Subject" --body "Body of the email"

Bulk Email Sender

To send emails in bulk from a JSON file:

node step_1_1_bulkEmailSender.js --file <path_to_json_file> --subject "Subject" --body <path_to_body_file> --from <from_email>

Reading Emails

To read emails from a specified email address:

node step_3_0_read_emails.js --email <email_address> --max <number_of_emails> --download

To read emails from a specified email address and save to a file:

node step_3_0_read_emails.js --email <email_address> --max <number_of_emails> --download

Adding Emails to Database

To add the fetched emails to the database:

curl -X POST -H "Content-Type: application/json" --data-binary "@response_read_emails.json" http://localhost:3000/add-emails

Identify unanswered emails by subject

To find emails that are not in the database but are present in a JSON file of emails you have send:

node step_2_2_identify_unanswered_emails_by_subject.js --subject "Subject" --file <path_to_json_file>

Scripts

config/emailService.js

Handles the creation of sent email records.

config/models.js

Defines the Sequelize models for interacting with the database.

data_extractor

Contains utilities for extracting data from various file types:

  • csvUtils.js: Extracts text from CSV files.
  • data_extractor.js: Main data extraction logic.
  • db_setup.js: Sets up the database connection.
  • excelUtils.js: Extracts text from Excel files.
  • fileUtils.js: Utilities for file extraction.
  • pdfUtils.js: Extracts text from PDF files.
  • wordUtils.js: Extracts text from Word and ODT files.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with your changes.

License

This project is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published