/** * Mechanical turk process * * @param $contract_id * @return bool */ public function mTurkProcess($contract_id) { $contract = $this->contract->findWithPages($contract_id); if ($this->sendToMTurk($contract)) { $this->logger->info('Contract sent to MTurk ', ['Contract_id' => $contract->id]); return true; } return false; }
public function review(Request $request, $contractId) { try { $page = $this->pages->getText($contractId, $request->input('page', '1')); $action = $request->input('action', ''); $canEdit = $action == "edit" ? 'true' : 'false'; $contract = $this->contract->findWithPages($contractId); $pages = $contract->pages; } catch (\Exception $e) { return abort(404); } return view('contract.page.review', compact('contract', 'pages', 'page', 'canEdit', 'canAnnotate')); }
/** * Post pdf text * * @param $id */ public function postText($id) { $contract = $this->contract->findWithPages($id); $pages = ['contract_id' => $contract->id, 'total_pages' => $contract->pages->count(), 'pages' => $contract->pages->toJson(), 'metadata' => $this->getMetadataForES($contract->metadata)]; try { $this->contract->updateWordFile($contract->id); $request = $this->http->post($this->apiURL('contract/pdf-text'), null, $pages); $response = $request->send(); $this->logger->info('Pdf Text successfully submitted to Elastic Search.', $response->json()); } catch (Exception $e) { $this->logger->error($e->getMessage()); } }