Skip to content

Commit

Permalink
Merge branch 'main' into mboulais/O2B-1401/store-runs-and-qcflags-tim…
Browse files Browse the repository at this point in the history
…estamps-with-ms
  • Loading branch information
martinboulais authored Nov 25, 2024
2 parents 8cbb834 + ac219f9 commit 86d5bbd
Show file tree
Hide file tree
Showing 29 changed files with 571 additions and 168 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [1.3.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%401.3.0)
* Notable changes for users:
* Fixed physical constants values which resulted in wrong AVG center of mass energy
* Minor improvements to environments configuration display
* Table is now sorted alphabetically
* Table columns are not truncated anymore
* Use proper configuration for CCDB synchronization period and not monalisa one
* Added visualization of QC flags for data pass
* Notable changes for developers:
* Extended chart renderers:
* both x and y can be configured as index axis
* each bar in bar chart can have specific visual properties: color, stroke, pattern

## [1.2.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%401.2.0)
* Notable changes for users:
* Prevented the QC summary color from changing to gray after more than one verification
Expand Down
4 changes: 4 additions & 0 deletions database/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.3.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%401.3.0)
* Changes made to the database
* Fixed physical constants values in database

## [1.1.0](https://github.com/AliceO2Group/Bookkeeping/releases/tag/%40aliceo2%2Fbookkeeping%401.1.0)
* Changes made to the database
* Added columns first_tf_timestamp and last_tf_timestamp to runs table
Expand Down
3 changes: 3 additions & 0 deletions lib/database/adapters/QcFlagAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class QcFlagAdapter {

this.qcFlagTypeAdapter = null;
this.qcFlagVerificationAdapter = null;
this.qcFlagEffectivePeriodAdapter = null;
this.userAdapter = null;
}

Expand All @@ -48,6 +49,7 @@ class QcFlagAdapter {
flagTypeId,
flagType,
verifications,
effectivePeriods,
} = databaseObject;

