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.
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.
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 🔮
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.
- 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.
- A value of True or False is returned for disease diagnosis as JSON to the server. Then the necessary controls are made.
- The received JSON result and disease rate are feedback to the IONIC platform. API (Application Programming Interface) is used for this process.
- 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.
By writing THE REST server codes, communication between the mobile platform and PyCharm, where the image was processed, was provided.
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 🎉
- From Wikipedia, The free encyclopedia, Ionic (mobile app framework), October 2020.
- From Wikipedia, The free encyclopedia, Representational state transfer, September 2020.
- “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.