{{preSetAssignment.name}}
+
-
+ +
{{rule.custom}}
-
@@ -20,14 +30,8 @@
-
diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index 2cc9d16..91c1204 100644
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -1,21 +1,4 @@
id)->assignments()->with('feature')->get();
+ $assignments = User::find(Auth::user()->id)->assignments()->with('feature')->orderBy('created_at','desc')->get();
$features_all = Feature::all();
$features = new \stdClass();
diff --git a/app/Http/Controllers/DocumentController.php b/app/Http/Controllers/DocumentController.php
index 5f4863e..29fe744 100644
--- a/app/Http/Controllers/DocumentController.php
+++ b/app/Http/Controllers/DocumentController.php
@@ -1,19 +1,4 @@
middleware('auth');
$this->client = new Client($this->graphQLURL);
- $this->stringTokeniser = new StringTokenizer();
+ // $this->stringTokeniser = new StringTokenizer();
+ $this->analyser = new Analyser();
$this->graphQLURL = env('TAP_API', ''). "/graphql";
}
@@ -52,6 +77,7 @@ public function generateFeedback(Request $request) {
$activityLog->status = 'success';
$activityLog->data =[];
$user_id = Auth::user()->id;
+ $result = new \stdClass();
if($request['action'] == 'quick') {
//single sentence change analysis
@@ -62,7 +88,7 @@ public function generateFeedback(Request $request) {
$data = array();
$data['txt'] = $request['txt'];
$data['grammar'] = $request['extra']['grammar'];
- $temp = $this->stringTokeniser->quickTapMoves($data);
+ $temp = $this->analyser->quickTapMoves($data);
$tt['str']= $temp->str ? $temp->str : '';
$tt['raw_tags'] = $temp->raw_tags? $temp->raw_tags : array();
$tt['tags'] = $temp->tags? $temp->tags:'';
@@ -74,13 +100,14 @@ public function generateFeedback(Request $request) {
} */
else if($request['action'] == 'fetch') {
Log::info('moves',['execute time : ' =>'started'.date('d/m/y:H:i:s') ]);
- $tap = $this->stringTokeniser->preProcess($request);
+ $tap = $this->analyser->preProcess($request);
+ $result->tap = $tap;
Log::info('tokeniser',['tokeniser' =>'completed'.date('d/m/y:H:i:s') ]);
}
- $result = new \stdClass();
+
$extra = $request["extra"];
$result->status = array('message' => 'Success', 'code' => 200 );
$result->rules = array();
@@ -221,365 +248,10 @@ protected function getFeedbackSchema($path, $id)
}
-
- protected function background($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $tempo = 0;
-
- foreach($tap as $key => $data) {
- $setFeed = new \stdClass();
- $setFeed->str = $data->str;
- $setFeed->message = array();
- $setFeed->css = array();
- if ($key < $check['paragraph'] && count($data->raw_tags) > 0) {
- if (in_array($check['paragraph'], $data->raw_tags)) {
- $tempo++;
- }
- }
- }
-
- if ($tempo == 0 && $key == $this->para - 1) {
- $setFeed->message['background'] = $rule['message'];
- $setFeed->css[] = 'background';
- $result[] = $setFeed;
- }
-
- return $result;
- }
-
- protected function metrics($tap, $rule) {
- $result = array();
- $check = $rule['check'];
-
- foreach($tap as $key => $data) {
- $tempStore = new \stdClass();
- $tempStore->str = $data->str;
- $tempStore->message = array();
- $tempStore->css = array();
- $returnData = $this->stringTokeniser->metrics($data->str);
- if(isset($returnData->sentWordCounts)) {
- //sentWordCounts is always an array e.g. [5,6] if two sentences sent here we send only one at a time though
- if($returnData->sentWordCounts[0] > $check['sentenceWordCount']) {
- //$tempStore->message = $rule['message'];
- foreach($rule['message'] as $msg) {
- if(isset($msg['metrics'])) {
- $tempStore->message['metrics'] = $msg['metrics'];
- array_push($tempStore->css, 'metrics');
- }
- }
- }
- }
- $result[] = $tempStore;
- }
- return $result;
-
- }
-
-
- /*
- * function works on the complete text at once, so input is not tokenised
- * so str = append all tokenised tap outputs into one
- */
-
- protected function vocab($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $termCount = 0;
- $words = $check['words'];
- $completeText = "";
-
- foreach($tap as $key => $data) {
- $completeText .= $data->str;
- }
- $tempStore = new \stdClass();
- $tempStore->str = $completeText;
- $tempStore->message = array();
- $tempStore->css =array();
-
- $returnData = $this->stringTokeniser->vocab($tempStore->str);
- if(isset($returnData->terms)) {
- $collection = collect($returnData->terms);
-
- foreach($check['words'] as $word) {
- $filtered= $collection->where('term', $word);
- if(count($filtered->all()) == 0) $termCount++;
- }
-
- if($termCount > 0 ) {
- foreach($rule['message'] as $msg) {
- if(isset($msg['metrics'])) {
- $tempStore->message['vocab'] = $msg['vocab'];
- $tempStore->css[] = 'vocab';
- }
- }
- $result[] = $tempStore;
- }
- }
-
- return $result;
- }
-
- /*
- * *** applicable only for reflective feedback
- */
-
- protected function expression($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $termCount = 0;
- $all = $check['all'];
-
-
- if(count($all) == 0) {
- return $result;
- }
-
-
- foreach($tap as $key => $data) {
- $tempStore = new \stdClass();
- $tempStore->str = $data->str;
- $tempStore->message = array();
- $tempStore->affect=array();
- $tempStore->epistemic=array();
- $tempStore->modal=array();
- $tempStore->css = array();
-
- $returnData = $this->stringTokeniser->expression($data->str);
- //$returnData is an array but since we are analysing tokenised strings we can safetly assume array[0]
- $sanitizedResult = $returnData[0];
- //$tempStore->raw = $sanitizedResult;
- foreach($all as $exp) {
-
- if (isset($sanitizedResult->{$exp}) && count($sanitizedResult->{$exp}) > 0) {
- $tempStore->{$exp} = $sanitizedResult->{$exp};
- foreach($rule['message'] as $msg) {
- if(isset($msg[$exp])) {
- $tempStore->message[$exp] = $msg[$exp];
- array_push($tempStore->css, $exp);
- }
- }
- }
- }
-
- $result[] = $tempStore;
- }
-
-
- return $result;
-
- }
-
-
- protected function moves($tap, $rule) {
-
- $result = array();
- $check = $rule['check'];
- $tempo = 0;
- $tags = $check['tags'];
- $messages = $rule['message'];
- if(count($tags) == 0) {
- return $result;
- }
-
- foreach($tap as $key => $data) {
- $setFeed = new \stdClass();
- $setFeed->str = $data->str;
- $setFeed->message = array();
- $setFeed->css = array();
-
- foreach($tags as $tag) {
- if(count(preg_grep("[^".$tag."]", $data->raw_tags)) > 0) {
- foreach($messages as $msg) {
- if(isset($msg[$tag])) {
- $setFeed->message[$tag] = $msg[$tag];
- array_push($setFeed->css,$tag);
- }
- }
- }
- }
- $result[] = $setFeed;
- }
-
- return $result;
- }
-
-
/**
- * -- crafted this to cover sophies CARS rules, all the rules guided by features
- * @param $tap - all tags per specified calls
- * @param $rule - fulled from selected feature
- * @return array - returns missing tags
- * moves1, move2, move3 precedence orders and messages if not followed
+ * applicable only for reflective feedback
*/
- protected function enforced($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $tempo = 0;
- $tags = $check['tags'];
- $messages = $rule['message'];
- if(count($tags) == 0) {
- return $result;
- }
- $monitor = array();
- $issues = array();
-
- if($rule["tabEval"] === 'dynamic') {
-
-
- foreach ($tap as $key => $data) {
- $setFeed = new \stdClass();
- $setFeed->str = $data->str;
- $setFeed->message = array();
- $setFeed->css = array();
- $setFeed->interim = array();
-
- $temp = array();
- foreach ($tags as $it => $case) {
- foreach ($case as $k => $tag) {
- if (count(array_intersect($tag, $data->raw_tags)) > 0) {
- $temp[] = $k;
- }
- }
- }
-
- if (count($temp) > 0) {
- arsort($temp);
- $sorted = array_unique($temp);
- // print_r(current($sorted));
- array_push($monitor, current($sorted));
- }
- }
-
- foreach ($monitor as $key => $d) {
- if (isset($monitor[$key + 1])) {
- $pre = $monitor[$key];
- $next = $monitor[$key + 1];
- $idx = $pre.$next;
- if ($pre > $next) {
- foreach ($messages as $msg) {
- if (isset($msg['problem' . $idx])) array_push($issues, $msg['problem' . $idx]);
- }
- }
- }
- }
-
- // print_r($issues);
-
- //check for missing moves
- $unique_moves = array_unique($monitor);
- //print_r($unique_moves);
- foreach (array(1, 2, 3) as $move) {
- if (!in_array($move, $unique_moves)) {
- foreach ($messages as $msg) {
- if (isset($msg['missing' . $move])) array_push($issues, $msg['missing' . $move]);
- }
- }
- }
-
-
- } else {
- foreach($messages as $key => $msg) {
- array_push($issues, $msg);
- }
- }
-
- array_push($result, $issues);
- //print_r($result);
- return $result;
- }
-
- protected function missingTags($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $tempo = 0;
- $tags = $check['tags'];
- $messages = $rule['message'];
- if(count($tags) == 0) {
- return $result;
- }
- $monitor = array();
- $issues = array();
-
- if($rule["tabEval"] === 'dynamic') {
-
- $temp = array();
- foreach ($tap as $key => $data) {
- $temp = array_merge($temp, $data->raw_tags);
- }
-
- $temp = array();
- $temp_temp =array();
- foreach ($tap as $key => $data) {
- $temp_temp = array_merge($temp_temp, $data->raw_tags);
- }
-
- /***
- * hacky stuff that violates the flow of rules - for Shibani....
- * if contrast and question present don't add error
- * else if neither of them present show error
- * solution replace all contrast tags with question and check for question(nostat)
- * if present don't error else error!!!!
- ***/
-
- foreach($temp_temp as $v) {
- if($v=='contrast') { array_push($temp, 'nostat');}
- else { array_push($temp, $v); }
- }
-
- $monitor = array_unique($temp);
-
- foreach ($tags as $d) {
- if (!in_array($d, $monitor)) {
- foreach ($messages as $msg) {
- if (isset($msg[$d])) array_push($issues, $msg[$d]);
- }
- }
- }
-
-
- } else {
- foreach($messages as $key => $msg) {
- array_push($issues, $msg);
- }
- }
-
- array_push($result, $issues);
- //print_r($result);
- return $result;
- }
-
-
-
-
-
-
-
-
- protected function staticFeed($tap, $rule) {
- $result = array();
- $check = $rule['check'];
- $tempo = 0;
- $tags = $check['tags'];
- $messages = $rule['message'];
-
- $monitor = array();
- $issues = array();
-
- if($rule["tabEval"] === 'dynamic') {
-
- } else {
- foreach($messages as $key => $msg) {
- array_push($issues, $msg['txt']);
- }
- }
- array_push($result, $issues);
- return $result;
- }
-
-
-
protected function formatFeedback($tap, $result) {
$final = array();
@@ -609,8 +281,6 @@ protected function formatFeedback($tap, $result) {
return $final;
-
-
}
diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php
index 645d26d..1e7b45c 100644
--- a/app/Http/Controllers/HomeController.php
+++ b/app/Http/Controllers/HomeController.php
@@ -1,19 +1,4 @@
150]);
+ public function __construct()
+ {
+ $this->checks = new \stdClass();
+ $this->checks->reflective = new \stdClass();
+ $this->checks->analytical = new \stdClass();
+
+ //reflective def's
+ $this->checks->reflective->icons = array(
+ "context",
+ "challenge",
+ "change",
+ "metrics"
+ );
+
+ //affect tag validity criteria
+ $this->checks->reflective->affect_validity = array(
+ "context",
+ "challenge",
+ "change"
+ );
+
+ //inline text replacement tags
+ $this->checks->reflective->inlineTxt = array(
+ "affect" => "affect",
+ "epistemic" => "epistemic",
+ "modal" => "modall"
+ );
+
+ //analytical defs
+ $this->checks->analytical->analytic_xlator = array(
+ "metrics" => "metrics",
+ "emph" => "E",
+ "grow" => "T",
+ "contrast" => "C",
+ "contribution" => "S",
+ "nostat" => "Q",
+ "tempstat" => "B",
+ "novstat"=> "N",
+ "surprise"=>"S",
+ "attitude"=> "P"
+ );
+ $this->checks->analytical->moves_css = array(
+ "moves1",
+ "moves2",
+ "moves3"
+ );
+ }
+
+ public function pdfview ($ref= NULL) {
+ PDF::setOptions(['dpi' => 96, 'defaultFont' => 'arial']);
+
if($ref) {
- $draft = Draft::where('id',$ref)->get();
+ $encoded_data = json_decode($ref);
+ $document_id = $encoded_data->id/123456; //document Id
+ $id = Draft::where('document_id', $document_id)->get()->max('id');
+
+ if(!$id) {
+ return redirect()->back()->with('error', 'This document does not have any feedback associated with it.');
+ }
+
+ $draft = Draft::where('id',$id)->get();
$draft[0]->raw = json_decode($draft[0]->raw_response);
- // dd($draft[0]->raw);
- view()->share('draft', $draft[0]);
- $pdf = PDF::loadView('pdf.view');
+ // dd($draft[0]->raw);
+ $pdfOut = new \stdClass();
+ $pdfOut->raw = $draft[0]->raw;
+ $pdfOut->annotated = $this->getAnnotation($draft[0]->raw, $encoded_data->grammar);
+ $pdfOut->name = $encoded_data->name;
+ $pdfOut->grammar = strtoupper($encoded_data->grammar);
+ $pdfOut->original = $draft[0]->text_input;
+ $pdfOut->created_at = $draft[0]->created_at;
+
+ //dd($pdfOut);
+ view()->share('draft', $pdfOut);
+ if($encoded_data->grammar =='analytical') {
+ $pdf = PDF::loadView('pdf.analytical');
+ }
+ if($encoded_data->grammar =='reflective') {
+ $pdf = PDF::loadView('pdf.reflective');
+ }
return $pdf->download('feedback.pdf');
} else {
return redirect()->back()->with('error','Error generating the Pdf, there are no drafts for this document');
}
}
+
+ private function getAnnotation($feed, $grammar) {
+ $txt ='';
+
+ switch ($grammar) {
+ case 'reflective':
+ $inlineClass="";
+ $inlineText ="";
+
+ foreach($feed->final as $ref) {
+ $inlineText = $this->fabricateInlineText($ref);
+ if (count($ref->css) > 0) {
+ foreach ($ref->css as $style) {
+ if(in_array($style, $this->checks->reflective->icons)) {
+ $txt .= "";
+ }
+ $inlineClass = ($style==="link2me") ? "link2me" : "";
+ }
+ }
+ $txt .= "".$inlineText."";
+ }
+ break;
+ case 'analytical':
+ $spanClass ='';
+ foreach($feed->final as $ann) {
+ $spanClass = $this->fabricateInlineClass($ann);
+ if (count($ann->css) > 0) {
+ foreach ($ann->css as $style) {
+ $legend = isset($this->checks->analytical->analytic_xlator[$style]) ? $this->checks->analytical->analytic_xlator[$style] : '';
+ if (in_array($style, array('contribution'))) $txt .= "".$legend."";
+ elseif (in_array($style, array('background', 'metrics'))) $txt .= "";
+ else $txt .= "".$legend."";
+ }
+ // $txt .= "" . $ann->str . "";
+ }
+ $txt .= "" . $ann->str . "";
+ //dd($txt);
+ }
+ break;
+ }
+ return $txt;
+ }
+
+
+ private function fabricateInlineText($feed) {
+ $html = '';
+
+ if($feed->str != "" && isset($feed->expression)) {
+ $html = $feed->str;
+
+ foreach($this->checks->reflective->inlineTxt as $key => $value) {
+ if($key === 'affect' &&
+ count($feed->expression->{$key}) > 0 &&
+ count(array_intersect($this->checks->reflective->affect_validity, $feed->css)) > 0
+ ) {
+ foreach($feed->expression->{$key} as $word) {
+ $html= str_replace($word->text, "$word->text", $html);
+ }
+ } else {
+ foreach($feed->expression->{$key} as $word) {
+ $html= str_replace($word->text, "$word->text", $html);
+ }
+ }
+ }
+
+ }
+ // dd($html);
+ return $html;
+ }
+
+
+
+ private function fabricateInlineClass($feed) {
+ $name ='';
+ $css = [];
+
+ if(count($feed->css) == 0 ) { return $name; }
+
+ foreach($feed as $key => $value) {
+ //loop to check if moves present in the array
+ if(in_array($key, $this->checks->analytical->moves_css)) {
+ if( count($feed->{$key}->css) > 0) $css[] = $key;
+ }
+ }
+
+ if(in_array('moves3', $css)) {
+ $name = "moves3";
+ } elseif(in_array('moves2', $css)) {
+ $name = "moves2";
+ } elseif(in_array('moves1', $css)) {
+ $name = "moves1";
+ } else {
+ if(count($feed->css) === 1 && in_array('metrics', $feed->css)) return '';
+ elseif(in_array('contribution', $feed->css)) $name = 'ana_bg_green';
+ else $name = 'ana_bg_yellow';
+ }
+
+
+ return $name;
+
+ }
+
+
+
}
diff --git a/app/Http/Controllers/StringTokenizer.php b/app/Http/Controllers/StringTokenizer.php
index f53eeff..2009b01 100644
--- a/app/Http/Controllers/StringTokenizer.php
+++ b/app/Http/Controllers/StringTokenizer.php
@@ -1,27 +1,11 @@
input = strip_tags($text);
$variables->input = $this->cleanText($text);
+ $params = new \StdClass();
$tags = array();
//get athanor rethmoves
- if($grammar == 'analytical') {
- $this->gResponse = $this->client->response($this->queryOneA, $variables);
- } elseif($grammar == 'reflective') {
- $this->gResponse = $this->client->response($this->queryOneR, $variables);
+ if($grammar == 'reflective') {
+ $params->grammar = "reflective";
+ $variables->parameters = json_encode($params);
+ $this->gResponse = $this->client->response($this->queryMoves, $variables);
+ }elseif($grammar == 'analytical') {
+ $params->grammar = "analytic";
+ $variables->parameters = json_encode($params);
+ $this->gResponse = $this->client->response($this->queryMoves, $variables);
+
+ //$this->gResponse = $this->client->response($this->queryOneA, $variables);
}
+
+ //$this->gResponse = $this->client->response($this->queryMoves, $variables);
+
if ($this->gResponse->hasErrors()) {
dd($this->gResponse->errors());
} else {
$raw_tags = $this->gResponse->moves->analytics;
foreach($raw_tags as $tag) {$tags = $tag;}
}
+
return $tags;
}
/*
@@ -374,26 +400,7 @@ public function vocab($string) {
}
return $apiResponse;
}
- /*
- * Used retrive expressions
- * input: string single sentence
- * normally only used for reflective feedback
- * output is an array
- */
- public function expression($string) {
- $apiResponse = new \StdClass();
- $variables = new \stdClass();
- //$variables->input = $this->cleanText($string);
- $variables->input = $this->cleanText($string);
- //get metrics
- $this->gResponse = $this->client->response($this->queryExpressions, $variables);
- if ($this->gResponse->hasErrors()) {
- $apiResponse = $this->gResponse->errors();
- } else {
- $apiResponse = $this->gResponse->expressions->analytics;
- }
- return $apiResponse;
- }
+
//quick sentence by sentence
/*
* Used retrive tags
@@ -429,17 +436,27 @@ public function quickTapMoves($data) {
public function preProcess($data) {
$results = array();
-
$tokenisedText = $this->tapTokeniser($data);
+ $alreadyTapped = isset($data['currentFeedback']['tap'])? $data['currentFeedback']['tap']: array();
+ $loop = count($alreadyTapped) > 0 ? true : false;
+ $key =false;
if(count($tokenisedText) >0 ) {
//now go through each text and analyse
foreach($tokenisedText as $txt) {
- $responseTxt = new \stdClass;
- $responseTxt->str= $txt->original;
+ $responseTxt = new \stdClass;
+ $responseTxt->str= $txt->original;
+ if($loop) {
+ $key = array_search($responseTxt->str, array_column($alreadyTapped, 'str'));
+ }
+ if($key) {
+ $responseTxt->raw_tags = $alreadyTapped[$key]['raw_tags'];
+ $responseTxt->tags= $alreadyTapped[$key]['tags'];
+ } else {
$tags = $this->rethoMoves($txt->original, $data['extra']['grammar']);
$responseTxt->raw_tags = count($tags)>0 ? $tags : array();
$responseTxt->tags= implode(', ',$tags);
- $results[]=$responseTxt;
+ }
+ $results[]=$responseTxt;
}
}
@@ -448,9 +465,6 @@ public function preProcess($data) {
-
-
-
protected function cleanText($string) {
//$pattern = array('/<\/p>/' , '/
/', '/ /');
//$replace = array('\n', '\n', '');
diff --git a/app/Http/Traits/Analytical/Accounts.php b/app/Http/Traits/Analytical/Accounts.php
new file mode 100644
index 0000000..3d2a7ed
--- /dev/null
+++ b/app/Http/Traits/Analytical/Accounts.php
@@ -0,0 +1,230 @@
+ $data) {
+ $setFeed = new \stdClass();
+ $setFeed->str = $data->str;
+ $setFeed->message = array();
+ $setFeed->css = array();
+
+ $temp_tap_raw_tags =array();
+
+
+ $filtered = array();
+ foreach($data->raw_tags as $raw) {
+ if($raw == 'nostat') {
+ array_push($temp_tap_raw_tags, 'contrast');
+ } else {
+ array_push($temp_tap_raw_tags, $raw);
+ }
+ }
+
+ $filtered = array_unique($temp_tap_raw_tags);
+
+ foreach($tags as $tag) {
+
+ if(count(preg_grep("[^".$tag."]", $filtered)) > 0) {
+ foreach($messages as $msg) {
+ if(isset($msg[$tag])) {
+ $setFeed->message[$tag] = $msg[$tag];
+ if(!in_array($tag,$setFeed->css)) {
+ array_push($setFeed->css, $tag);
+ }
+ }
+ }
+ }
+ }
+
+ $result[] = $setFeed;
+ }
+
+ return $result;
+ }
+
+ /**
+ * @param $tap
+ * @param $rule -- used for accounting rules
+ * @return array
+ */
+
+ public function missingSwapTags($tap, $rule) {
+ $result = array();
+ $check = $rule['check'];
+ $tempo = 0;
+ $tags = $check['tags'];
+ $messages = $rule['message'];
+ $conditions = $check['conditions'];
+ if(count($tags) == 0) {
+ return $result;
+ }
+ $monitor = array();
+ $issues = array();
+
+ if($rule["tabEval"] === 'dynamic') {
+
+ $temp = array();
+ $temp_temp =array();
+ foreach ($tap as $key => $data) {
+ $temp_temp = array_merge($temp_temp, $data->raw_tags);
+ }
+
+ //print_r($temp_temp);
+
+ foreach($temp_temp as $raw) {
+ if($raw == 'nostat' || $raw == 'emph') {
+ if ($raw == 'nostat') {
+ array_push($temp, 'contrast');
+ }
+ if ($raw == 'emph') {
+ array_push($temp, 'attitude');
+ }
+ } else {
+ array_push($temp, $raw);
+ }
+ }
+
+ $monitor = array_unique($temp);
+ //print_r($monitor);
+
+ foreach ($tags as $d) {
+ if (!in_array($d, $monitor)) {
+ foreach ($messages as $msg) {
+ if (isset($msg[$d])) array_push($issues, $msg[$d]);
+ }
+ }
+ }
+
+ //check for any conditional positive feedback - true iff all the tags are added
+ if(count($conditions) > 0 && count($issues) == 0) {
+ //will be positive in case of accounts
+ $cond_value= $conditions[0];
+ foreach ($messages as $msg) {
+ if (isset($msg[$cond_value])) array_push($issues, $msg[$cond_value]);
+ }
+ }
+
+ } else {
+ foreach($messages as $key => $msg) {
+ array_push($issues, $msg);
+ }
+ }
+
+ array_push($result, $issues);
+ //print_r($result);
+ return $result;
+ }
+
+ /**
+ * will positive feedback per existing tag
+ * @param $tap
+ * @param $rule -- used for accounting positive feedback
+ * @return array
+ */
+
+ public function positiveFeed($tap, $rule) {
+ $result = array();
+ $check = $rule['check'];
+ $tempo = 0;
+ $tags = $check['tags'];
+ $messages = $rule['message'];
+ $conditions = $check['conditions'];
+ if(count($tags) == 0) {
+ return $result;
+ }
+ $monitor = array();
+ $issues = array();
+
+ if($rule["tabEval"] === 'dynamic') {
+
+ $temp = array();
+ $temp_temp =array();
+ foreach ($tap as $key => $data) {
+ $temp_temp = array_merge($temp_temp, $data->raw_tags);
+ }
+
+ //print_r($temp_temp);
+
+ foreach($temp_temp as $raw) {
+ if($raw == 'nostat' || $raw == 'emph') {
+ if ($raw == 'nostat') {
+ array_push($temp, 'contrast');
+ }
+ if ($raw == 'emph') {
+ array_push($temp, 'attitude');
+ }
+ } else {
+ array_push($temp, $raw);
+ }
+ }
+
+ $monitor = array_unique($temp);
+ //print_r($monitor);
+ $aggregate_tags = array();
+
+ foreach ($tags as $d) {
+ if (in_array($d, $monitor)) {
+ foreach ($messages as $msg) {
+ if (isset($msg[$d])) array_push($aggregate_tags, $msg[$d]);
+ }
+ }
+ }
+ if(count($aggregate_tags) >0) {
+ $issues[] = "
Sample Sentence<\/th> | Essay Assessment Rubric Element<\/th> | AcaWriter Move<\/th><\/tr><\/thead> | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
The concept of good faith has previously been thought<\/strong> to be a work in progress in Australia.<\/td>Engagement with the law and scholarly literature<\/td> | Background<\/td><\/tr> | This article will trace<\/strong> the origins of good faith and its development in the common law. This essay contains three parts. The first part will talk about<\/strong> the origins of good faith.<\/td> | Statement of thesis, Essay plan<\/td> | Summary<\/td><\/tr> | However<\/strong>, where the obligations are found in statute and they conflict with contractual obligations, it is important to note that<\/strong> the former must prevail.<\/td> | Identification of relevant issues, Critical analysis and original insight<\/td> | Contrast,Emphasis<\/td><\/tr><\/tbody><\/table>\"}
+ ],
+ \"css\": [\"msg1\", \"msg2\"],
+ \"custom\" : \"more feedback\",
+ \"tab\" :3,
+ \"tabName\": \"Examples\",
+ \"tabEval\": \"static\"
+ }
+ ]
+}");
+ $feature_a->save();
+ }
+}
diff --git a/database/seeds/FeaturesAnalyticalAccountingUpdate.php b/database/seeds/FeaturesAnalyticalAccountingUpdate.php
new file mode 100644
index 0000000..66d83a3
--- /dev/null
+++ b/database/seeds/FeaturesAnalyticalAccountingUpdate.php
@@ -0,0 +1,156 @@
+rules= json_encode("{
+ \"rules\": [
+ {
+ \"name\": \"amoves\",
+ \"check\": {
+ \"tags\": [
+ \"attitude\",
+ \"emph\",
+ \"contribution\",
+ \"novstat\",
+ \"contrast\",
+ \"tempstat\",
+ \"nostat\"
+ ]
+ },
+ \"message\": [
+ {\"contribution\" : \"S<\/span> Summarises or signals the authors goals\"},
+ {\"attitude\" : \"P<\/span> Perspective or stance\"},
+ {\"novstat\" : \"N<\/span> Novel improvements in ideas\"},
+ {\"emph\" : \"E<\/span>Emphasis of a significant or an important idea \"},
+ {\"contrast\" : \"C Contrasting idea, tension or critical insight\"},
+ {\"tempstat\": \"B Background information and previous work\"}
+ ],
+ \"css\": [\"P\", \"S\", \"N\", \"C\", \"B\"],
+ \"custom\" : \"The analytical report highlights salient rhetorical moves AcaWriter identified in your essay for reflection. For more specific feedback, go to the Feedback tab.<\/span> | Rhetorical Moves<\/h5>\",
+ \"tab\": 1,
+ \"tabName\": \"Analytical Feedback\"
+ },
+ {
+ \"name\": \"alerts\",
+ \"method\": \"staticFeed\",
+ \"check\": {
+ \"tags\": [
+ ],
+ \"conditions\" : [
+ ]
+ },
+ \"message\": [
+ {\"txt\" : \" It looks like you are missing a Summary move that defines the goal or summary of your report and its sections. Try including linguistic cues to make this move clearer in your writing like: This report defines… , the report first examines.. then.., this section explains... Note that you should use past tense in the executive summary section where you explain your results. <\/div>\"},
+ {\"tempstat\": \" It looks like you are missing a Background move in your text, which highlights previous work on the topic. Some linguistic cues that exemplify background are: Previous market analysis demonstrate that…, …is widely recognised as … , It is generally accepted that...Also, make sure that you provide relevant contextual information on the organisation.<\/div>\"},
+ {\"attitude\": \" It looks like you are missing Perspective and Emphasis moves, which highlight your attitude about an idea in text. Try including linguistic cues to make this move clearer in your writing. Examples: The key factor is that…, They highlight the focus on .., …is a critical aspect of….., Academic theory holds that… <\/div>\"},
+ {\"contrast\": \" It looks like you are missing a Contrast move which highlights disagreement, issues, or alternatives. Try including linguistic cues to make this move clearer in your writing like: Although it is the case… , One challenge is..., However, this problem.. <\/div>\"}
+ ],
+ \"css\": [\"mtags\"],
+ \"custom\" : \"Feedback\",
+ \"tab\" :2,
+ \"tabName\": \"Feedback\",
+ \"tabEval\": \"dynamic\"
+ },
+ {
+ \"name\": \"faq\",
+ \"method\": \"staticFeed\",
+ \"check\": {
+ \"tags\": [
+ ],
+ \"conditions\" : [
+ ]
+ },
+ \"message\": [
+ {\"txt\":\"Here are certain rhetorical moves you can look for in your report and example sentences for your reference. Organisational analysis<\/u> Where does your report provide contextual information about the organisation’s objectives, strategy, structure and activities? Defining performance<\/u> Where does your report provide your perspective P<\/span> about how to define performance or success for the organisation? Where does your report provide emphasis E<\/span> to highlight the most important aspects of performance for the organisation? Justification of your definition of performance<\/u> Where does your report provide convincing, persuasive justifications for your definition of performance by proposing novel N<\/span> or critical insights, contrasting ideas or tension C<\/span>? Where does your report justify your definition of performance with reference to prior work or background B<\/span>? Written communication<\/u> Where in your report do you use appropriate summary statements S<\/span> to signal the content, sequence and goals of the report? \"}, + {\"txt\" : \"
|