Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

db_schema: system_info.system_name -> system_name #434

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions backend/src/impl/db_utils/system_db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,7 @@ def find_systems(
if ids:
search_conditions.append({"_id": {"$in": [ObjectId(_id) for _id in ids]}})
if system_name:
search_conditions.append(
{"system_info.system_name": {"$regex": rf"^{system_name}.*"}}
)
search_conditions.append({"system_name": {"$regex": rf"^{system_name}.*"}})
if task:
search_conditions.append({"system_info.task_name": task})
if dataset_name:
Expand Down Expand Up @@ -519,7 +517,7 @@ def update_system_by_id(system_id: str, metadata: SystemMetadataUpdatable) -> bo

# TODO a more general, flexible solution instead of hard coding
field_to_value = {
"system_info.system_name": metadata.system_name,
"system_name": metadata.system_name,
"is_private": metadata.is_private,
"shared_users": metadata.shared_users,
"system_details": metadata.system_details,
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/components/Analysis/AnalysisDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,9 @@ export function AnalysisDrawer({ systems, closeDrawer }: Props) {

function getDrawerTitle(): string {
if (systems.length === 1) {
return `Single Analysis of ${systems[0].system_info.system_name}`;
return `Single Analysis of ${systems[0].system_name}`;
} else if (systems.length === 2) {
const systemNames = systems
.map((sys) => sys.system_info.system_name)
.join(" and ");
const systemNames = systems.map((sys) => sys.system_name).join(" and ");
return `Pairwise Analysis of ${systemNames}`;
}
return "Analysis";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function ExampleTable({
[systems]
);
const systemNames = useMemo(
() => systems.map((system) => system.system_info.system_name),
() => systems.map((system) => system.system_name),
[systems]
);
const systemIDsArray = useMemo(
Expand Down Expand Up @@ -69,13 +69,10 @@ export function ExampleTable({
>
{systems.map((system, sysIndex) => {
return (
<Tabs.TabPane
tab={system.system_info.system_name}
key={`${sysIndex}`}
>
<Tabs.TabPane tab={system.system_name} key={`${sysIndex}`}>
<AnalysisTable
systemIDs={systemIDsArray[sysIndex]}
systemNames={[system.system_info.system_name]}
systemNames={[system.system_name]}
task={task}
cases={cases[sysIndex]}
changeState={changeState}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function FineGrainedBarChart(props: Props) {
onBarClick,
} = props;
// For invariant variables across all systems, we can simply take from the first result
const systemNames = systems.map((system) => system.system_info.system_name);
const systemNames = systems.map((system) => system.system_name);
const resultFirst = results[0];
const bucketNames = resultFirst.bucketNames;
const featureName = resultFirst.featureName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function OverallMetricsBarChart({
metricNames,
onBarClick,
}: Props) {
const systemNames = systems.map((system) => system.system_info.system_name);
const systemNames = systems.map((system) => system.system_name);
const resultsValues: number[][] = [];
const resultsNumbersOfSamples: number[][] = [];
const resultsConfidenceScores: Array<[number, number]>[] = [];
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/SystemSubmitDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ export function SystemSubmitDrawer(props: Props) {
initialValues={
editMode
? {
name: systemToEdit?.system_info.system_name,
name: systemToEdit?.system_name,
// Must be boolean
is_private: systemToEdit?.is_private || false,
shared_users: systemToEdit?.shared_users,
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/SystemsTable/SystemTableContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ export function SystemTableContent({
align: "center",
},
{
dataIndex: ["system_info", "system_name"],
dataIndex: "system_name",
fixed: "left",
title: "Name",
render: (_, record) => (
<div>
<Text strong>{record.system_info.system_name}</Text>
<Text strong>{record.system_name}</Text>
{record.is_private && (
<span style={{ paddingLeft: "3px" }}>
<PrivateIcon />
Expand Down
3 changes: 3 additions & 0 deletions openapi/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,8 @@ components:
- properties:
system_id:
type: string
system_name:
type: string
is_private:
type: boolean
system_info:
Expand Down Expand Up @@ -998,6 +1000,7 @@ components:
required:
[
system_id,
system_name,
is_private,
system_info,
metric_stats,
Expand Down