Initial commit
This commit is contained in:
53
omop/frontend/src/api/client.js
Normal file
53
omop/frontend/src/api/client.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8001/api'
|
||||
|
||||
const client = axios.create({
|
||||
baseURL: API_BASE_URL,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
|
||||
export const api = {
|
||||
// ETL endpoints
|
||||
etl: {
|
||||
run: (data) => client.post('/etl/run', data),
|
||||
getJob: (jobId) => client.get(`/etl/jobs/${jobId}`),
|
||||
listJobs: () => client.get('/etl/jobs'),
|
||||
extract: (sourceTable, batchSize) =>
|
||||
client.post('/etl/extract', null, { params: { source_table: sourceTable, batch_size: batchSize } }),
|
||||
transform: (targetTable) =>
|
||||
client.post('/etl/transform', null, { params: { target_table: targetTable } }),
|
||||
load: (targetTable) =>
|
||||
client.post('/etl/load', null, { params: { target_table: targetTable } })
|
||||
},
|
||||
|
||||
// Schema endpoints
|
||||
schema: {
|
||||
create: (schemaType) => client.post('/schema/create', { schema_type: schemaType }),
|
||||
validate: () => client.get('/schema/validate'),
|
||||
info: () => client.get('/schema/info')
|
||||
},
|
||||
|
||||
// Stats endpoints
|
||||
stats: {
|
||||
etl: (limit) => client.get('/stats/etl', { params: { limit } }),
|
||||
dataQuality: () => client.get('/stats/data-quality'),
|
||||
summary: () => client.get('/stats/summary')
|
||||
},
|
||||
|
||||
// Validation endpoints
|
||||
validation: {
|
||||
run: (tableName) => client.post('/validation/run', null, { params: { table_name: tableName } }),
|
||||
unmappedCodes: (limit) => client.get('/validation/unmapped-codes', { params: { limit } })
|
||||
},
|
||||
|
||||
// Logs endpoints
|
||||
logs: {
|
||||
get: (lines, level) => client.get('/logs/', { params: { lines, level } }),
|
||||
errors: (limit) => client.get('/logs/errors', { params: { limit } })
|
||||
}
|
||||
}
|
||||
|
||||
export default client
|
||||
Reference in New Issue
Block a user