pearmut 1.0.2__py3-none-any.whl → 1.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pearmut/app.py CHANGED
@@ -49,7 +49,7 @@ for campaign_id in progress_data.keys():
49
49
  class LogResponseRequest(BaseModel):
50
50
  campaign_id: str
51
51
  user_id: str
52
- item_i: int
52
+ item_i: int | str
53
53
  payload: dict[str, Any]
54
54
 
55
55
 
@@ -124,7 +124,7 @@ async def _get_next_item(request: NextItemRequest):
124
124
  class GetItemRequest(BaseModel):
125
125
  campaign_id: str
126
126
  user_id: str
127
- item_i: int
127
+ item_i: int | str
128
128
 
129
129
 
130
130
  @app.post("/get-i-item")
@@ -179,7 +179,11 @@ async def _dashboard_data(request: DashboardDataRequest):
179
179
  ]
180
180
 
181
181
  # Add threshold pass/fail status (only when user is complete)
182
- if all(entry["progress"]):
182
+ if (
183
+ tasks_data[campaign_id]["info"]["assignment"] != "dynamic" and all(v in {"completed", "completed_foreign"} for v in entry["progress"])
184
+ ) or (
185
+ tasks_data[campaign_id]["info"]["assignment"] == "dynamic" and all(v in {"completed", "completed_foreign"} for mv in entry["progress"] for v in mv.values())
186
+ ):
183
187
  entry["threshold_passed"] = check_validation_threshold(
184
188
  tasks_data, progress_data, campaign_id, user_id
185
189
  )
@@ -376,7 +380,6 @@ async def _download_annotations(
376
380
  # NOTE: currently not checking tokens for progress download as it is non-destructive
377
381
  # token: list[str] = Query()
378
382
  ):
379
-
380
383
  output = {}
381
384
  for campaign_id in campaign_id:
382
385
  output_path = f"{ROOT}/data/outputs/{campaign_id}.jsonl"
@@ -403,7 +406,6 @@ async def _download_annotations(
403
406
  async def _download_progress(
404
407
  campaign_id: list[str] = Query(), token: list[str] = Query()
405
408
  ):
406
-
407
409
  if len(campaign_id) != len(token):
408
410
  return JSONResponse(
409
411
  content="Mismatched campaign_id and token count", status_code=400
@@ -435,6 +437,7 @@ if not os.path.exists(static_dir + "index.html"):
435
437
  "Static directory not found. Please build the frontend first."
436
438
  )
437
439
 
440
+
438
441
  # Serve HTML files directly without redirect
439
442
  @app.get("/annotate")
440
443
  async def serve_annotate():