Skip to content

Commit f3541bb

Browse files
committed
feat(assessment): add risk assessment treatments
1 parent 868dd17 commit f3541bb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+5316
-380
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ production.ini
2727
pyvenv.cfg
2828
test
2929
tmp/
30+
31+
*.ini
32+
*.xslx

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-slim
1+
FROM python:3.11-slim
22

33
# Set the working directory
44
WORKDIR /app
@@ -10,7 +10,7 @@ RUN apt-get update && \
1010
gcc \
1111
python3-dev \
1212
build-essential \
13-
linux-headers-amd64 && \
13+
linux-headers-amd64 libcairo2 libpango1.0-dev libffi-dev && \
1414
apt-get clean && \
1515
rm -rf /var/lib/apt/lists/*
1616

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ Getting Started
2121

2222
source venv/bin/activate
2323

24-
- Upgrade packaging tools, if necessary.
24+
- Install uv for faster package management (recommended).
2525

26-
python -m pip install -U pip setuptools
26+
pip install uv
2727

28-
- Install the project in editable mode with its testing requirements.
28+
- Install the project dependencies using uv.
29+
30+
uv pip sync combined_requirements.lock
31+
32+
Alternatively, you can use pip:
2933

3034
pip install -r requirements.txt -r test_requirements.txt
3135

i18n.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ if [ $# -eq 0 ]; then
3333

3434
echo "Update translations"
3535
for po in "$LOCALES_PATH"/*/LC_MESSAGES/$DOMAIN.po; do
36-
msgmerge --no-fuzzy-matching -o "$po" "$po" "$LOCALES_PATH"/$DOMAIN.pot
36+
msgmerge --previous -o "$po" "$po" "$LOCALES_PATH"/$DOMAIN.pot
3737
done
3838

3939
echo "Compile message catalogs"
4040
for po in "$LOCALES_PATH"/*/LC_MESSAGES/*.po; do
41-
msgfmt --statistics -o "${po%.*}.mo" "$po"
41+
msgfmt --check --use-fuzzy --statistics -o "${po%.*}.mo" "$po"
4242
done
4343

4444
# first argument represents language identifier, create catalog
4545
else
4646
cd "$LOCALES_PATH"
4747
mkdir -p $1/LC_MESSAGES
48-
msginit -i $DOMAIN.pot -o $1/LC_MESSAGES/$DOMAIN.po -l $1
48+
msginit --no-wrap -i $DOMAIN.pot -o $1/LC_MESSAGES/$DOMAIN.po -l $1 --no-translator
4949
fi

requirements.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ zope.interface==6.1
4949
zope.schema==7.0.1
5050
zope.sqlalchemy==3.1
5151
numpy==1.26.3
52-
openai==1.12.0
5352
plotly==5.18.0
54-
anthropic
53+
5554
redis[hiredis]==5.0.3
5655
uwsgi==2.0.25.1
5756
psycopg2-binary==2.9.9
@@ -62,5 +61,8 @@ langchain
6261
langfuse
6362
langchain-openai
6463
langchain-anthropic
64+
anthropic
65+
openai
6566

66-
-e .
67+
# PDF Generation
68+
WeasyPrint==52.5

src/riskmatrix/layouts/steps.pt

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,63 @@
1-
<div class="list-group">
1+
<div class="list-group steps">
22
<tal:b tal:repeat="step steps">
3-
<a href="${step.url}" class="list-group-item list-group-item-action${' active' if active else ''}${' disabled' if step.disabled else ''}" tal:attributes="aria-current 'true' if active else None; aria-disabled 'true' if step.disabled else None" tal:define="active layout.request.path_url == step.url">${repeat.step.number}. ${step.title}</a>
3+
<a href="${step.url}" class="step${' active' if active else ''}${' disabled' if step.disabled else ''}" tal:attributes="aria-current 'true' if active else None; aria-disabled 'true' if step.disabled else None" tal:define="active layout.request.path_url == step.url">
4+
${repeat.step.number}. ${step.title}
5+
</a>
46
</tal:b>
57
</div>
8+
9+
<style>
10+
.steps {
11+
display: flex;
12+
flex-direction: column;
13+
gap: 0.5rem;
14+
width: 280px;
15+
padding: 0.5rem;
16+
}
17+
18+
.step {
19+
display: flex;
20+
align-items: center;
21+
padding: 0.75rem 1rem;
22+
border-radius: 2px;
23+
color: hsl(240 10% 30%);
24+
text-decoration: none;
25+
font-size: 0.95rem;
26+
transition: all 0.15s;
27+
position: relative;
28+
overflow: hidden;
29+
/* Override bootstrap styles that add a border and box shadow */
30+
border: none;
31+
box-shadow: none;
32+
}
33+
34+
.step::before {
35+
content: '';
36+
position: absolute;
37+
left: 0;
38+
top: 0;
39+
bottom: 0;
40+
width: 3px;
41+
background: transparent;
42+
transition: all 0.15s;
43+
}
44+
45+
.step:hover:not(.disabled) {
46+
background: hsl(220 40% 97%);
47+
}
48+
49+
.step.active {
50+
background: hsl(220 40% 97%);
51+
color: hsl(220 90% 56%);
52+
}
53+
54+
.step.active::before {
55+
background: hsl(220 90% 56%);
56+
}
57+
58+
.step.disabled {
59+
opacity: 0.5;
60+
cursor: not-allowed;
61+
pointer-events: none;
62+
}
63+
</style>

src/riskmatrix/layouts/steps.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,8 @@ def steps(context: 'Organization', request: 'IRequest') -> 'RenderData':
3737
request.route_url('generate_risk_matrix')
3838
),
3939
Step(
40-
Markup('<s>Plan Actions</s>'),
41-
'#',
42-
disabled=True
40+
_('Plan Treatment'),
41+
request.route_url('treatment')
4342
),
4443
Step(
4544
_("Finish Assessment"),
@@ -61,6 +60,7 @@ def show_steps(request: 'IRequest') -> bool:
6160
'assess_impact',
6261
'assess_likelihood',
6362
'generate_risk_matrix',
63+
'treatment',
6464
'finish_assessment'
6565
)
6666
return False
4.14 KB
Binary file not shown.

0 commit comments

Comments
 (0)