Skip to content

Commit

Permalink
Merge pull request #61 from MolSSI/move-std
Browse files Browse the repository at this point in the history
update for moving std to own column
  • Loading branch information
janash authored Nov 15, 2023
2 parents 86a4584 + b57c240 commit d8195ff
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/app/app/schemas/molecule.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MoleculeData(BaseModel):
min: Optional[float] = None
delta: Optional[float] = None
boltzmann_average: Optional[float] = None
std: Optional[float] = None
vburminconf: Optional[float] = None

class MoleculeSimple(BaseModel):
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/components/MoleculeDataTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export default function MoleculeDataTable({ molecule_id, initial_data_type }) {
{ field: 'delta', headerName: 'Delta', filterable: true, headerAlign: 'right', align: 'right', flex: true },
{ field: 'vburminconf', headerName: 'vbur min conf', filterable: true, headerAlign: 'right', align: 'right', flex: true },
{ field: 'boltzmann_average', headerName: 'Boltz', filterable: true, headerAlign: 'right', align: 'right', flex: true },
{ field: 'std', headerName: 'std', filterable: true, headerAlign: 'right', align: 'right', flex: true}
];

// Filter out delta and vburminconf columns for xTB data.
Expand All @@ -158,6 +159,10 @@ export default function MoleculeDataTable({ molecule_id, initial_data_type }) {
displayColumns = columns.filter(column => column.field !== 'delta' && column.field !== 'vburminconf');
}

else {
displayColumns = columns.filter(column => column.field !== 'std');
}

const rows = moleculeData ? moleculeData
.map(item => ({
id: item.property,
Expand All @@ -167,6 +172,7 @@ export default function MoleculeDataTable({ molecule_id, initial_data_type }) {
delta: item.delta,
boltzmann_average: item.boltzmann_average,
vburminconf: item.vburminconf,
std: item.std,
})) : [];

return (
Expand Down
34 changes: 34 additions & 0 deletions move_std.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
ALTER TABLE xtb_data
ADD COLUMN std DOUBLE PRECISION;

UPDATE xtb_data
SET std = x.boltzmann_average
FROM (
SELECT
SUBSTRING(property FROM 1 FOR POSITION('_std' IN property) - 1) AS property_name,
boltzmann_average
FROM xtb_data
WHERE property LIKE '%_std%'
) AS x
WHERE xtb_data.property = x.property_name;

DELETE FROM xtb_data
WHERE property LIKE '%_std%';

---------------------------------------------
ALTER TABLE xtb_ni_data
ADD COLUMN std DOUBLE PRECISION;

UPDATE xtb_ni_data
SET std = x.boltzmann_average
FROM (
SELECT
SUBSTRING(property FROM 1 FOR POSITION('_std' IN property) - 1) AS property_name,
boltzmann_average
FROM xtb_ni_data
WHERE property LIKE '%_std%'
) AS x
WHERE xtb_ni_data.property = x.property_name;

DELETE FROM xtb_ni_data
WHERE property LIKE '%_std%';

0 comments on commit d8195ff

Please sign in to comment.