FaCiPa Series 2

Hello everyone again!

I introduced you to FaCiPa in my previous article. I couldn’t get too close to the details of the server and the web site. In this article, I will tell you about the API and mobile coding areas. Because I use the Python programming language, I preferred to use Flask when it came to the API. This situation is completely personal, you can also use different roofs, such as Django if you want. The decision belongs to you ✨

After the necessary image processing stages, we receive status data as a result of the face palsy detection algorithm running in the background. We take this as True or False in the states Variable. We analyze and test the image from the user. Returning the variable we get here to the mobile application we are really aiming for is one of the most important stages.

This image has an empty alt attribute; its file name is 29128-1-1024x699.jpg

An API (Application Programming Interface) is an interface created so that functions belonging to one application can also be used in another application Dec. An API is a software agent that allows two applications to talk to each other. In other words, it is the messenger who requests your request to your provider and then sends you a response. The API defines application-independent functions that allow applications and definitions to change without compromising each other.

Image for post

MOBILE-BASED APPLICATION WITH IONIC FRAMEWORK

Ionic is a Native framework based on Cordova. What do you think we’re talking about when we say Native app? It is a system that allows application writing on all platforms such as Android, IOS, Windows Mobile and BlackBerry with uniform code thanks to Native frameworks. Ionic was founded in 2013 by Drifty Co. is a complete Open Source SDK for hybrid mobile application development created by Max Lynch, Ben Sperry and Adam Bradley 🔮

One of the reasons IONIC was chosen for this project is that TypeScript codes are very technologically advanced. At the same time, it is very advantageous that the application generated as a result of Html5, Css, JavaScript codes is hybrid. The Ionic projects made are built in a very clean and modular way, so they can be maintained and easy to update. For this reason, the Ionic platform was preferred in the Mobile area of our project.

If the methods are asked to be examined schematically, let’s not forget the following image.

There are 2 separate sections in the project and the Ionic Framework, which will be used for OpenCV operations with Python, where image processing is used, and pouring into the mobile platform is designed.

  1. When the user presses the button in IONIC, a request is sent to Python to receive and process the image with the received Request transaction.
  2. A value of True or False is returned for disease diagnosis as JSON to the server. Then the necessary controls are made.
  3. The received JSON result and disease rate are feedback to the IONIC platform. API (Application Programming Interface) is used for this process.
  4. After the Request and Response operations, the Json data received from OpenCv is parsed.

API Server Communication

Because the type selected for the API we use in our project is client-server communication, the REST (Representative State Transfer) API is selected and the Flask web roof is selected for the service it uses.

Representative State transfer (REST) is a style of software architecture that defines a set of constraints to be used to create web services. Web Services that conform to the architectural style of REST, called RESTful Web services, provide interoperability between computer systems on the Internet. RESTful Web Services allow requesting systems to access and modify textual representations of Web resources using a uniform and predefined set of stateless operations. Other types of Web services, such as SOAP Web Services, expose their own arbitrary sets of operations.

This image has an empty alt attribute; its file name is image-25.png

By writing THE REST server codes, communication between the mobile platform and PyCharm, where the image was processed, was provided.

This image has an empty alt attribute; its file name is image-27.png

One of the important points in the REST architecture is that the process that is required to be performed in each HTTP Request is expressed using HTTP methods. Like POST, PUT ,DELETE, GET. In this way, the need for a Proxy is eliminated and it becomes easier to create platform-independent structures. Although it is not mandatory to use these methods in modern applications, compliance with standards is important for process consistency and security. System communication will be provided in the project using these methods in server coding.

Advantages of REST 🛡

  • Lightweight, easy to extend.
  • Incoming, outgoing data size is very small compared to SOAP.
  • It’s easy to design and easy to implement, it doesn’t need any extra tools.
  • It runs over HTTP, is platform independent.

Now that I have given all the preliminary information necessary for the project, we are fully ready to code it in the next article 🎉

REFERANSLAR

  1. https://medium.com/@__cure/importance-of-documenting-your-api-eb96ec2612f6.
  2. https://www.webimonline.com/api
  3. https://blog.koddit.com/yazilim/api-nedir-ne-ise-yarar-orneklerle-inceleyelim/
  4. From Wikipedia, The free encyclopedia, Ionic (mobile app framework), October 2020.
  5. https://www.newagesmb.com/blog/benefits-native-mobile-app-development.
  6. From Wikipedia, The free encyclopedia, Representational state transfer, September 2020.
  7.  “Web Services Architecture”. World Wide Web Consortium. 11 February 2004. 3.1.3 Relationship to the World Wide Web and REST Architectures. Retrieved 29 September 2016.
  8. https://www.codementor.io/@parths007/writing-unit-tests-for-rest-apis-in-python-ge8wmbofg.
  9. https://denizirgin.com/rest-ve-restful-web-servis-kavramı-30bc4400b9e0?gi=fe5bf1fa3056.

Leave a Reply

Your email address will not be published. Required fields are marked *