diff --git a/Dockerfile b/Dockerfile
index 399c31217..3d5dc25f4 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -21,7 +21,7 @@ RUN mvn install:install-file -Dfile=dependencies/securityfilter.jar -DgroupId=se
mvn install:install-file -Dfile=dependencies/jhdf5.jar -DgroupId=jhdf5 -DartifactId=jhdf5 -Dversion=1.0 -Dpackaging=jar && \
mvn install:install-file -Dfile=dependencies/jhdf5obj.jar -DgroupId=jhdf5obj -DartifactId=jhdf5obj -Dversion=1.0 -Dpackaging=jar && \
mvn install:install-file -Dfile=dependencies/jhdfobj.jar -DgroupId=jhdfobj -DartifactId=jhdfobj -Dversion=1.0 -Dpackaging=jar && \
- mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.5.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.5 -Dpackaging=jar && \
+ mvn install:install-file -Dfile=dependencies/ispyb-userportal-gen-1.7.jar -DgroupId=ispyb -DartifactId=ispyb-userportal-gen -Dversion=1.7 -Dpackaging=jar && \
mvn install:install-file -Dfile=dependencies/Struts-Layout-1.2.jar -DgroupId=struts-layout -DartifactId=struts-layout -Dversion=1.2 -Dpackaging=jar && \
mvn install -Dispyb.site=MAXIV -Dispyb.env=production && \
cp ispyb-ear/target/ispyb.ear /var/ispyb.ear
diff --git a/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql b/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql
new file mode 100644
index 000000000..070397cca
--- /dev/null
+++ b/ispyb-ejb/db/scripts/ahead/2020_05_08_EnergyScan_add_remoteEnergy.sql
@@ -0,0 +1,61 @@
+INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_05_08_EnergyScan_add_remoteEnergy.sql', 'ONGOING');
+
+ALTER TABLE `pydb`.`EnergyScan`
+ADD COLUMN `remoteEnergy` FLOAT NULL DEFAULT NULL AFTER `blSubSampleId`,
+ADD COLUMN `remoteFPrime` FLOAT NULL DEFAULT NULL AFTER `remoteEnergy`,
+ADD COLUMN `remoteFDoublePrime` FLOAT NULL DEFAULT NULL AFTER `remoteFPrime`;
+
+USE `pydb`;
+CREATE
+ OR REPLACE ALGORITHM = MERGE
+ DEFINER = `pxadmin`@`%`
+ SQL SECURITY DEFINER
+VIEW `v_energyScan` AS
+ SELECT
+ `EnergyScan`.`energyScanId` AS `energyScanId`,
+ `EnergyScan`.`sessionId` AS `sessionId`,
+ `EnergyScan`.`blSampleId` AS `blSampleId`,
+ `EnergyScan`.`fluorescenceDetector` AS `fluorescenceDetector`,
+ `EnergyScan`.`scanFileFullPath` AS `scanFileFullPath`,
+ `EnergyScan`.`choochFileFullPath` AS `choochFileFullPath`,
+ `EnergyScan`.`jpegChoochFileFullPath` AS `jpegChoochFileFullPath`,
+ `EnergyScan`.`element` AS `element`,
+ `EnergyScan`.`startEnergy` AS `startEnergy`,
+ `EnergyScan`.`endEnergy` AS `endEnergy`,
+ `EnergyScan`.`transmissionFactor` AS `transmissionFactor`,
+ `EnergyScan`.`exposureTime` AS `exposureTime`,
+ `EnergyScan`.`synchrotronCurrent` AS `synchrotronCurrent`,
+ `EnergyScan`.`temperature` AS `temperature`,
+ `EnergyScan`.`peakEnergy` AS `peakEnergy`,
+ `EnergyScan`.`peakFPrime` AS `peakFPrime`,
+ `EnergyScan`.`peakFDoublePrime` AS `peakFDoublePrime`,
+ `EnergyScan`.`inflectionEnergy` AS `inflectionEnergy`,
+ `EnergyScan`.`inflectionFPrime` AS `inflectionFPrime`,
+ `EnergyScan`.`inflectionFDoublePrime` AS `inflectionFDoublePrime`,
+ `EnergyScan`.`xrayDose` AS `xrayDose`,
+ `EnergyScan`.`startTime` AS `startTime`,
+ `EnergyScan`.`endTime` AS `endTime`,
+ `EnergyScan`.`edgeEnergy` AS `edgeEnergy`,
+ `EnergyScan`.`filename` AS `filename`,
+ `EnergyScan`.`beamSizeVertical` AS `beamSizeVertical`,
+ `EnergyScan`.`beamSizeHorizontal` AS `beamSizeHorizontal`,
+ `EnergyScan`.`crystalClass` AS `crystalClass`,
+ `EnergyScan`.`comments` AS `comments`,
+ `EnergyScan`.`flux` AS `flux`,
+ `EnergyScan`.`flux_end` AS `flux_end`,
+ `EnergyScan`.`remoteEnergy` AS `remoteEnergy`,
+ `EnergyScan`.`remoteFPrime` AS `remoteFPrime`,
+ `EnergyScan`.`remoteFDoublePrime` AS `remoteFDoublePrime`,
+ `BLSample`.`blSampleId` AS `BLSample_sampleId`,
+ `BLSample`.`name` AS `name`,
+ `BLSample`.`code` AS `code`,
+ `Protein`.`acronym` AS `acronym`,
+ `BLSession`.`proposalId` AS `BLSession_proposalId`
+ FROM
+ ((((`EnergyScan`
+ LEFT JOIN `BLSample` ON ((`BLSample`.`blSampleId` = `EnergyScan`.`blSampleId`)))
+ LEFT JOIN `Crystal` ON ((`Crystal`.`crystalId` = `BLSample`.`crystalId`)))
+ LEFT JOIN `Protein` ON ((`Protein`.`proteinId` = `Crystal`.`proteinId`)))
+ LEFT JOIN `BLSession` ON ((`BLSession`.`sessionId` = `EnergyScan`.`sessionId`)));
+
+UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_05_08_EnergyScan_add_remoteEnergy.sql';
\ No newline at end of file
diff --git a/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql b/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql
new file mode 100644
index 000000000..ba71584f6
--- /dev/null
+++ b/ispyb-ejb/db/scripts/ahead/2020_10_08_experiment_statistics_view.sql
@@ -0,0 +1,37 @@
+INSERT IGNORE INTO SchemaStatus (scriptName, schemaStatus) VALUES ('2020_10_08_experiment_statistics_view.sql', 'ONGOING');
+
+CREATE
+ ALGORITHM = UNDEFINED
+ DEFINER = `pxadmin`@`%`
+ SQL SECURITY DEFINER
+VIEW `v_mx_experiment_stats` AS
+ SELECT
+ `DC`.`startTime` AS `startTime`,
+ `DC`.`numberOfImages` AS `Images`,
+ `DC`.`transmission` AS `Transmission`,
+ `DC`.`resolution` AS `Res. (corner)`,
+ `DC`.`wavelength` AS `En. (Wave.)`,
+ `DC`.`omegaStart` AS `Omega start (total)`,
+ `DC`.`exposureTime` AS `Exposure Time`,
+ `DC`.`flux` AS `Flux`,
+ `DC`.`flux_end` AS `Flux End`,
+ `DC`.`detectorDistance` AS `Detector Distance`,
+ `DC`.`xBeam` AS `X Beam`,
+ `DC`.`yBeam` AS `Y Beam`,
+ `DC`.`kappaStart` AS `Kappa`,
+ `DC`.`phiStart` AS `Phi`,
+ `DC`.`axisStart` AS `Axis Start`,
+ `DC`.`axisEnd` AS `Axis End`,
+ `DC`.`axisRange` AS `Axis Range`,
+ `DC`.`beamSizeAtSampleX` AS `Beam Size X`,
+ `DC`.`beamSizeAtSampleY` AS `Beam Size Y`,
+ `BLS`.`beamLineName` AS `beamLineName`,
+ `DCG`.`comments` AS `comments`,
+ `P`.`proposalNumber` AS `proposalNumber`
+ FROM
+ (((`DataCollection` `DC`
+ JOIN `DataCollectionGroup` `DCG` ON ((`DCG`.`dataCollectionGroupId` = `DC`.`dataCollectionGroupId`)))
+ JOIN `BLSession` `BLS` ON ((`BLS`.`sessionId` = `DCG`.`sessionId`)))
+ JOIN `Proposal` `P` ON ((`P`.`proposalId` = `BLS`.`proposalId`)))
+
+UPDATE SchemaStatus SET schemaStatus = 'DONE' WHERE scriptName = '2020_10_08_experiment_statistics_view.sql';
\ No newline at end of file
diff --git a/ispyb-ejb/pom.xml b/ispyb-ejb/pom.xml
index ac08cda2b..031e1be72 100644
--- a/ispyb-ejb/pom.xml
+++ b/ispyb-ejb/pom.xml
@@ -479,7 +479,7 @@
LDAP
database
- ldaps://srv-ad-2.maxiv.lu.se/
+ ldaps://adauth.maxiv.lu.se/
dc=maxlab,dc=lu,dc=se
dc=maxlab,dc=lu,dc=se
samaccountname
diff --git a/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java b/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java
index bff3980f6..854b0fe80 100644
--- a/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java
+++ b/ispyb-ejb/src/main/java/ispyb/common/util/export/ExiPdfRtfExporter.java
@@ -810,7 +810,10 @@ private void setEnergyScanMapData(Document document, Map energyS
+ "Pk f'': \n"
+ "Inflection Energy: \n"
+ "Ip f': \n"
- + "Ip f'': \n" ;
+ + "Ip f'': \n"
+ + "Remote Energy: \n"
+ + "Remote f': \n"
+ + "Remote f'': \n" ;
table.addCell(new Paragraph(parag, FONT_DOC));
@@ -819,9 +822,12 @@ private void setEnergyScanMapData(Document document, Map energyS
parag = getCellParam(energyScanMapItem, "peakEnergy", df3) + "keV \n"
+ getCellParam(energyScanMapItem, "peakFPrime", df2) + " e- \n"
+ getCellParam(energyScanMapItem, "peakFDoublePrime", df2) + " e- \n"
- + "("+ getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n"
+ + getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n"
+ getCellParam(energyScanMapItem, "inflectionFPrime", df2) + " e- \n"
- + getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n" ;
+ + getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n"
+ + getCellParam(energyScanMapItem, "remoteEnergy", df2) + "keV \n"
+ + getCellParam(energyScanMapItem, "remoteFPrime", df2) + " e- \n"
+ + getCellParam(energyScanMapItem, "remoteFDoublePrime", df2) + " e- \n" ;;
table.addCell(new Paragraph(parag, FONT_DOC_BOLD));
@@ -1173,7 +1179,7 @@ private void setEnergyScanMapData2(Document document, Map energy
String parag = getCellParam(energyScanMapItem, "scanFileFullPath", null) + "\n" ;
document.add(new Paragraph(parag, FONT_DOC_SMALL));
- Table table = new Table(9);
+ Table table = new Table(11);
table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT);
table.getDefaultCell().setBorderWidth(0);
table.setBorder(0);
@@ -1250,7 +1256,18 @@ private void setEnergyScanMapData2(Document document, Map energy
parag = getCellParam(energyScanMapItem, "inflectionEnergy", df2) + "keV \n"
+ getCellParam(energyScanMapItem, "inflectionFPrime", df2) + " e- \n"
+ getCellParam(energyScanMapItem, "inflectionFDoublePrime", df2) + " e- \n" ;
-
+
+ // Cell 10
+ parag = "Remote Energy: \n"
+ + "Remote f': \n"
+ + "Remote f'': \n" ;
+
+ table.addCell(new Paragraph(parag, FONT_DOC_SMALL));
+
+ // Cell 11
+ parag = getCellParam(energyScanMapItem, "remoteEnergy", df2) + "keV \n"
+ + getCellParam(energyScanMapItem, "remoteFPrime", df2) + " e- \n"
+ + getCellParam(energyScanMapItem, "remoteFDoublePrime", df2) + " e- \n" ;
table.addCell(new Paragraph(parag, FONT_DOC_SMALL_BOLD));
document.add(table);
diff --git a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java
index 1afad5e52..6c4a7ef9c 100644
--- a/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java
+++ b/ispyb-ejb/src/main/java/ispyb/server/biosaxs/services/stats/Stats3Service.java
@@ -45,6 +45,8 @@ public interface Stats3Service {
List