Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
Rule Engine Service
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
brooklyn
Rule Engine Service
Commits
cb05bb73
Commit
cb05bb73
authored
Feb 06, 2023
by
Sarah Abrishami
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP
parent
95919d11
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
25 deletions
+45
-25
app/main/views/validate.py
app/main/views/validate.py
+4
-1
app/rulemall/validators.py
app/rulemall/validators.py
+39
-22
make_db.py
make_db.py
+1
-1
requirements.txt
requirements.txt
+1
-1
No files found.
app/main/views/validate.py
View file @
cb05bb73
...
...
@@ -14,9 +14,12 @@ def validate(dsid, rgid):
data
=
read_data
(
dsid
)
print
(
'got data'
)
rg
.
reset_data
(
data
)
data
[
'loan_balance'
]
=
data
[
'loan_balance'
]
.
round
(
0
)
.
astype
(
pd
.
Int64Dtype
())
validation
,
responsible
=
rg
.
validate
()
print
(
'validated'
)
validation
=
pd
.
concat
([
validation
.
rename
(
'validated'
),
responsible
],
axis
=
1
)
# .rename(columns={'customer_id': 'شناسه مشتری', 'loan_id': 'شناسه تسهیلات', 'loan_balance': 'مبلغ تسهیلات'})
index_cols
=
data
[[
'customer_id'
,
'loan_id'
,
'loan_balance'
]]
validation
=
pd
.
concat
([
index_cols
,
validation
,
responsible
],
axis
=
1
)
.
iloc
[:,
1
:
-
1
]
validation
=
validation
.
reset_index
()
.
rename
(
columns
=
{
'index'
:
'rid'
})
# TODO return rule group id
# validation['rgid'] = rgid
...
...
app/rulemall/validators.py
View file @
cb05bb73
...
...
@@ -53,13 +53,15 @@ class Range(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'بازه عددی'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Range'
,
'params'
:
[{
'name'
:
'کمینه'
,
'code'
:
'minimum'
,
'default'
:
'-∞'
,
'type'
:
'number'
,
'tag'
:
'input'
},
'params'
:
[
{
'name'
:
'کمینه'
,
'code'
:
'minimum'
,
'default'
:
'-∞'
,
'type'
:
'number'
,
'tag'
:
'input'
},
{
'name'
:
'بیشینه'
,
'code'
:
'maximum'
,
'default'
:
'∞'
,
'type'
:
'number'
,
'tag'
:
'input'
},
{
'name'
:
'شامل کمینه'
,
'code'
:
'left_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
},
'tag'
:
'select'
,
'options'
:
[{
'text'
:
'بلی'
,
'value'
:
True
},
{
'text'
:
'خیر'
,
'value'
:
False
}]},
{
'name'
:
'شامل بیشینه'
,
'code'
:
'right_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
}
]})
'tag'
:
'select'
,
'options'
:
[{
'text'
:
'بلی'
,
'value'
:
True
},
{
'text'
:
'خیر'
,
'value'
:
False
}]}
]})
class
Logic
(
ValidatorBaseClass
):
...
...
@@ -91,9 +93,16 @@ class Logic(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'عملگرهای منطقی'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Logic'
,
'params'
:
[{
'name'
:
'نوع عملگر'
,
'code'
:
'op_type'
,
'default'
:
''
,
'type'
:
'text'
,
'tag'
:
'select'
},
{
'name'
:
'عبارت مقایسه کننده'
,
'code'
:
'comapare_item'
,
'default'
:
''
,
'type'
:
'text'
,
'tag'
:
'textarea'
}]})
'params'
:
[
{
'name'
:
'نوع عملگر'
,
'code'
:
'op_type'
,
'default'
:
'eq'
,
'type'
:
'text'
,
'tag'
:
'select'
,
'options'
:
[{
'text'
:
'مساوی است با'
,
'value'
:
'eq'
},
{
'text'
:
'نامساوی است با'
,
'value'
:
'neq'
},
{
'text'
:
'کوچکتر است از'
,
'value'
:
'lt'
},
{
'text'
:
'کوچکتر مساوی است با'
,
'value'
:
'le'
},
{
'text'
:
'بزرگتر مساوی است با'
,
'value'
:
'ge'
},
{
'text'
:
'بزرگتر است از'
,
'value'
:
'gt'
}]},
{
'name'
:
'عبارت مقایسه کننده'
,
'code'
:
'value'
,
'default'
:
''
,
'type'
:
'text'
,
'tag'
:
'input'
}]})
class
Length
(
ValidatorBaseClass
):
...
...
@@ -128,10 +137,15 @@ class Length(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'طول بازه'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Length'
,
'params'
:
[{
'name'
:
'کمینه'
,
'code'
:
'min_len'
,
'default'
:
0
,
'type'
:
'number'
,
'tag'
:
'input'
},
'params'
:
[
{
'name'
:
'کمینه'
,
'code'
:
'min_len'
,
'default'
:
0
,
'type'
:
'number'
,
'tag'
:
'input'
},
{
'name'
:
'بیشینه'
,
'code'
:
'max_len'
,
'default'
:
'∞'
,
'type'
:
'number'
,
'tag'
:
'input'
},
{
'name'
:
'شامل کمینه'
,
'code'
:
'left_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
},
{
'name'
:
'شامل بیشینه'
,
'code'
:
'right_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
}
{
'name'
:
'شامل کمینه'
,
'code'
:
'left_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
,
'options'
:
[{
'text'
:
'بلی'
,
'value'
:
True
},
{
'text'
:
'خیر'
,
'value'
:
False
}]},
{
'name'
:
'شامل بیشینه'
,
'code'
:
'right_inclusive'
,
'default'
:
True
,
'type'
:
'bool'
,
'tag'
:
'select'
,
'options'
:
[{
'text'
:
'بلی'
,
'value'
:
True
},
{
'text'
:
'خیر'
,
'value'
:
False
}]}
]})
...
...
@@ -148,7 +162,8 @@ class Category(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'گروهبندی'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Category'
,
'params'
:
[{
'name'
:
'مقادیر'
,
'code'
:
'categories'
,
'default'
:
[],
'type'
:
'list'
,
'tag'
:
'tagbox'
}]})
'params'
:
[{
'name'
:
'مقادیر'
,
'code'
:
'categories'
,
'default'
:
[],
'type'
:
'list'
,
'tag'
:
'tagbox'
}]})
class
Regex
(
ValidatorBaseClass
):
...
...
@@ -163,7 +178,8 @@ class Regex(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'Regex'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Regex'
,
'params'
:
[{
'name'
:
'متن'
,
'code'
:
'regex'
,
'default'
:
''
,
'type'
:
'text'
,
'tag'
:
'textarea'
}]})
'params'
:
[
{
'name'
:
'متن'
,
'code'
:
'regex'
,
'default'
:
''
,
'type'
:
'text'
,
'tag'
:
'textarea'
}]})
class
Missing
(
ValidatorBaseClass
):
...
...
@@ -179,7 +195,8 @@ class Missing(ValidatorBaseClass):
def
__repr__
(
self
):
return
json
.
dumps
({
'name'
:
'گمشده'
,
'desc'
:
'Lorem Ipsom'
,
'example'
:
'Lorem Ipson'
,
'code'
:
'Missing'
,
'params'
:
[{
'name'
:
'مقدار گمشده'
,
'code'
:
'missing'
,
'default'
:
np
.
nan
,
'type'
:
'text'
,
'tag'
:
'input'
}]})
'params'
:
[{
'name'
:
'مقدار گمشده'
,
'code'
:
'missing'
,
'default'
:
np
.
nan
,
'type'
:
'text'
,
'tag'
:
'input'
}]})
class
Unique
:
...
...
make_db.py
View file @
cb05bb73
...
...
@@ -9,6 +9,6 @@ app.config.from_object(configs[config_name])
db
.
init_app
(
app
)
app
.
app_context
()
.
push
()
db
.
drop_all
()
#
db.drop_all()
db
.
create_all
()
print
(
'done'
)
\ No newline at end of file
requirements.txt
View file @
cb05bb73
...
...
@@ -7,10 +7,10 @@ gunicorn==20.1.0
pandas
==1.5.1
psycopg2-binary
==2.9.4
requests
==2.28.1
Rulemall
==0.1
six
==1.16.0
SQLAlchemy
==1.4.42
tzdata
==2022.1
tzlocal
==4.2
urllib3
==1.26.10
zipp
==3.8.0
PyYAML
==6.0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment