Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Presidio maintenance #80

Merged
merged 8 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions presidio/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
32 changes: 19 additions & 13 deletions presidio/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
FROM python:3.9-slim
FROM python:3.11-slim

ARG NAME
ARG NLP_CONF_FILE=conf/default.yaml
ARG NLP_CONF_FILE=server/conf/default.yaml

ENV PORT=3000
ENV PIPENV_VENV_IN_PROJECT=1
ENV PIP_NO_CACHE_DIR=1
WORKDIR /usr/bin/${NAME}

COPY ./Pipfile* /usr/bin/${NAME}/
RUN pip install pipenv \
&& pipenv sync
EXPOSE ${PORT}
WORKDIR /app

COPY ./Pipfile* /app/
RUN \
pip install pipenv \
&& pipenv sync

# install nlp models specified in conf/default.yaml
COPY ./install_nlp_models.py /usr/bin/${NAME}/
COPY ${NLP_CONF_FILE} /usr/bin/${NAME}/${NLP_CONF_FILE}
RUN pipenv run python install_nlp_models.py --conf_file ${NLP_CONF_FILE}
COPY ./scripts/ /app/scripts/
COPY ${NLP_CONF_FILE} /app/${NLP_CONF_FILE}

COPY . /usr/bin/${NAME}/
EXPOSE ${PORT}
CMD pipenv run python app.py --host 0.0.0.0
RUN pipenv run python scripts/install_nlp_models.py --conf_file /app/${NLP_CONF_FILE}

COPY server/ /app/server/

CMD pipenv run python /app/server --host 0.0.0.0
18 changes: 9 additions & 9 deletions presidio/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ verify_ssl = true
name = "pypi"

[packages]
presidio_analyzer = "2.2.33"
presidio_anonymizer = "2.2.33"
spacy = ">=3.4.4"
flake8 = "*"
flask = "*"
phonenumbers = "*"
presidio-analyzer = "*"
presidio-anonymizer = "*"
pyyaml = "*"
regex = "*"
spacy = "*"
tldextract = "*"
flask = ">=1.1"
pyyaml = "*"
phonenumbers = ">=8.12"
typing-extensions = "*"

[dev-packages]
pytest = "*"
flake8= {version = ">=3.7.9"}
pep8-naming = "*"
flake8-docstrings = "*"
pep8-naming = "*"
pre_commit = "*"
pytest = "*"
1,519 changes: 878 additions & 641 deletions presidio/Pipfile.lock

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions presidio/local-testing.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
POST http://localhost:3000/batchanalyze
Content-Type: application/json
Accept: application/json

{
"json_to_analyze": {
"key_F": {
"key_a1": "My phone number is 212-121-1424"
},
"URL": "www.abc.com",
"key_c": 3,
"names": [
"James Bond",
"Clark Kent",
"Hakeem Olajuwon",
"No name here!"
],
"address": "200 University Ave West, Waterloo ON N2L5G7, Canada",
"DOB": "01-01-1989",
"gender": "Female",
"race": "Asian",
"language": "French"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading