Which repo (e.g., tx-logging)?
pds-cli-cp, pdspi-mapper-parallex-example, tx-parallex
Expected Behavior
Should be able to run the following spec to return multiple rows per patient, one per condition.
from conditionResource import *
for pid in patientIds:
patient = get_patient(patient_id=pid, fhir=data)
conditions = get_conditions(patient_id=pid, fhir=data)
values = []
# xxx this doesn't work:
for condition in conditions:
print(condition.cid)
# xxx ^^^ comment this out and it will run
return {
"values": [
{'id':"PATID",'variableValue': {'value': pid}},
{'id':"CONDITIONID",'variableValue': {'value': 'foo'}}
]
}
ERROR:api.server:Exception on /mapping [POST]
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python3.8/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
response = function(request)
File "/usr/local/lib/python3.8/site-packages/connexion/decorators/uri_parsing.py", line 144, in wrapper
response = function(request)
File "/usr/local/lib/python3.8/site-packages/connexion/decorators/validation.py", line 184, in wrapper
response = function(request)
File "/usr/local/lib/python3.8/site-packages/connexion/decorators/parameter.py", line 121, in wrapper
return function(**kwargs)
File "/usr/src/app/api/__init__.py", line 137, in mappingClinicalFromData
res = start_python(nthreads, py = spec, data = {
File "/usr/local/lib/python3.8/site-packages/tx/parallex/__init__.py", line 46, in start_python
spec = python_to_spec(py)
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 226, in python_to_spec
body_eta = extract_expressions_to_assignments(body_canonical)
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in extract_expressions_to_assignments
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in <genexpr>
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 85, in extract_expressions_to_assignments_in_statement
stmt_eta: ast.stmt = For(target=stmt.target, iter=expr, body=extract_expressions_to_assignments(stmt.body, counter), orelse=stmt.orelse, type_comment=stmt.type_comment)
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in extract_expressions_to_assignments
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in <genexpr>
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 85, in extract_expressions_to_assignments_in_statement
stmt_eta: ast.stmt = For(target=stmt.target, iter=expr, body=extract_expressions_to_assignments(stmt.body, counter), orelse=stmt.orelse, type_comment=stmt.type_comment)
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in extract_expressions_to_assignments
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 65, in <genexpr>
return list(chain(*(extract_expressions_to_assignments_in_statement(stmt, counter + [i]) for i, stmt in enumerate(stmts))))
File "/usr/local/lib/python3.8/site-packages/tx/parallex/python.py", line 103, in extract_expressions_to_assignments_in_statement
raise RuntimeError(f"cannot extract expression from {stmt}")
RuntimeError: cannot extract expression from <_ast.Expr object at 0x7ff5d96c99a0>
Information
If I comment out the 2 lines in the for condition in conditions loop, it runs without error.
I'm assigning to Hao, hoping when he gets back he might be able to provide some insight since this isn't urgent.
Which repo (e.g., tx-logging)? pds-cli-cp, pdspi-mapper-parallex-example, tx-parallex
Expected Behavior Should be able to run the following spec to return multiple rows per patient, one per condition.
Actual Behavior When I run:
I get the folloiwng error from docker container:
Information If I comment out the 2 lines in the
for condition in conditions
loop, it runs without error.I'm assigning to Hao, hoping when he gets back he might be able to provide some insight since this isn't urgent.
Steps to reproduce the behavior