return {
Expand All @@ -65,6 +67,7 @@ class QcFlagAdapter {
createdAt: createdAt ? new Date(createdAt).getTime() : null,
updatedAt: createdAt ? new Date(updatedAt).getTime() : null,
verifications: (verifications ?? []).map(this.qcFlagVerificationAdapter.toEntity),
effectivePeriods: (effectivePeriods ?? []).map(this.qcFlagEffectivePeriodAdapter.toEntity),
};
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

// Incorrect values, fixed by migration 20241105125509-fix-physical-constants.js
const PARTICLES_PROPERTIES = { // 2 * sqrt(ATOMIC_MASS / ATOMIC_NUMBER)
['2#Z/A_pp']: 2 * Math.sqrt(1 / 1),
['2#Z/A_PbPb']: 2 * Math.sqrt(207.2 / 82),
Expand Down
39 changes: 39 additions & 0 deletions lib/database/migrations/20241105125509-fix-physical-constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
'use strict';

// Fixes values set in 20231025101611-create-lhc-periods-view.js

/** @type {import('sequelize-cli').Migration} */
module.exports = {
up: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.sequelize.query(
// 2 * ATOMIC_NUMBER /ATOMIC_MASS => 2 * 82 / 207.2
'UPDATE physical_constants SET value=0.791505792 WHERE `key`=\'2#Z/A_PbPb\'',
{ transaction },
);
await queryInterface.sequelize.query(
// 2 * ATOMIC_NUMBER /ATOMIC_MASS => 2 * 8 / 15.999
'UPDATE physical_constants SET value=1.000062504 WHERE `key`=\'2#Z/A_OO\'',
{ transaction },
);
await queryInterface.sequelize.query(
// 2 * ATOMIC_NUMBER /ATOMIC_MASS => 2 * 54 / 131.293
'UPDATE physical_constants SET value=0.822587647 WHERE `key`=\'2#Z/A_XeXe\'',
{ transaction },
);
}),

down: async (queryInterface) => queryInterface.sequelize.transaction(async (transaction) => {
await queryInterface.sequelize.query(
'UPDATE physical_constants SET value=3.1792006972147466 WHERE `key`=\'2#Z/A_PbPb\'',
{ transaction },
);
await queryInterface.sequelize.query(
'UPDATE physical_constants SET value=7.999974999960937 WHERE `key`=\'2#Z/A_OO\'',
{ transaction },
);
await queryInterface.sequelize.query(
'UPDATE physical_constants SET value=22.916369695045503 WHERE `key`=\'2#Z/A_XeXe\'',
{ transaction },
);
}),
};
12 changes: 6 additions & 6 deletions lib/public/components/common/chart/barChart/barChartComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ import { BarChartRenderer } from '../rendering/BarChartRenderer.js';
class BarChartClassComponent {
/**
* Constructor
* @param {{attrs: {points: Point[], configuration: BarChartComponentConfiguration}}} vnode the component's vnode
* @param {{attrs: {bars: Bar[], configuration: BarChartComponentConfiguration}}} vnode the component's vnode
*/
constructor({
attrs: {
points,
bars,
configuration,
},
}) {
this._chartRenderer = new BarChartRenderer(configuration.chartConfiguration, points);
this._chartRenderer = new BarChartRenderer(configuration.chartConfiguration, bars);
}

/**
Expand Down Expand Up @@ -69,10 +69,10 @@ class BarChartClassComponent {
/**
* Render a line chart component
*
* @param {Point[]} points the points to display
* @param {ChartBar[]} bars the bars to display
* @param {BarChartComponentConfiguration} configuration the configuration of the component
* @return {Component} the resulting component
*/
export const barChartComponent = (points, configuration) => points.length
? h(BarChartClassComponent, { points, configuration })
export const barChartComponent = (bars, configuration) => bars.length
? h(BarChartClassComponent, { bars, configuration })
: h('.w-100.h-100.flex-row.items-center.justify-center', h('', configuration.placeholder || 'No data'));
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class LineChartClassComponent {
}

// eslint-disable-next-line require-jsdoc
onupdate({ attrs: { points, configuration } }) {
onupdate({ attrs: { data, configuration } }) {
this.configuration = configuration;

this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, points);
this._chartRenderer = new LineChartRenderer(configuration.chartConfiguration, data);
}

// eslint-disable-next-line require-jsdoc
Expand Down
89 changes: 75 additions & 14 deletions lib/public/components/common/chart/rendering/BarChartRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,97 @@ export class BarChartRenderer extends ChartRenderer {
* Constructor
*
* @param {BarChartConfiguration} configuration the chart configuration
* @param {Point[]} points the points to render
* @param {ChartBar[]} bars the bars to render
*/
constructor(configuration, points) {
super(configuration, points);
constructor(configuration, bars) {
super(configuration, bars);

if (this._stackedY) {
if (this._stackedValues) {
throw new Error('Bar chart not implemented for stacked values');
}

/**
* Get bar length - size along value axis
* @param {ChartBar} bar bar
* @return {number} bar length
*/
const getBarLength = ({ x, y }) => {
if (this.isXIndexAxis) {
if (Array.isArray(y)) {
throw new Error('Range and stacked bars not implemented for index axis \'x\'');
}
return this._chartDrawingZone.top + this._chartDrawingZone.height - this.yScale(y);
} else if (Array.isArray(x)) { // Index axis is 'y'
if (!this._stackedValues) {
if (x.length === 2) {
return this.xScale(x[1]) - this.xScale(x[0]);
} else {
throw new Error('For range bars you need to provide array of two numbers');
}
} else {
throw new Error('Bar chart not implemented for stacked values');
}
} else {
return this.xScale(x);
}
};

/**
* Get bars thickness - size along index axis
* @return {number} thickness of bars
*/
const getBarThickness = () => this.indexAxisScale.bandwidth();

/**
* @type {ChartBarPropertiesProvider}
*/
this._barPropertiesProvider = {
getX: ({ x }) => {
if (this.isXIndexAxis) {
return this.xScale(x);
} else if (Array.isArray(x)) { // Index axis is 'y'
if (!this._stackedValues) {
if (x.length === 2) {
return this.xScale(x[0]);
} else {
throw new Error('For range bars you need to provide array of two numbers');
}
} else {
throw new Error('Bar chart not implemented for stacked values');
}
} else {
return this._chartDrawingZone.left;
}
},
getY: ({ y }) => {
if (this.isXIndexAxis) {
if (Array.isArray(y)) {
throw new Error('Range and stacked bars not implemented for index axis \'x\'');
}
}
return this.yScale(y);
},
getWidth: this.isXIndexAxis
? getBarThickness
: getBarLength,
getHeight: this.isXIndexAxis
? getBarLength
: getBarThickness,
};
}

// eslint-disable-next-line valid-jsdoc
/**
* @inheritDoc
*/
renderDataset(datasetIndex, svg) {
/** @type {PointLocator} */
const pointLocator = {
getX: ({ x }) => this.xScale(x),
getY: ({ y }) => this.yScale(y),
};

const { bar: barConfiguration } = this._datasets[datasetIndex] || {};

// Display datasets
renderDatasetAsBars(
svg,
this._points,
this.xScale.bandwidth(),
this._chartDrawingZone,
pointLocator,
this._data,
this._barPropertiesProvider,
barConfiguration,
);
}
Expand Down
Loading

0 comments on commit 86d5bbd

Please sign in to comment.