Skip to content

Commit 5ccd4ea

Browse files
added roster with provenance endpoint
1 parent a86fc6a commit 5ccd4ea

5 files changed

Lines changed: 26 additions & 19 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0+2026.02.26T13.01.55.674Z.597339a1.berickson.20260220.dami.portfolio.pr
1+
0.1.0+2026.02.27T13.40.48.021Z.a86fc6ac.berickson.20260220.dami.portfolio.pr

learning_observer/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0+2026.02.20T15.13.28.503Z.66de0b91.berickson.20260220.dami.portfolio.pr
1+
0.1.0+2026.02.27T13.40.48.021Z.a86fc6ac.berickson.20260220.dami.portfolio.pr

learning_observer/learning_observer/rosters.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,14 +491,7 @@ async def courseroster_runtime(runtime, course_id):
491491
'''
492492
Wrapper to call courseroster with a runtime object
493493
'''
494-
roster = await courseroster(runtime.get_request(), course_id)
495-
# HACK add in provenance so we can call roster endpoint without needing another
496-
# node in our DAG
497-
for student in roster:
498-
if constants.USER_ID not in student:
499-
continue
500-
student['provenance'] = {'STUDENT': {constants.USER_ID: student[constants.USER_ID]}}
501-
return roster
494+
return await courseroster(runtime.get_request(), course_id)
502495

503496

504497
@learning_observer.communication_protocol.integration.publish_function('learning_observer.courseroster')

modules/writing_observer/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0+2026.02.24T16.36.51.000Z.da3afecc.berickson.20260220.dami.portfolio.pr
1+
0.1.0+2026.02.27T13.40.48.021Z.a86fc6ac.berickson.20260220.dami.portfolio.pr

modules/writing_observer/writing_observer/module.py

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@
1111
# files.
1212
import pmss
1313

14+
import learning_observer.communication_protocol.integration
1415
import learning_observer.communication_protocol.query as q
16+
import learning_observer.constants as constants
1517
import learning_observer.settings
18+
import learning_observer.rosters
1619

1720
from learning_observer import downloads as d
1821

@@ -26,6 +29,16 @@
2629

2730
NAME = "The Writing Observer"
2831

32+
@learning_observer.communication_protocol.integration.publish_function('writing_observer.roster_with_provenance')
33+
async def roster_with_provenance(roster, course_id):
34+
"""Fetch roster entries and add STUDENT provenance for protocol consumers."""
35+
for student in roster:
36+
if constants.USER_ID not in student:
37+
continue
38+
student['provenance'] = {'STUDENT': {constants.USER_ID: student[constants.USER_ID]}}
39+
return roster
40+
41+
2942
# things that process data versus things that interact with the environment
3043
# side-effects or not
3144
# course_id or rosters.course_id to distinguish or provide a default - how to specify selector
@@ -96,6 +109,7 @@
96109
EXECUTION_DAG = {
97110
"execution_dag": {
98111
"roster": course_roster(runtime=q.parameter("runtime"), course_id=q.parameter("course_id", required=True)),
112+
"roster_with_provenance": q.call('writing_observer.roster_with_provenance')(roster=q.variable('roster'), course_id=q.parameter("course_id", required=True)),
99113
# all documents for a student
100114
'student_with_docs': q.select(
101115
q.keys(
@@ -118,16 +132,16 @@
118132
fields={'text': 'text'}
119133
),
120134
'single_student_profile': single_student_from_roster(
121-
roster=q.variable('roster'),
135+
roster=q.variable('roster_with_provenance'),
122136
student_id=q.parameter('student_id', required=True)
123137
),
124138
"docs": q.select(
125139
q.keys(
126-
'writing_observer.reconstruct',
127-
STUDENTS=q.variable("roster"),
128-
STUDENTS_path='user_id',
129-
RESOURCES=q.variable("update_docs"),
130-
RESOURCES_path='doc_id'
140+
'writing_observer.reconstruct',
141+
scope_fields={
142+
"student": {"values": q.variable("roster"), "path": "user_id"},
143+
"doc_id": {"values": q.variable("update_docs"), "path": "doc_id"}
144+
}
131145
),
132146
fields={'text': 'text'}
133147
),
@@ -147,7 +161,7 @@
147161
),
148162
"doc_ids": q.select(q.keys('writing_observer.last_document', STUDENTS=q.variable("roster"), STUDENTS_path='user_id'), fields={'document_id': 'doc_id'}),
149163
'update_docs': update_via_google(runtime=q.parameter("runtime"), doc_ids=q.variable('doc_sources')),
150-
"docs": q.select(q.keys('writing_observer.reconstruct', STUDENTS=q.variable("roster"), STUDENTS_path='user_id', RESOURCES=q.variable("update_docs"), RESOURCES_path='doc_id'), fields={'text': 'text'}),
164+
151165
"docs_combined": q.join(LEFT=q.variable("docs"), RIGHT=q.variable("roster"), LEFT_ON='provenance.provenance.STUDENT.value.user_id', RIGHT_ON='user_id'),
152166
'nlp': process_texts(writing_data=q.variable('docs'), options=q.parameter('nlp_options', required=False, default=[])),
153167
'nlp_sep_proc': q.select(q.keys('writing_observer.nlp_components', STUDENTS=q.variable('roster'), STUDENTS_path='user_id', RESOURCES=q.variable("doc_ids"), RESOURCES_path='doc_id'), fields='All'),
@@ -219,7 +233,7 @@
219233
"output": ""
220234
},
221235
"roster": {
222-
"returns": "roster",
236+
"returns": "roster_with_provenance",
223237
"parameters": ["course_id"],
224238
"output": ""
225239
},

0 commit comments

Comments
 (0)