GithubHelp home page GithubHelp logo

dap's Introduction

DAP

Debtor Advice Program

Scans a court IBM mainframe for recent cases filed by creditors and sends debtors a letter or e-mail about their legal rights.

  • Because the mainframe does not provide an address for the defendant, a search is run using the pipl API
  • The letter is sent by the lob API
  • The e-mail is sent by the clicksend API, which unlike plain smtp reduces likelihood of being marked spam

Dependencies

$ sudo apt-get install git python3 python3-pip s3270 x3270 -y

Note: s3270 is in non-free repository. x3270 is useful for debugging mainframe interactions but not required, see comments in mainframe.py.

$ pip3 install py3270 lob piplapis-python
$ pip3 install git+https://github.com/ClickSend/clicksend-python.git

Components

main.py

- calls get_cases.py
- calls screen_cases.py
- calls identify_cases.py
- calls send_letters.py

```
NOTE: These four scripts are meant to be run consecutavely in the order above.
Each step is designed that a failure of one script will not result in data loss.
Any unprocessed data will simply be picked up and handled in the next pass.
This script is meant to run every 2-3 hours.
```

get_cases.py

- checks for new cases in all 4 local courts by connecting to mainframe, using py3720 and an internal api in mainframe.py
- keeps a database of existing case numbers in CASENUMBERS, because case numbers are issued sequentially by year, searches start with last known good+1 and fail after 15 cases are not found
- stores data from new cases for analysis in NEW_CASE in dap.sqlite

screen_cases.py

- opens new cases in NEW_CASE
- screens plaintiff_name for keywords and known creditors which are listed as CREDITOR
- if a match is found, case is moved to possible cases in POSSIBLE_CASE
- if a match is not found, case is moved to rejected cases in REJECTEDCASES and noted why

identify_cases.py

- opens possible cases in POSSIBLE_CASE
- matches cases in POSSIBLE_CASE to people using the pipl api, via api_interfaces.py
- if a match is found, case is moved to possible cases in POSSIBLE_CASE
- if a match is not found, case is moved to rejected cases in REJECTEDCASES and noted why

send_letters.py

- processes MATCHEDCASES
- send prospective debtors a letter, e-mail, and/or facebook message based on available data
- sends letter via USPS via lob api
- sends e-mail via clicksend api
- saves processed cases to PROCESSEDCASES with time-stamp for any/all of above

api_interfaces.py

- contains functions for interacting with various apis

api_keys.py (only .example uploaded to github)

- contains api keys for apis

database.py

- contains functions for interacting with local sqlite database

mainframe.py

- contains functions for interacting with court mainframe

mainframe_credentials.py (only .example uploaded to github)

- stores contains mainframe credentials

dap_logging.py

- contains functions for logging application events

- check file for usage information

combine_logs.py

- combine all logs in logging directory and order based on session log count

dap.sqlite, tables:

- CASENUMBERS - for tracking last known case numbers
- NEW_CASE - all cases scanned from mainframe
- POSSIBLE_CASE - cases whose plaintiff contains a keyword from CREDITOR
- MATCHED_CASE - cases whose defendant has been matched to a person
- PROCESSED_CASE - cases that were sent letter, e-mail, or facebook message, with time-stamp
- REJECTED_CASE - cases rejected for no matching creditor or individual
- CREDITOR - list of creditors and keywords for creditors

database.sql:

- creates dap.sqlite database from scratch

test_data.sql:

- populates dap.sqlite database with test data

logs:

- mainframe.log - for logging mainframe responses
- database.log - for logging database events
- pipl.log - for logging pipl api responses
- clicksend.log - for logging clicksend api responses
- lob.log - for logging lob api responses
- compliance.log - for logging compliance-related activities

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.