-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from DocShow-AI/dev
Dev
- Loading branch information
Showing
18 changed files
with
365 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
backend/alembic/versions/f8ca6f4bf570_replace_table_id_with_table_name_in_.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"""replace table_id with table_name in data profile model | ||
Revision ID: f8ca6f4bf570 | ||
Revises: 94af7f09e896 | ||
Create Date: 2024-01-29 20:26:47.028083 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "f8ca6f4bf570" | ||
down_revision = "94af7f09e896" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# Rename the column and change its type | ||
op.alter_column( | ||
"data_profiles", | ||
"table_id", | ||
new_column_name="table_name", | ||
type_=sa.String(), | ||
existing_nullable=True, | ||
) | ||
|
||
|
||
def downgrade(): | ||
# Reverse the changes made in the upgrade function | ||
op.alter_column( | ||
"data_profiles", | ||
"table_name", | ||
new_column_name="table_id", | ||
type_=sa.Integer(), | ||
existing_nullable=True, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from fastapi import APIRouter | ||
from utils.azure.azure_manager import AzureManager | ||
|
||
powerbi_router = APIRouter() | ||
|
||
|
||
@powerbi_router.get("/powerbi/token/") | ||
async def get_powerbi_token(): | ||
azure_manager = AzureManager() | ||
token = azure_manager.get_powerbi_token() | ||
return {"token": token} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from azure.identity import ClientSecretCredential | ||
from settings import AZURE_APP_SECRET, AZURE_CLIENT_ID, AZURE_TENANT_ID | ||
|
||
|
||
class AzureManager: | ||
def __init__(self): | ||
self.credential = ClientSecretCredential( | ||
AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_APP_SECRET | ||
) | ||
self.powerbi_token = self.credential.get_token( | ||
"https://analysis.windows.net/powerbi/api/.default" | ||
) | ||
|
||
def get_powerbi_token(self): | ||
return self.powerbi_token.token |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import axios from "axios"; | ||
import { API_URL } from "../utils/constants"; | ||
|
||
export const getPreviewData = (sampleFiles, extractInstructions) => { | ||
const formData = new FormData(); | ||
sampleFiles.forEach((file) => { | ||
formData.append("files", file); | ||
}); | ||
formData.append("extract_instructions", extractInstructions); | ||
|
||
return axios.post(`${API_URL}data-profiles/preview/`, formData, { | ||
headers: { | ||
"Content-Type": "multipart/form-data", | ||
}, | ||
}); | ||
}; | ||
|
||
export const getAvailableColumnTypes = () => { | ||
return axios.get(`${API_URL}data-profiles/column-types/`); | ||
}; | ||
|
||
export const getSuggestedColumnTypes = (previewData) => { | ||
return axios.post(`${API_URL}data-profiles/preview/column-types/`, { | ||
data: previewData, | ||
}); | ||
}; |
Oops, something went wrong.