Skip to content

Commit

Permalink
Merge branch 'develop' into snyk-fix-74487949e90f11297b2b5eb310347564
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip committed Feb 9, 2024
2 parents 5e4b16d + 560ce58 commit 487dd8e
Show file tree
Hide file tree
Showing 13 changed files with 349 additions and 66 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
**/.vscode
**/.idea
**/venv
**/.env
Expand All @@ -15,3 +14,5 @@ openIMIS/locale/en/LC_MESSAGES/django.mo
**/staticfiles
extracted_translations_fe
script/config.py
**/src/*

176 changes: 176 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"inputs": [
{
"id": "moduleName",
"type": "pickString",
"description": "provide module name to test",
"options" : ["core","individual",
"workflow","tasks_management",
"report","location","medical","controls",
"medical_pricelist","product",
"insuree","policy","contribution","payer"
,"payment","claim","claim_batch","tools","api_fhir_r4",
"calculation","contribution_plan","policyholder","contract","invoice","calcrule_contribution_legacy","calcrule_third_party_payment","calcrule_capitation_payment","calcrule_commission","calcrule_contribution_income_percentage","calcrule_fees","calcrule_unconditional_cash_payment","im_export","dhis2_etl","social_protection","opensearch_reports","payment_cycle","calcrule_social_protection","payroll"
]
},
{
"id": "dbEngine",
"type": "pickString",
"description": "provide DB engine to use",
"options" : ["MSSQL", "PSQL"]
}

],
"configurations": [

{
"name": "pushpastMonth",
"type": "python",
"request": "launch",
"program": "./manage.py",
"args": [
"pushadx","2023-03-01","pushLastMonth","--verbose"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "PSQL"
},
"purpose":["debug-in-terminal"],
"justMyCode": true
},

{
"name": "orgunit",
"type": "python",
"request": "launch",
"program": "./manage.py",
"args": [
"pushmetadata","2010-06-01","orgunit","--verbose"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "PSQL"
},
"purpose":["debug-in-terminal"],
"justMyCode": true
},
{
"name": "pushMetadata",
"type": "python",
"request": "launch",
"program": "./manage.py",
"args": [
"pushadx","2023-06-01","pushMetadata","--verbose"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "PSQL"
},
"purpose":["debug-in-terminal"],
"justMyCode": true
},
{
"name": "gen trad be",
"type": "python",
"request": "launch",
"program": "./manage.py",
"args": [
"extract_translations"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "PSQL"
},
"purpose":["debug-in-terminal"],
"justMyCode": true
},

{
"name": "migrate",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/openIMIS/manage.py",
"args": [
"migrate"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "${input:dbEngine}"
},
"justMyCode": true
},
{
"name": "Start",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/openIMIS/manage.py",
"args": [
"start"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "${input:dbEngine}"
},
"justMyCode": true
},
{
"name": "Test",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/openIMIS/manage.py",
"args": [
"test",
"--keepdb",
"--timing",
"core","individual","controls",
"workflow","tasks_management",
"report","location","medical",
"medical_pricelist","product",
"insuree","policy","contribution","payer"
,"payment","claim","claim_batch","tools","api_fhir_r4",
"calculation","contribution_plan","policyholder","contract",
"invoice","calcrule_contribution_legacy","calcrule_third_party_payment",
"calcrule_capitation_payment","calcrule_commission",
"calcrule_contribution_income_percentage","calcrule_fees",
"calcrule_unconditional_cash_payment","im_export",
"dhis2_etl","social_protection","opensearch_reports",
"payment_cycle","calcrule_social_protection","payroll"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "${input:dbEngine}"
},
"justMyCode": true
},
{
"name": "Test module",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/openIMIS/manage.py",
"args": [
"test",
"--keepdb",
"--debug-mode", "--timing",
"${input:moduleName}"
],
"django": true,
"cwd": "${workspaceRoot}/openIMIS",
"env": {
"DB_DEFAULT": "${input:dbEngine}"
},
"justMyCode": true
}

]
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ At this stage, you may (depends on the database you connect to) need to:

### To run unit tests on a module (example openimis-be-claim)
* from `openimis-be_py`
* (re)initialize test database (at this stage structure is not managed by django): `python init_test_db.py`
* (re)initialize test database (at this stage structure is not managed by django):
* launch unit tests, with the 'keep database' option: `python
manage.py test --keep claim`

Expand Down
34 changes: 28 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ services:
container_name: ${PROJECT_NAME:-openimis}-db
image: ghcr.io/openimis/openimis-pgsql:${DB_TAG:-develop}
environment:
- POSTGRES_PASSWORD=IMISuser@1234
- POSTGRES_DB=test_imis
- POSTGRES_USER=IMISuser
- POSTGRES_PASSWORD=$PSQL_DB_PASSWORD
- POSTGRES_DB=$PSQL_DB_NAME
- POSTGRES_USER=$PSQL_DB_USER
healthcheck:
test: ['CMD', 'pg_isready', '-U', "$DB_USER", '-d', "test_imis"]
test: ['CMD', 'pg_isready', '-U', "$PSQL_DB_USER", '-d', "test_imis"]
interval: 10s
timeout: 5s
retries: 5
Expand All @@ -19,6 +19,28 @@ services:
restart: always
ports:
- 5432:5432

db-mssql:
container_name: ${PROJECT_NAME:-openimis}-mssql
image: ghcr.io/openimis/openimis-mssql:${DB_TAG:-latest}
restart: always
environment:
- DB_PASSWORD=$MSSQL_DB_PASSWORD
- SA_PASSWORD=$MSSQL_DB_PASSWORD
- DB_NAME=$MSSQL_DB_NAME
- DB_USER=$MSSQL_DB_USER
- ACCEPT_EULA=Y
- INIT_MODE=demo
healthcheck:
test: "bash /app/healthcheck.sh"
interval: 10s
timeout: 5s
retries: 5
start_period: 100s
volumes:
- database-mssql:/var/opt/mssql/data
ports:
- 1433:1433
volumes:
database:
database:
database-mssql:

12 changes: 6 additions & 6 deletions openIMIS/developer_tools/skeletons/calculation_rule.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ class {{class_name}}(AbsCalculationRule):
type = "type"
sub_type = "sub_type"

##signal_get_rule_name = Signal(providing_args=[])
##signal_get_rule_details = Signal(providing_args=[])
##signal_get_param = Signal(providing_args=[])
##signal_get_linked_class = Signal(providing_args=[])
##signal_calculate_event = Signal(providing_args=[])
##signal_convert_from_to = Signal(providing_args=[])
##signal_get_rule_name = Signal([])
##signal_get_rule_details = Signal([])
##signal_get_param = Signal([])
##signal_get_linked_class = Signal([])
##signal_calculate_event = Signal([])
##signal_convert_from_to = Signal([])

@classmethod
def ready(cls):
Expand Down
1 change: 0 additions & 1 deletion openIMIS/developer_tools/skeletons/openmis-module-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ jobs:
python -V
ls -l
python manage.py migrate
python init_test_db.py | grep . | uniq -c
python manage.py test --keepdb $MODULE_NAME
env:
SECRET_KEY: secret
Expand Down
2 changes: 1 addition & 1 deletion openIMIS/openIMIS/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def SITE_ROOT():


def load_openimis_conf():
conf_file_path = "../openimis.json"
conf_file_path = os.environ.get("OPENIMIS_CONF", "../openimis.json")
with open(conf_file_path) as conf_file:
return json.load(conf_file)

Expand Down
Loading

0 comments on commit 487dd8e

Please sign in to comment.