Functionalities Provide screen to login to APP via SSO (login implementation will be done later) Connect to REST API via client ID and secret and get token which expires after 1h GET request to several endpoints return JSON Filter data based on criteria
Config file There should be an external ini config file with the following data oauthURL : url to get token [string] (for instance https://www.server.com/folder/subfolder/oauth/token ) apiURL : url to the base path of the API [string] (for instance https://www.server.com/folder/subfolder/api ) clientID : client ID to get the token [string] clientSecret : client secret to get the token [string] analyticName : value of constant “name” field to filter /analytic/ [string] orgCode : value of constant “code” field to filter /organization/ [string] stressPattern : '^.*[^0-9.,]([0-9.,]+)[ \t]*([ kMG ]?[Pp][ Aa ]).*$' [string] stressReplace : ' \1 \2' [string] temperaturePattern : ' ^.*[^0-9.,]([0-9.,]+)[ \t' char(176) ']*([Cc ]).*$ ' [string] temperature Replace : ' \1 \2' [string]
Token The URL to get the token is ${ oauthURL } The grant type is “ client_credentials ” with ${ clientID } for the client ID and ${ clientSecret } for the client secret It should be a POST request T he “Authorization” header should be set to the concatenation of “Basic ” and the base64 encoded “${ clientID }:${ clientSecret }” string The response will be a 200 response with the following JOSN data {" access_token ": <token value>," expires_in ":<duration in seconds>}
GET requests The url will be as follows for the / example / endpoint : ${ apiURL }/example/ The responses are as follows: {"items":[ ... ],"hasMore": true,"limit ": 500 ,"offset":0,"count":200} Adding limit and offset to the request allows to retrieve more items by looping {"limit":25,"offset":0} The response can take a few seconds to arrive.
Endpoints and data (1/2) The full URL for the /example/ endpoint is the concatenation of ${ apiURL } and the endpoint for instance: ${ apiURL }/example/ /user/: Filter single item based on the connected user for the “ user_name ” field /analytic/: Filter single item based on ${ analyticName } for the “name” field /organization/: Filter single item based on ${ orgCode } for the “code” field
Endpoints and data (2/2 ) / sample_analytic /: Filter variable number of items based on “ status_id ” field against values 5 and 8 “ collected_by_user_id ” field against the “id” field of the filtered /user/ item “ analytic_id ” field against the “id” field of the filtered /analytic/ item / sample/: Filter variable number of items based on “id” field against the “ sample_id ” field of the filtered / sample_analytic / items / request/: Filter variable number of items based on “ status_id ” field against values 5 and 8 “ u_recipient_department_id ” field against the “ parent_organization_id ” field of the filtered /organization/ items ( u_recipient_department_id can be empty) “id” field against the “ request_id ” field of the filtered /sample/ items
General view of the app Requests Samples Selected samples Request Manager - v1.0.0 File Database All requests >>>> Selected requests >>> All samples >> Selected samples > Remove all Remove selected
Menus File Export: generates XLSX file Exit: closes the software Database Connect: presents a window to connect to SSO, on successful connect connect to API to get token, then loads and filters data from /user/, /analytic/, and /organization/ endpoints and then shows a YES/NO dialog to perform refresh. On failed connection, presents messagebox with meaningful messages. Refresh: force reload and filter of data from / sample_analytic /, /sample /, and /request/ endpoints and display progress bar. On failed refresh, presents messagebox with meaningful messages . It should remove the samples in the “Selected samples” if associated request and/or sample has been removed from the database. Disconnect: empties data loaded from endpoints, clears the Requests and Samples tables and removes token from memory . The Selected samples table should not be cleared.
Requests table Columns code: “code” field from filtered /request/ data [string] (not editable) stress: regex “description” field from filtered /request/ data with ${ stressPattern } and ${ stressReplace }. Should be empty if regex doesn’t match [string] (editable) temperature: regex “description” field from filtered /request/ data with ${ temperaturePattern } and ${ temperatureReplace }. Should be empty if regex doesn’t match [string] (editable) description: “description” field from filtered /request/ data [string] (not editable) it should be scrollable as it might contain new line characters The user can select zero, one or more lines Data is coming from the filtered /request/ data
Samples table Columns name: “name” field from filtered /sample/ data [string] (not editable) nature: “nature” field from filtered /sample/ data [string] (not editable) stress: regex “description” field from filtered /sample/ data with ${ stressPattern } and ${ stressReplace }. Should be empty if regex doesn’t match [string] (editable) temperature: regex “description” field from filtered /sample/ data with ${ temperaturePattern } and ${ temperatureReplace }. Should be empty if regex doesn’t match [string] (editable) description: “description” field from filtered /sample/ data. It should be scrollable as it might contain new line characters [string] (not editable) The user can select zero, one or more lines Data is coming from the filtered /sample/ data based on the “ request_id ” field against the last selected line in the Requests table
Selected samples table Columns code: request “code” [string] (not editable) name: sample “name” [string] (not editable) nature: sample “nature” [string] (not editable) stress: stress value for the corresponding sample from the Samples table if not empty otherwise for the corresponding request from the Requests table [string] (editable) temperature: temperature value for the corresponding sample from the Samples table if not empty otherwise for the corresponding request from the Requests table [string] (editable) The user can select zero, one or more lines Data is modified when user clicks on buttons There can’t be duplicated lines Data must be sorted first by code, then by temperature, then by stress and finally by name
Buttons All requests >>>> Add to the Selected samples table all samples associated to all the listed requests in the Requests table Selected requests >>> Add to the Selected samples table all samples associated to the listed requests that are selected in the Requests table All samples >> Add to the Selected samples table all listed samples in the Samples table Selected samples > Add to the Selected samples table all selected samples in the Samples table
XLSX file export One file per request and per temperature One file can contain several samples with different stresses The user should be asked in which directory they would like to save the file(s ). It should use the provided template file Duplicate the template Rename the duplicated sheet to the Temperature value (for instance 23C) F ill the data column wise If there are more than 10 samples, the first duplicated sheet should have the string “_ 1” appended to its name and a new duplicated sheet of the “template” sheet must be created and named with the temperature and “_2”. And so on for every 10 samples. Finally hide the template sheet and save the file in the chosen folder
Token monitoring When arriving at 5 minutes before expiry, a Yes/No modal dialog should be presented to the user which asks “Do you want to remain connected ?” If the user clicks Yes, get a new token and reset countdown for token monitoring If the user clicks No, run the Database/Disconnect callback and stop the token monitoring If the user does not choose an answer, on the expiration of the token run the Database/Disconnect callback and close the dialog