Skip to content

Commit c68c1e4

Browse files
committed
Merge branches 'dev' and 'master' of https://github.com/sassoftware/python-sasctl into dev
# Conflicts: # CHANGELOG.md # src/sasctl/__init__.py
2 parents b3326c3 + 8656a43 commit c68c1e4

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ Unreleased
1414
- Fixed an issue where `model_repository` did not find models, projects, or repositories by name once pagination limits were reached.
1515

1616

17-
v1.1.3 (2019-8-14)
17+
v1.1.4 (2019-8-16)
1818
-----------------
19+
**Bugfixes**
20+
- The `register_model` task now generates dmcas_epscorecode.sas files for ASTORE models.
21+
1922

23+
v1.1.3 (2019-8-14)
24+
-----------------
2025
**Bugfixes**
2126
- Fixed problem causing `register_model` task to include output variables in the input variables list.
2227

src/sasctl/utils/astore.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,26 @@
1919

2020

2121
def create_package_from_astore(table):
22+
"""Create an importable model package from an ASTORE.
23+
24+
Parameters
25+
----------
26+
table : swat.CASTable
27+
The CAS table containing the ASTORE.
28+
29+
Returns
30+
-------
31+
BytesIO
32+
A byte stream representing a ZIP archive which can be imported.
33+
34+
See Also
35+
--------
36+
:meth:`model_repository.import_model_from_zip <.ModelRepository.import_model_from_zip>`
37+
38+
"""
2239
if swat is None:
23-
raise RuntimeError("The 'swat' package is required to work with ASTORE models.")
40+
raise RuntimeError("The 'swat' package is required to work with "
41+
"ASTORE models.")
2442

2543
assert isinstance(table, swat.CASTable)
2644

@@ -41,10 +59,13 @@ def create_package_from_astore(table):
4159
raise RuntimeError(result)
4260

4361
astore_key = result.Key.Key[0].strip()
44-
ds2 = _generate_package_code(result)
62+
ep_ds2 = result.epcode
63+
package_ds2 = _generate_package_code(result)
4564
model_properties = _get_model_properties(result)
46-
input_vars = [get_variable_properties(var) for var in result.InputVariables.itertuples()]
47-
output_vars = [get_variable_properties(var) for var in result.OutputVariables.itertuples()]
65+
input_vars = [get_variable_properties(var)
66+
for var in result.InputVariables.itertuples()]
67+
output_vars = [get_variable_properties(var)
68+
for var in result.OutputVariables.itertuples()]
4869
astore_filename = '_' + uuid.uuid4().hex[:25].upper()
4970

5071
# Copy the ASTORE table to the ModelStore.
@@ -72,7 +93,11 @@ def json_file(data, filename):
7293

7394
filename = os.path.join(folder, 'dmcas_packagescorecode.sas')
7495
with open(filename, 'w') as f:
75-
f.write('\n'.join(ds2))
96+
f.write('\n'.join(package_ds2))
97+
98+
filename = os.path.join(folder, 'dmcas_epscorecode.sas')
99+
with open(filename, 'w') as f:
100+
f.write(ep_ds2)
76101

77102
filename = os.path.join(folder, astore_filename)
78103
with open(filename, 'wb') as f:
@@ -130,12 +155,12 @@ def _get_model_properties(result):
130155
"tool": "",
131156
"toolVersion": "",
132157
"targetVariable": "",
133-
"scoreCodeType": "ds2Package",
158+
"scoreCodeType": "ds2MultiType",
134159
"externalModelId": "",
135160
"function": "",
136161
"eventProbVar": "",
137162
"modeler": "",
138-
"name": "CustomerLifetimeValueScore",
163+
"name": "",
139164
"targetEvent": "",
140165
"targetLevel": "",
141166
"algorithm": ""

0 commit comments

Comments
 (0)