|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +--- |
| 4 | + |
| 5 | +# External STI Approach |
| 6 | + |
| 7 | +MantisTable UI can interacts with an API to integrate an external STI approach. This document describes the API endpoints, their methods, and how to configure MantisTable UI to use these endpoints. |
| 8 | + |
| 9 | +:::warning |
| 10 | +In order to use your own STI approach you need to implement an API by following the instructions on this page. |
| 11 | +::: |
| 12 | + |
| 13 | +## API Endpoints |
| 14 | + |
| 15 | +The API must consists of two main endpoints: |
| 16 | + |
| 17 | +1. **Semantic Table Interpretation**: This endpoint processes a given table and performs semantic interpretation. |
| 18 | +2. **Get Table Annotations**: This endpoint returns the table along with its annotations. |
| 19 | + |
| 20 | +## Configuration |
| 21 | + |
| 22 | +The URL of the API endpoint and the names of the methods are configurable through the MantisTable UI configuration file (`.env`). The relevant configuration parameters are: |
| 23 | + |
| 24 | +- `API_BASE_URL`: the base URL of the API. |
| 25 | +- `SEMANTIC_INTERPRETATION_METHOD`: the method name for performing semantic table interpretation. |
| 26 | +- `GET_ANNOTATIONS_METHOD`: the method name for retrieving table annotations. |
| 27 | + |
| 28 | +### Example Configuration |
| 29 | + |
| 30 | +```js |
| 31 | +API_BASE_URL="http://api.mantistable.com" |
| 32 | +SEMANTIC_INTERPRETATION_METHOD="/semantic-interpretation" |
| 33 | +GET_ANNOTATIONS_METHOD="/get-annotations" |
| 34 | +``` |
| 35 | + |
| 36 | +:::warning |
| 37 | +To modify the configuration file, refer to the page [Configuration](/docs/getting-started/configuration.md) page. |
| 38 | +::: |
| 39 | + |
| 40 | +## Endpoints |
| 41 | + |
| 42 | +### 1. Perform Semantic Table Interpretation |
| 43 | + |
| 44 | +**HTTP Method:** `POST` |
| 45 | + |
| 46 | +**Description:** This endpoint must accpets a table in JSON format and performs semantic interpretation on it. |
| 47 | + |
| 48 | +**Request Headers:** |
| 49 | + |
| 50 | +- `Content-Type: application/json` |
| 51 | + |
| 52 | +**Request Body:** |
| 53 | + |
| 54 | +```js |
| 55 | +{ |
| 56 | + "table": [ |
| 57 | + ["Column1", "Column2", "Column3"], |
| 58 | + ["Value1", "Value2", "Value3"], |
| 59 | + ... |
| 60 | + ] |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +**Response:** |
| 65 | + |
| 66 | +```js |
| 67 | +{ |
| 68 | + "status": "success", |
| 69 | + "message": "Table interpreted successfully", |
| 70 | + "data": { |
| 71 | + "table_id": "unique_table_identifier" |
| 72 | + } |
| 73 | +} |
| 74 | +``` |
| 75 | + |
| 76 | +**Example Request:** |
| 77 | + |
| 78 | +```sh |
| 79 | +curl -X POST http://api.mantistable.com/semantic-interpretation \ |
| 80 | +-H "Content-Type: application/json" \ |
| 81 | +-d '{ |
| 82 | + "table": [ |
| 83 | + ["Name", "Age", "Occupation"], |
| 84 | + ["John Doe", "29", "Engineer"], |
| 85 | + ["Jane Smith", "34", "Artist"] |
| 86 | + ] |
| 87 | +}' |
| 88 | +``` |
| 89 | + |
| 90 | +**Example Response:** |
| 91 | + |
| 92 | +```js |
| 93 | +{ |
| 94 | + "status": "success", |
| 95 | + "message": "Table interpreted successfully", |
| 96 | + "data": { |
| 97 | + "table_id": "1234567890abcdef" |
| 98 | + } |
| 99 | +} |
| 100 | +``` |
| 101 | + |
| 102 | +### 2. Get Table Annotations |
| 103 | + |
| 104 | +**HTTP Method:** `GET` |
| 105 | + |
| 106 | +**Description:** This endpoint must returns the table along with its semantic annotations. |
| 107 | + |
| 108 | +**Request Headers:** |
| 109 | + |
| 110 | +- `Content-Type: application/json` |
| 111 | + |
| 112 | +**Request Parameters:** |
| 113 | + |
| 114 | +- `table_id`: The unique identifier of the table. |
| 115 | + |
| 116 | +**Response:** |
| 117 | + |
| 118 | +```js |
| 119 | +{ |
| 120 | + "status": "success", |
| 121 | + "data": { |
| 122 | + "table": [ |
| 123 | + ["Column1", "Column2", "Column3"], |
| 124 | + ["Value1", "Value2", "Value3"], |
| 125 | + ... |
| 126 | + ], |
| 127 | + "annotations": [ |
| 128 | + {"column": "Column1", "type": "Name", "confidence": 0.95}, |
| 129 | + {"column": "Column2", "type": "Age", "confidence": 0.98}, |
| 130 | + ... |
| 131 | + ] |
| 132 | + } |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +**Example Request:** |
| 137 | + |
| 138 | +```sh |
| 139 | +curl -X GET "http://api.mantistable.com/get-annotations?table_id=1234567890abcdef" \ |
| 140 | +-H "Content-Type: application/json" |
| 141 | +``` |
| 142 | + |
| 143 | +**Example Response:** |
| 144 | + |
| 145 | +```js |
| 146 | +{ |
| 147 | + "status": "success", |
| 148 | + "data": { |
| 149 | + "table": [ |
| 150 | + ["Name", "Age", "Occupation"], |
| 151 | + ["John Doe", "29", "Engineer"], |
| 152 | + ["Jane Smith", "34", "Artist"] |
| 153 | + ], |
| 154 | + "annotations": [ |
| 155 | + {"column": "Name", "type": "Person Name", "confidence": 0.95}, |
| 156 | + {"column": "Age", "type": "Age", "confidence": 0.98}, |
| 157 | + {"column": "Occupation", "type": "Job Title", "confidence": 0.92} |
| 158 | + ] |
| 159 | + } |
| 160 | +} |
| 161 | +``` |
| 162 | + |
| 163 | +## Conclusion |
| 164 | + |
| 165 | +The API provides essential functionalities for semantic table interpretation and retrieval of annotations, which are crucial for the MantisTable UI. Proper configuration of the API endpoints ensures seamless interaction between the MantisTable UI and the external API. |
0 commit comments