Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
875e188
chore: Add header.
mheggelund Feb 28, 2025
2649329
chore: Update x-frame-options and referrer-policy
mheggelund Feb 28, 2025
a2e3ff1
update path in algorithm workflow, set tsconfig to strict and add ini…
Vandor1 Feb 26, 2025
31230db
Appinsights in web + bicep file
Vandor1 Feb 26, 2025
d983b96
app insight/monitoring added to api + web.
Vandor1 Feb 28, 2025
152dde4
Target: dev is back in compose. Logger error handling removed, chown …
Vandor1 Feb 28, 2025
b4e35d3
Add api-secret to radix
Vandor1 Mar 3, 2025
4ad051b
web works locally, radixconfig update, added connect-src for app insi…
Vandor1 Mar 3, 2025
8609cce
Update runbook.md
Vandor1 Mar 4, 2025
0740953
chore(deps): bump flask in /api in the pip group across 1 directory
dependabot[bot] May 13, 2025
275d6c2
chore(deps-dev): bump vite
dependabot[bot] Mar 25, 2025
db7d511
ci: Remove codeql action to use built in github scan.
mheggelund Oct 28, 2025
028666e
chore: update every outdated dependency in package.json
sebastianvitterso Mar 2, 2026
2dbddd0
chore: update every outdated dependency in pyproject.toml
sebastianvitterso Mar 2, 2026
4edf465
chore: fix new typing issues after updating packages
sebastianvitterso Mar 2, 2026
7de4fcd
chore: remove typing for recharts (built-in now)
sebastianvitterso Mar 2, 2026
f0e119d
chore(deps): bump the pip group across 1 directory with 3 updates
dependabot[bot] Mar 2, 2026
4599411
chore: remove rechart types from lockfile too
sebastianvitterso Mar 2, 2026
30cc005
chore: update pre-commit
sebastianvitterso Mar 2, 2026
f27ba84
chore(deps): bump the pip group across 1 directory with 4 updates
dependabot[bot] Mar 2, 2026
1e511f5
chore: fix info exposure and add security permissions to workflows
Vandor1 Mar 2, 2026
6548705
chore: pre-commit + pyproject warning fix
Vandor1 Mar 2, 2026
bf08624
chore: fix low-hanging typing issues in api
sebastianvitterso Mar 2, 2026
4da7c4f
chore: update actions versions
sebastianvitterso Mar 2, 2026
241f24e
chore: CQ
Vandor1 Mar 2, 2026
201a6e3
chore: update Dockerfile dependency versions
sebastianvitterso Mar 2, 2026
1d27f78
refactor: rename Hooks.tsx -> useLocalStorage.ts
sebastianvitterso Mar 2, 2026
35aa730
chore: run biome (and update/configure it)
sebastianvitterso Mar 2, 2026
abe7fb2
refactor: remove unused User interface
sebastianvitterso Mar 2, 2026
cad7c9d
refactor: structure particle size context as desired
sebastianvitterso Mar 2, 2026
aefdbdc
refactor: replace class-based Api.ts, with useApi hook
sebastianvitterso Mar 2, 2026
a7b4ba6
refactor: improve api function names
sebastianvitterso Mar 2, 2026
f9fc6b8
refactor: move colors into lib
sebastianvitterso Mar 2, 2026
1a0cfc6
refactor: move and rename ceramicDiscSizes
sebastianvitterso Mar 2, 2026
96a7a9f
refactor: move BridgingOption enum
sebastianvitterso Mar 2, 2026
23afacf
refactor: move Types.ts into lib
sebastianvitterso Mar 2, 2026
19815b0
refactor: split Utils.ts into separate util files
sebastianvitterso Mar 2, 2026
d878bb2
refactor: rename Main component to Home
sebastianvitterso Mar 2, 2026
b65d7e6
refactor: use named exports instead of export default
sebastianvitterso Mar 2, 2026
7fcdd85
refactor: prefer actual functions over arrow functions
sebastianvitterso Mar 2, 2026
25f767e
refactor: prefer `type` over `interface` (just to be consistent)
sebastianvitterso Mar 2, 2026
899ce7d
refactor: prefer actual functions over arrow functions
sebastianvitterso Mar 2, 2026
2982412
fix: set particle size `from` default to 1.01
sebastianvitterso Mar 3, 2026
842f584
refactor: fix typing issues in api
sebastianvitterso Mar 2, 2026
c514843
fix: issue with responseType "header" (it's not a header)
sebastianvitterso Mar 3, 2026
d6d02e3
fix: sometimes the report returned 0 bytes because it hadn't flushed …
sebastianvitterso Mar 3, 2026
b146c8b
refactor: remove unneccessary None's (there's more, we'll get them ne…
sebastianvitterso Mar 3, 2026
634e5c6
refactor: casing issue with bridgeRequestHandler
sebastianvitterso Mar 3, 2026
6166c41
refactor: use dataclasses where possible
sebastianvitterso Mar 3, 2026
ce8059c
fix: bug with using dataclasses on User class (illegal extra kwargs)
sebastianvitterso Mar 3, 2026
4f7d797
refactor: rename controller to function name
sebastianvitterso Mar 3, 2026
0845dcb
refactor: rename function to controller name
sebastianvitterso Mar 3, 2026
0a57dae
fix: use `float` for Product.mass
sebastianvitterso Mar 3, 2026
8a1c98c
refactor: rename main->optimizer
sebastianvitterso Mar 3, 2026
655bc3c
refactor: rebuild optimizer-controller and use dataclasses
sebastianvitterso Mar 3, 2026
eefd1f7
chore: add settings.json with python settings
sebastianvitterso Mar 3, 2026
5a9d73d
refactor: create `use_cases` folder
sebastianvitterso Mar 3, 2026
63c7c06
refactor: add ProductDTO dataclass
sebastianvitterso Mar 3, 2026
ba4a641
refactor: rename usecases a bit
sebastianvitterso Mar 3, 2026
22618ee
refactor: add usecase layer to sharepoint sync
sebastianvitterso Mar 3, 2026
2d3189c
refactor: complete transition to ProductDTO
sebastianvitterso Mar 3, 2026
aa64764
chore: re-add "src/" to test file path
sebastianvitterso Mar 3, 2026
bc99897
chore: fix misspelled exception name
sebastianvitterso Mar 3, 2026
70e3d95
chore: update jinja2 to 3.1.6 (security)
sebastianvitterso Mar 3, 2026
f0fe4b5
update vite.config for hotreloading
Vandor1 Mar 3, 2026
5a2b056
add AUTH_JWT_ISSUER, SYNC_BLOBS_APP_URL to radixconfig + cleanup
Vandor1 Mar 3, 2026
29778fa
api code enhancements
Vandor1 Mar 3, 2026
2170902
Make select products component scale with screensize and fit its own …
Vandor1 Mar 3, 2026
38035ca
Move from print to logging
Vandor1 Mar 3, 2026
37d43c4
make vite configs optional, add additional error handling, pr comments..
Vandor1 Mar 3, 2026
54a0da1
fix: fix user auth error
Vandor1 Mar 4, 2026
2151b73
fix: simplify Toast.tsx
sebastianvitterso Mar 3, 2026
550c845
feat: add exception-handling to all api routes
sebastianvitterso Mar 3, 2026
495dc49
refactor: move sharepoint sync code into usecase folder
sebastianvitterso Mar 3, 2026
fb48858
chore: assume bridge value is already an int
sebastianvitterso Mar 3, 2026
3de758c
chore: delete dead code (it can still be found by looking through git…
sebastianvitterso Mar 3, 2026
cfdfd2d
chore: update settings.json to make vscode pytest integration work (m…
sebastianvitterso Mar 3, 2026
613e09c
refactor: use `ValidationException` and `InternalErrorException` wher…
sebastianvitterso Mar 3, 2026
d562c3c
chore: log `InternalErrorException`s too
sebastianvitterso Mar 3, 2026
de0a1ca
chore: remove unused print_progress function
sebastianvitterso Mar 4, 2026
cfff1cc
fix: convert snake_case response keys to camelCase
sebastianvitterso Mar 4, 2026
f856d4f
refactor: don't re-set the entire object unless necessary
sebastianvitterso Mar 4, 2026
4e48006
refactor: use new name for `runOptimizer`
sebastianvitterso Mar 4, 2026
4de3582
chore: delete unused report.css file
sebastianvitterso Mar 4, 2026
5b5ec21
chore: add csp header for frame-ancestors
sebastianvitterso Mar 4, 2026
68e6fb5
feat: adjust appinsights installation in frontend
sebastianvitterso Mar 4, 2026
060b4ff
refactor: use useRef instead of global variable
sebastianvitterso Mar 4, 2026
f966147
chore: remove types for react router (unused)
sebastianvitterso Mar 5, 2026
6eccda5
chore: remove unused code
sebastianvitterso Mar 5, 2026
12f6126
chore: remove `LOAD_TEST_DATA` from config.py
sebastianvitterso Mar 5, 2026
a7b0cce
chore: remove unused and wrong env variable in on-push
sebastianvitterso Mar 5, 2026
8504afa
chore: update github actions + remove prod branch references
awesthouse Mar 5, 2026
d2d2d51
refactor: add varia config and switch to mkdocs
awesthouse Mar 5, 2026
23fcf1b
fix: ignore varia yaml files in check-yaml hook
awesthouse Mar 5, 2026
9007bb9
fix: correct github repo url
awesthouse Mar 6, 2026
f5b2896
fix: documentation errors
awesthouse Mar 6, 2026
c28212f
refactor: move logging-initialization into init_logging
sebastianvitterso Mar 9, 2026
e38c501
feat: Add redis
Vandor1 Mar 5, 2026
9de9c37
feat: Add oauth2-proxy setup, update radix
Vandor1 Mar 5, 2026
d1a83e3
feat: finalize BFF auth configurations
Vandor1 Mar 9, 2026
c22fcae
Add before_request decorator instead of using individual authenticate…
Vandor1 Mar 13, 2026
a2dec33
Change from CRLF to LF
Vandor1 Mar 13, 2026
5124817
chore(deps-dev): bump black in /api in the pip group across 1 directory
dependabot[bot] Mar 12, 2026
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
11 changes: 10 additions & 1 deletion .env-template
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
# Copy from the "S118"-subscription in the Azure Portal. (lcm-dev/lcmdevstorage/Access keys)
TABLE_KEY=
TABLE_KEY=
APPINSIGHTS_CON_STRING=

# Set this when running Vite behind a reverse proxy (e.g. nginx on port 80).
# Tells the browser which port to use for HMR websocket connections.
# HMR_CLIENT_PORT=80

# Enable filesystem polling for Vite HMR.
# Required on Windows (WSL2 mounted filesystems don't emit native file events).
# USE_POLLING=true
72 changes: 0 additions & 72 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions .github/workflows/on-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "On PR updated"
on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

jobs:
tests:
uses: ./.github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
name: Algorithm-Report

name: "Push to master branch"
on:
workflow_dispatch:
push:
branches:
- prod
- master

permissions:
contents: read
actions: write

jobs:
test-report:
tests:
uses: ./.github/workflows/tests.yaml

build-test-report:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: "Create report"
run: docker compose build api && docker compose run -u 0 api python src/tests/optimizer_test.py

- name: Archive results
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: algorithm-report
path: api/test_report.png
path: api/src/test_report.png
21 changes: 13 additions & 8 deletions .github/workflows/on-push.yaml → .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
name: CI

on:
name: "Test"
on:
workflow_dispatch:
workflow_call:
push:
branches:
- master

permissions:
contents: read

jobs:
test-api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: "Build API test image"
run: docker build --tag api-development ./api

- name: "API UnitTests"
run: docker run --rm -e TABEL_KEY="${{ secrets.TABEL_KEY }}" api-development pytest src/tests
run: docker run --rm api-development pytest src/tests

test-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: "Build web"
run: docker build --tag web-development ./web

pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Set up python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.12'
cache: 'pip'
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ api/src/tests/products_data.py
/api/test_report.png
/api/.coverage
/api/src/test_data/interpolate_input.csv
.python-version
.python-version
secrets/
!secrets/.gitkeep
58 changes: 28 additions & 30 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-ast
language_version: python3.12
- id: check-merge-conflict
- id: check-json
- id: check-yaml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
- id: check-merge-conflict
- id: check-json
- id: check-yaml
exclude: (mkdocs\.ya?ml|catalog-info\.yaml)$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.15.4"
hooks:
- id: ruff-format
name: Code formatting
files: ^api/.*\.py$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: 'v0.9.7'
hooks:
- id: ruff-format
name: Code formatting
files: ^api/.*\.py$
- id: ruff
name: Code linting
files: ^api/.*\.py$
args:
- --fix
- --unsafe-fixes

- id: ruff
name: Code linting
files: ^api/.*\.py$
args:
- --fix
- --unsafe-fixes


- repo: https://github.com/biomejs/pre-commit
rev: "v0.6.1"
hooks:
- id: biome-check
name: "Lint: biome (js/ts)"
files: ^web/.*\.(ts|tsx|js|css|html|json)$
additional_dependencies: ["@biomejs/biome@1.9.4"]
args: ["--config-path", "web"]
- repo: https://github.com/biomejs/pre-commit
rev: "v2.4.4"
hooks:
- id: biome-check
name: "Lint: biome (js/ts)"
files: ^web/.*\.(ts|tsx|js|css|html|json)$
additional_dependencies: ["@biomejs/biome@2.4.4"]
args: ["--config-path", "."]
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"python.analysis.autoImportCompletions": true,
"python.analysis.indexing": true,
"python.analysis.logLevel": "Trace",
"python.analysis.typeCheckingMode": "basic",

"python.testing.pytestArgs": ["."],
"python.testing.cwd": "api/src",
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.analysis.extraPaths": ["api/src"]
}
34 changes: 34 additions & 0 deletions IaC/main.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@description('Specifies the location for resources.')
param location string = 'norwayeast'
@allowed(['dev', 'test', 'prod'])
param environment string

@maxValue(730)
param logRetentionDays int


resource logAnalyticsWorkspace 'Microsoft.OperationalInsights/workspaces@2021-12-01-preview' = {
name: 'lcm-${environment}-logWorkspace'
location: location
properties: {
sku: {
name: 'PerGB2018'
}
}
}

resource appInsight 'Microsoft.Insights/components@2020-02-02' = {
name: 'lcm-${environment}-logs'
location: location
kind: 'web'
properties: {
Application_Type: 'web'
Flow_Type: 'Bluefield'
IngestionMode: 'LogAnalytics'
publicNetworkAccessForIngestion: 'Enabled'
publicNetworkAccessForQuery: 'Enabled'
Request_Source: 'rest'
RetentionInDays: logRetentionDays
WorkspaceResourceId: logAnalyticsWorkspace.id
}
}
33 changes: 6 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Lost Circulation Material Optimizer
[![License][license-badge]][license]

![CI](https://github.com/equinor/lcm/workflows/CI/badge.svg)

Expand All @@ -11,40 +12,18 @@ This repository is the result from the merger of the two summer intern projects

![plot](doc/bridge-plot.png)

Deployed environments:
- [Test](https://proxy-lost-circulation-material-test.radix.equinor.com)
- [Production](https://lost-circulation-material.app.radix.equinor.com)

## Requirements

- docker
- docker-compose

## Running

1. Create a copy of `.env-template` called `.env` and populate it with values.
2. Build the containers

```sh
docker compose build
```

3. Start the project

```sh
docker compose up
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

## Operational runbook
<a id="development"></a>
## Development

[RUNBOOK](runbook.md)
See the [docs](https://varia.equinor.com/docs/default/system/lcm) if you want to start developing.

## License

[MIT](LICENSE)
[license-badge]: https://img.shields.io/badge/License-MIT-yellow.svg
[license]: https://github.com/equinor/lcm/blob/master/LICENSE.md
2 changes: 1 addition & 1 deletion api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim
FROM python:3.14-slim

ENV PYTHONUNBUFFERED=1
ENV FLASK_APP=/app/src/app.py
Expand Down
Loading
Loading