Chore: Delete import functionality as it is not needed

Chore: Update the dockerfile to install poetry
Chore: Upgrade the toml for new packages
This commit is contained in:
Amritanshu Agrawal 2022-04-17 12:43:04 +05:30
parent 8ba18233ab
commit 96fc9194d9
3 changed files with 19 additions and 55 deletions

View File

@ -1,37 +0,0 @@
#!/usr/bin/env bash
scp knox:leg.tar.zip /home/tanshu/Programming/luthor/DB/csv
cd /home/tanshu/Programming/luthor/DB/csv
tar xvf leg.tar.zip
docker run -it --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres -c "drop database luthor"'
docker run -it --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres -c "create database luthor"'
docker run -it --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "CREATE EXTENSION btree_gist;"'
cd /home/tanshu/Programming/luthor/luthor
alembic upgrade 74058d75b7a0
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy acts(old_id, name) from /mnt/a-acts.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/b-advocates.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy advocates(old_id, name, mobile, landline, address, email) from /mnt/b-advocates.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/c-case-types.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy case_types(old_id, name) from /mnt/c-case-types.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/d-court-statuses.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy court_statuses(old_id, name) from /mnt/d-court-statuses.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy courts(old_id, name) from /mnt/e-courts.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/f-departments.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy departments(old_id, name) from /mnt/f-departments.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy natures(old_id, name) from /mnt/g-natures.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy office_statuses(old_id, name) from /mnt/h-office-statuses.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy permissions(old_id, name) from /mnt/i-permissions.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy users(old_id, name, password, locked_out) from /mnt/j-users.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/k-offices.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy offices(old_id, old_department_id, name, address, email) from /mnt/k-offices.csv"'
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy role_permissions(old_user_id, old_permission_id) from /mnt/l-user-roles.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/m-cases.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy cases(old_id, old_office_file_number, office_file_number, court_case_number, year, title, docket_number, receipt_date, limitation_date, filing_date, appear_on_behalf_of, question_of_law, aor_name, opposing_council_aor, lower_court_case_number, date_of_impugned_judgement, brief_description, remarks, slp_counter, contact_detail, case_connected_with, old_court_id, old_department_id, old_office_id, old_case_type_id, old_act_id, old_nature_id, old_court_status_id, old_office_status_id, opposing_council_detail, bunch_cases) from /mnt/m-cases.csv with delimiter E'\''\t'\'' null as '\'''\''"'
#docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy contacts(old_id, old_office_id, old_department_id, brief, next_hearing_date, court_status_id, court_number, item_number) from /mnt/n-contact-persons.csv"'
sed -i 's/\x0//g' /home/tanshu/Programming/luthor/DB/csv/o-hearings.csv
docker run -it -v /home/tanshu/Programming/luthor/DB/csv:/mnt --link postgres:db --rm --env PGPASSWORD="123456" postgres:alpine bash -c 'psql -h db -U postgres luthor -c "\copy hearings(old_id, old_case_id, bench, proceedings, next_hearing_date, old_court_status_id, court_number, item_number) from /mnt/o-hearings.csv with delimiter E'\''\t'\'' null as '\'''\''"'
alembic upgrade 87a06eaadd34
# To filter out bad hearings which will now not import
# select cs.name, c.office_file_number, ch.next_hearing_date from (select case_id, next_hearing_date from hearings group by case_id, next_hearing_date having count(*) > 1) as ch inner join cases c on ch.case_id = c.id inner join case_sources cs on c.case_source_id = cs.id order by next_hearing_date desc;
# Temp fix to delete hearings
# delete from hearings where next_hearing_date is null;

View File

@ -2,7 +2,7 @@ FROM node:latest AS builder
ADD https://git.tanshu.com/api/v1/repos/tanshu/luthor/branches/main /main.json ADD https://git.tanshu.com/api/v1/repos/tanshu/luthor/branches/main /main.json
RUN git clone --single-branch --depth 1 --branch main https://git.tanshu.com/tanshu/luthor.git /app RUN git clone --single-branch --depth 1 --branch main https://git.tanshu.com/tanshu/luthor.git /app
WORKDIR /app/otis WORKDIR /app/otis
RUN npm install --unsafe-perm --legacy-peer-deps && /app/otis/node_modules/.bin/ng build --prod RUN npm install --unsafe-perm && /app/otis/node_modules/.bin/ng build
FROM python:latest FROM python:latest
@ -14,7 +14,7 @@ COPY --from=builder /app/frontend /app/frontend
WORKDIR /app WORKDIR /app
# Install Poetry # Install Poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | POETRY_HOME=/opt/poetry python && \ RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | POETRY_HOME=/opt/poetry python && \
cd /usr/local/bin && \ cd /usr/local/bin && \
ln -s /opt/poetry/bin/poetry && \ ln -s /opt/poetry/bin/poetry && \
poetry config virtualenvs.create false poetry config virtualenvs.create false

View File

@ -5,26 +5,27 @@ description = "Legal case management"
authors = ["tanshu <git@tanshu.com>"] authors = ["tanshu <git@tanshu.com>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.8" python = "^3.9"
uvicorn = {extras = ["standard"], version = "^0.13.3"} uvicorn = {extras = ["standard"], version = "^0.17.6"}
fastapi = "^0.63.0" fastapi = "^0.75.1"
python-jose = {extras = ["cryptography"], version = "^3.2.0"} python-jose = {extras = ["cryptography"], version = "^3.3.0"}
passlib = {extras = ["bcrypt"], version = "^1.7.4"} passlib = {extras = ["bcrypt"], version = "^1.7.4"}
psycopg2-binary = "^2.8.6" psycopg2-binary = "^2.9.3"
SQLAlchemy = "^1.3.22" SQLAlchemy = "^1.4.34"
python-multipart = "^0.0.5" python-multipart = "^0.0.5"
PyJWT = "^1.7.1" PyJWT = "^2.3.0"
alembic = "^1.5.2" alembic = "^1.7.7"
itsdangerous = "^1.1.0" itsdangerous = "^2.1.2"
python-dotenv = "^0.14.0" python-dotenv = "^0.19.2"
pydantic = {extras = ["dotenv"], version = "^1.7.3"} pydantic = {extras = ["dotenv"], version = "^1.9.0"}
starlette = "^0.13.6" starlette = "^0.17.1"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
flake8 = "^3.8.4" flake8 = "^4.0.1"
black = "^20.8b1" black = "^22.3.0"
isort = {extras = ["toml"], version = "^5.7.0"} isort = {extras = ["toml"], version = "^5.10.1"}
pre-commit = "^2.9.3" pre-commit = "^2.17.0"
mypy = "^0.942"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]