# A Cloud-Native Web Application for Assisted Metadata Generation and Retrieval: THESPIAN-NER +
## 5 Cloud-Oriented Services for the 4 CH Framework
### Thespian-NER Integration in the 4 CH Cloud  
THESPIAN-NER is a cloud-native web application; as previously described in Section 4, it comprises two services: a front End and a back End.  
The front end, offering users the HTML, CSS, and JavaScript to be interpreted by the browser, is an Angular application [39]. It is containerised by using Docker [40] (and following the Docker best practices ( [[https://docs.docker.com/develop/develop-images/dockerfile_best-practices/](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)]([https://docs.docker.com/develop/develop-images/dockerfile_best-practices/](https://docs.docker.com/develop/develop-images/dockerfile_best-practices/)), accessed on 14 October 2022) and the 4 CH requirements, described in the deliverable D3.1). It is a horizontally scalable service because it only furnishes a copy of the bundled web page content to users' browsers. It communicates to the back end solely through standard HTTP2 protocol communications, always passing through the 4 CH Cloud reverse proxy, which enforces authentication and authorisation.  
The back end is a Django-based [41] representational state transfer (REST) API [42], exposing two endpoints: one for ArcheoNER, and one for hsNER. It is containerised by using Docker. Both endpoints are hidden behind the 4 CH platform NGINX [43] reverse proxy, which enforces an authorisation/authentication mechanism through an INDIGO-IAM OAuth2-based [44] service.  
As visually explained in Figure 4, the NER service can also contact the exposed REST API endpoints of THESPIAN-Mask to fetch the database, again, by passing through the reverse proxy. The full flow of the user experience of the THESPIAN-NER application embedded in the 4 CH cloud, from the technical perspective, is (see Figure 4 for the visual explanation of the numbers reported below).  
1. Users access the reverse proxy which replies with the platform homepage.
2. Registered users can perform the authentication procedure; they are redirected to the INDIGO-IAM service.
3. The INDIGO-IAM service replies to authenticated users with their JSON Web Token (JWT) [45]. Few services may employ the Open Policy Agent (OPA) [46], but THESPIAN-NER does not use it.
4. Authenticated users can now access THESPIAN-NER.
4. First, users reach NER service's front end, which gives the the bundled HTML, CSS, and JS, forming the THESPIAN-NER web page. From THESPIAN-NER web page, users may contact the THESPIAN-NER back-end APIs (4b), the THESPIAN-NER back-end APIs (4c), and the THESPIAN-NER front end to get the web page (4c'), always through the reverse proxy.
4. Users may send the text they want to elaborate, either to ArcheoNER API or hsNER API.
4. Users may cast the (semi)automatically generated query by contacting the appropriate THESPIAN-Mask Back End API.
4. Users may contact the THESPIAN-Mask front-end endpoint, with the generated cookie containing the pre-filling information.
5. Upon success, the contacted API replies back with the appropriate response.
5. The annotated text is sent back to users, together with a summarised text and a list of the labelled nominal entities found.
5. The entries found after the query are returned as a JSON.
5. The prefilled page of the THESPIAN-Mask front-end application is opened.