Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Issues with Symfony2 while parsing the data
Old
LaniSymkowick
Junior Member
 
Status: Offline
Posts: 1
Join Date: Oct 2016
Location: Adelphi, Maryland
Default Issues with Symfony2 while parsing the data - 10-29-2016, 01:22 AM

Symfony2 is used for making REST API. I am using Liip bundle for all type tests, with conjunction to Alice to create all the necessary fixtures. But, I am facing issues, while testing POST type calls with long JSON data stream is include in the POST data. This is making all the functions unreadable with extreme long lengths.
I am thinking about moving this JSON out of my class and creating YAML files for the current data. In order to parse the data, I will use the Symfony parser.

HTML Code:
private function loadYaml($importantasset){
        $inputinfo = Yaml::parse(file_get_contents('src/AppBundle/DataFixtures/YAML/' . $importantasset . '.yml'));
        return $inputinfo;
}
It is working perfectly, as I can easily convert those back to JSON and try to use those in the main call:

PHP Code:
$importantinfo json_encode($this->loadYaml('myapp'));
$this->client->request(
    
'POST'
    
'api location path',
    array(
'important information' => $importantinfo), // Parameters required in the call
    
array(), // My files
    
array(),
    
'body of my data'// Raw data to the function
    
true
); 
Right now, I am looking forward for a simpler method compared to this one. As the job is only to have the data from a stream. Using Faker with this YAML construction is possible or not? I am calling the fixtures, First I will see the function (e.g. <firstname() >. Fixtures will be comprehended with random entities. Using those values with YAML constructions, possible or not?

Solution I have tried:
I have used WebTestCase from Symfony bundle package. It is perfect for testing REST API. Inside the post, data is found inside the body (does not have parameters).

What I am trying to do:
I am a teacher in a local university of Computer Science. Right now, I am assigned a job for making lab assignments for Artificial intelligence class of the 6th semester.
Right now, I am working with an NGO and I am working with data information from it's website to help retired veterans using simple AI algorithms like SVMS and Neural Networks.
Let's say a veteran or active personnel need assistance in a local area and algorithm will assist him to get that. Like, if a person is visiting http://militarybases.co/directory/fo...-in-monroe-wi/. This means that he is interested in Moroe base in Wisconsin state and looking for schools, hospitals, rentals or other type of help in that area.
After having the traffic from the website, it will be feed into alogrithm. Which will turn values in the form of probabilistic outputs. I am making a total of 16 assignments with visual using Alice by implementing this 1 big task.
   
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.