Skip to main content

Posts

Web App Scaling with Flask Blueprint and Namespaces

A real-world Flask-RESTX-based API  may have multiple namespaces. The best practice for scaling a web application is to use a blueprint along with multiple namespace. The namespace is used to group a set of CRUD operations for a specific resource.  Blueprint can be used to combine (mixing) multiple namespaces. Here’s an example directory structure: project\ ├── app.py # Application file ├── apis #    ├── v20 # API directory    │   ├── __init__.py    │   ├── specs.py # API namespaces and REST methods    │   ├── steps.py # API namespaces and REST methods    └── v20bp.py # API blueprint file Here is an example app.py. Using a blue print allow you to mount your API on any url prefix. from flask import Flask from apis.v20bp import blueprint as api app = ...

Documenting REST API with Flask-Restx

This tutorial aims to use the Flask-restx library to implement and to document the REST API. Other similar libraries in the Flask framework include the   flask_resful and  Flask-restplus libraries.  The generated document is shown below.  All the operations are group into a default namespace. All the CRUD operations get, create, and update (except for the the delete operation) are displayed  below.  References -  https://flask-restx.readthedocs.io/en/latest/ -  https://preslav.me/2018/12/02/designing-well-structured-rest-apis-with-flask-restplus-part-1/ -  https://www.freecodecamp.org/news/structuring-a-flask-restplus-web-service-for-production-builds-c2ec676de563/ -  https://github.com/cosmic-byte/flask-restplus-boilerplate

API implementation in the Python Flask Web Application Framework

Flask is a lightweight web application framework based on Python.  The Flask framework only supply the core components of a web applications and leaves the remaining design and architecture level decisions to the developer. This is my study note on how to extend  how to extend a web application with an application programming interface (or API) .  REST (REpresentational State Transfer) is one of the standard architectural design for web services and web APIs. he following example is based on Flask Mega Tutorial  . There is a section dedicated for implementing API for a web application.  The quick start section of the   flask_resful library provides explanation for the following modules.   Resource reqparse  -  provide simple and uniform access to any variable on the   flask.request  object in Flask fields marshal - Flask      - https://en.wikipedia.org/wiki/Flask_(web_framework) - BluePrint     ...

IBM Watson Annotator for Clinical Data

IBM Watson Annotator for Clinical Data Is Now Generally Available on May 12, 2020  Explore healthcare insights from unstructured data with this new service on IBM Cloud. The practice of medicine is intertwined with patient data that allows doctors and nurses to diagnose illnesses. What symptoms does a patient have, and how does a healthcare worker describe a set of symptoms for others to treat? In today’s globalized world, the treatment can even be carried out by doctors and nurses on the other side of the globe. IBM Watson Annotator for Clinical Data —now generally available on IBM Cloud—delivers natural language processing (NLP) that is tailored for healthcare and life sciences and designed to enable organizations to utilize insights derived from unstructured text.  The medical domain NLP service features a variety of annotators for detecting metadata (such as entities, concepts, concept values, negated spans, hypothetical spans) and a...

Window OS

Here is a list of tools I have used in the Window OS Window Environment Window Command Line Window gflags.exe EmacsW32 TortoiseSVN Microsoft Visual Studio 2008 Incredibuild WinMerge Notepad++ Miktex(Protext) Jabref Bibtex4Word - to use bibTeX in Microsoft Word Cygwin TODO: Opening a huge text file in window Splitting a huge text file into multiple small files Window Environment My Computer > Properties > Advanced > Environment Variables > PATH To maximize a window, use the Alt-Space-x Window-E --> To lunch explorer Window-L --> To lock the screen Window-R --> To open up the run window Window-D --> To minimize all the window Window Command Lines proxycfg --> To find out the proxy server xcopy Tortoise SVN TSVNcache.exe is used by Tortoise SVN to continously check the status of sandboxes. This process requires a lot of resources. To disable the TSVNcache.exe, go to > All Program > Tortoise SVN > Settings > Icon Overlays > Status Cache > None E...

firefox 3.0 full screen mode

In my ubuntu 8.10 system, I don't like the new feature of firefox 3.0 that always starts in a full screen mode. To disable the feature, go to the user's profile folder which is located in ~/.mozilla/firefox/ folder, and find the file "localstore.rdf". Rename the file to something else, such as "localstore_rdf_bak", and it should fix the problem.