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

CM-25: add BenefitPlan to Django ORM #1

Merged
merged 38 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
53c1ace
CM-25: initial module structure
jdolkowski May 17, 2023
830f529
CM-25: add social_protection app config
jdolkowski May 18, 2023
c62cb26
CM-25: create BenefitPlan model
jdolkowski May 18, 2023
8e423c6
CM-25: add gql_mutations
jdolkowski May 18, 2023
11b188f
CM-25: add mising fields to CreateBenefitPlanInputType
jdolkowski May 18, 2023
bcf03de
CM-25: change code length
jdolkowski May 18, 2023
b133294
CM-25: create BenefitPlanGQLType
jdolkowski May 18, 2023
7c74c05
CM-25: add Query and Mutation in schema.py
jdolkowski May 18, 2023
aeeedb7
CM-25: refactor schema.py
jdolkowski May 18, 2023
70cca87
CM-25: add benefit plan validations
jdolkowski May 18, 2023
5f20a6c
CM-25: add services.py
jdolkowski May 18, 2023
0ef3f07
CM-25: create initial test
jdolkowski May 18, 2023
fb72ce9
CM-25: fix typo
jdolkowski May 18, 2023
5a48b3c
CM-25: fix filter_fileds
jdolkowski May 18, 2023
63a9235
CM-25: add missing mutations
jdolkowski May 18, 2023
59ebb59
CM-25 add migrations
jdolkowski May 18, 2023
0c2921a
CM-25: setup tests
jdolkowski May 18, 2023
74262c5
CM-25: update module modules dependencies
jdolkowski May 18, 2023
ea40dae
CM-25 update readme
jdolkowski May 18, 2023
cd1cdd7
CM-25: add benfit plan services
jdolkowski May 18, 2023
33f0283
CM-25: route gql mutations through service
jdolkowski May 18, 2023
8fcf4cc
CM-25: validate uniqueness of code and name
jdolkowski May 18, 2023
76e86c9
CM-25: update readme
jdolkowski May 18, 2023
f7b8b48
CM-25: change get to filter
jdolkowski May 18, 2023
04862c8
CM-25: remove model meta
jdolkowski May 19, 2023
d515128
CM-25: change organization to holder
jdolkowski May 19, 2023
afdb464
CM-25: refactor filters in resolve_benefit_plan
jdolkowski May 19, 2023
aab421b
CM-25: move code and name validation to validation classes
jdolkowski May 19, 2023
f1a1b88
CM-25: create gql query to validate uniqueness of BF name and code
jdolkowski May 19, 2023
ad608fe
CM-25: class refactor
jdolkowski May 19, 2023
3328a8c
CM-25: qgl_mutations refactor
jdolkowski May 19, 2023
7663f15
CM-25: remove date_from and date_to from BenefitPlan
jdolkowski May 19, 2023
d9f23b1
CM-25: add unique name and code test cases
jdolkowski May 19, 2023
9af7372
CM-25: change filed naming convetion to autogenerated in BenefitPlan
jdolkowski May 19, 2023
cb0a3c0
CM-25: validate beneficiary_data_schema
jdolkowski May 22, 2023
9ac4357
CM-25: remove beneficiary_data_schema from filtered fields
jdolkowski May 22, 2023
8522a58
CM-25 update validations
jdolkowski May 22, 2023
9a8b158
CM-25: update translations
jdolkowski May 22, 2023
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
99 changes: 99 additions & 0 deletions .github/workflows/openmis-module-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Automated CI testing
# This workflow run automatically for every commit on github it checks the syntax and launch the tests.
# | grep . | uniq -c filters out empty lines and then groups consecutive lines together with the number of occurrences
on:
pull_request:
workflow_dispatch:
inputs:
comment:
description: Just a simple comment to know the purpose of the manual build
required: false

jobs:
run_test:
runs-on: ubuntu-20.04
services:
mssql:
image: mcr.microsoft.com/mssql/server:2017-latest
env:
ACCEPT_EULA: Y
SA_PASSWORD: GitHub999
ports:
- 1433:1433
# needed because the mssql container does not provide a health check
options: --health-interval=10s --health-timeout=3s --health-start-period=10s --health-retries=10 --health-cmd="/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -Q 'SELECT 1' || exit 1"

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: install linux packages
run: |
git clone --depth 1 --branch develop https://github.com/openimis/database_ms_sqlserver.git ./sql
cd sql/ && bash concatenate_files.sh && cd ..
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools build-essential dialog apt-utils unixodbc-dev -y
python -m pip install --upgrade pip
- name: pull openimis backend
run: |
rm ./openimis -rf
git clone --depth 1 --branch develop https://github.com/openimis/openimis-be_py.git ./openimis
- name: copy current branch
uses: actions/checkout@v2
with:
path: './current-module'
- name: Update the configuration
working-directory: ./openimis
run: |
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
echo "the local module called $MODULE_NAME will be injected in openIMIS .json"
jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json
echo $(jq --arg name "$MODULE_NAME" 'if [.modules[].name == ($name)]| max then (.modules[] | select(.name == ($name)) | .pip)|="../current-module" else .modules |= .+ [{name:($name), pip:"../current-module"}] end' openimis.json) > openimis.json
- name: Install openIMIS Python dependencies
working-directory: ./openimis
run: |
pip install -r requirements.txt
python modules-requirements.py openimis.json > modules-requirements.txt
cat modules-requirements.txt
pip install -r modules-requirements.txt
- name: Environment info
working-directory: ./openimis
run: |
pip list
- name: Initialize DB
run: |
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'DROP DATABASE IF EXISTS imis'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -Q 'CREATE DATABASE imis'
/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P $SA_PASSWORD -d imis -i sql/output/fullDemoDatabase.sql | grep . | uniq -c
env:
SA_PASSWORD: GitHub999
ACCEPT_EULA: Y

# - name: Check formatting with black
# run: |
# black --check .

- name: Django tests
working-directory: ./openimis/openIMIS
run: |
export MODULE_NAME="$(echo $GITHUB_REPOSITORY | sed 's#^openimis/openimis-be-\(.*\)_py$#\1#')"
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
DEBUG: true
#DJANGO_SETTINGS_MODULE: hat.settings
DB_HOST: localhost
DB_PORT: 1433
DB_NAME: imis
DB_USER: sa
DB_PASSWORD: GitHub999
#DEV_SERVER: true
SITE_ROOT: api
REMOTE_USER_AUTHENTICATION: True
38 changes: 38 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-20.04

steps:
- uses: olegtarasov/get-tag@v2.1
id: tagName
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine jq

- name: update setup.py
run: |
echo "tag to use $GIT_TAG_NAME"
sed -i "s/version='.*'/version='$GIT_TAG_NAME'/g" setup.py
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
**/venv
**/.env
**/.idea
**/__pycache__
build
dist
*.egg-info
**/.vscode
**/*.mo
locale/__init__.py
Loading