From 63a841f2e009a3070d0638f9f6be57950a72f77f7ffdefd504ff39050e66d7cf Mon Sep 17 00:00:00 2001 From: PioApocalypse Date: Wed, 21 Jan 2026 22:24:07 +0100 Subject: [PATCH] advances tests: recovers sample name from experiment w/o items_links user is prompted for api key sample name is taken from its item page through the ID recovered from the experiment JSON data --- jupyter/parsing.ipynb | 325 ++++++++++++++++++++++++++++++++---------- 1 file changed, 250 insertions(+), 75 deletions(-) diff --git a/jupyter/parsing.ipynb b/jupyter/parsing.ipynb index 8faa10c..ae8299d 100644 --- a/jupyter/parsing.ipynb +++ b/jupyter/parsing.ipynb @@ -69,20 +69,34 @@ " \"compounds\": [],\n", " \"containers\": [],\n", " \"content_type\": 1,\n", - " \"created_at\": \"2026-01-07 13:22:35\",\n", + " \"created_at\": \"2026-01-20 16:11:32\",\n", " \"custom_id\": null,\n", - " \"date\": \"2026-01-07\",\n", - " \"elabid\": \"20260107-6884c5639c2573cd4104a3f3b93bcd5a16e4c63e\",\n", + " \"date\": \"2026-01-20\",\n", + " \"elabid\": \"20260120-b72ca9659e21e904f5dbd12b2625a007ed97ed57\",\n", " \"events_start\": null,\n", " \"events_start_itemid\": null,\n", " \"exclusive_edit_mode\": null,\n", " \"experiments_links\": [],\n", " \"firstname\": \"Emiliano\",\n", " \"fullname\": \"Emiliano Di Gennaro\",\n", - " \"id\": 41,\n", + " \"id\": 45,\n", " \"is_pinned\": 0,\n", " \"items_links\": [\n", " {\n", + " \"entityid\": 854,\n", + " \"title\": \"LAO_single_crystal_01\",\n", + " \"custom_id\": null,\n", + " \"elabid\": \"20260107-1f8d0a6d9cf61be826b8b35f5516959848815310\",\n", + " \"link_state\": 1,\n", + " \"is_bookable\": 0,\n", + " \"page\": \"database.php\",\n", + " \"type\": \"items\",\n", + " \"category_title\": \"NEW_PLD Target\",\n", + " \"category_color\": \"29aeb9\",\n", + " \"status_title\": \"Available\",\n", + " \"status_color\": \"6a7753\"\n", + " },\n", + " {\n", " \"entityid\": 855,\n", " \"title\": \"Na-26-001\",\n", " \"custom_id\": null,\n", @@ -95,20 +109,6 @@ " \"category_color\": \"29aeb9\",\n", " \"status_title\": \"Available\",\n", " \"status_color\": \"6a7753\"\n", - " },\n", - " {\n", - " \"entityid\": 466,\n", - " \"title\": \"Target di prova\",\n", - " \"custom_id\": null,\n", - " \"elabid\": \"20250224-58dbf45c5bb2f6c4f6745889da7b05a32645f83b\",\n", - " \"link_state\": 1,\n", - " \"is_bookable\": 0,\n", - " \"page\": \"database.php\",\n", - " \"type\": \"items\",\n", - " \"category_title\": \"PLD Target\",\n", - " \"category_color\": \"1a5fb4\",\n", - " \"status_title\": null,\n", - " \"status_color\": null\n", " }\n", " ],\n", " \"lastchangeby\": 2,\n", @@ -116,7 +116,7 @@ " \"locked\": 0,\n", " \"locked_at\": null,\n", " \"lockedby\": null,\n", - " \"metadata\": \"{\\\"elabftw\\\": {\\\"extra_fields_groups\\\": [{\\\"id\\\": 4, \\\"name\\\": \\\"Process\\\"}, {\\\"id\\\": 6, \\\"name\\\": \\\"Post Annealing\\\"}, {\\\"id\\\": 3, \\\"name\\\": \\\"Instruments\\\"}]}, \\\"extra_fields\\\": {\\\"Sample\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 855, \\\"group_id\\\": 4, \\\"position\\\": 0}, \\\"Target\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 466, \\\"group_id\\\": 4, \\\"position\\\": 2, \\\"required\\\": true}, \\\"Chamber\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 72, \\\"group_id\\\": 3, \\\"position\\\": 0}, \\\"Duration\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"s\\\", \\\"units\\\": [\\\"s\\\", \\\"min\\\"], \\\"value\\\": \\\"365\\\", \\\"group_id\\\": 4, \\\"position\\\": 9}, \\\"Thickness\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"u.c.\\\", \\\"units\\\": [\\\"u.c.\\\", \\\"s\\\"], \\\"value\\\": \\\"4\\\", \\\"group_id\\\": 4, \\\"position\\\": 11}, \\\"Buffer gas\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"O2\\\", \\\"options\\\": [\\\"O2\\\", \\\"N2\\\", \\\"Ar\\\", \\\"\\\"], \\\"group_id\\\": 4, \\\"position\\\": 5}, \\\"Duration PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"s\\\", \\\"units\\\": [\\\"s\\\", \\\"min\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6}, \\\"Laser System\\\": {\\\"type\\\": \\\"text\\\", \\\"value\\\": \\\"excimer 1\\\", \\\"group_id\\\": 3}, \\\"RHEED System\\\": {\\\"type\\\": \\\"text\\\", \\\"value\\\": \\\"staib 2\\\", \\\"group_id\\\": 3}, \\\"Buffer gas PA\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"O2\\\", \\\"options\\\": [\\\"O2\\\", \\\"N2\\\", \\\"Ar\\\", \\\"\\\"], \\\"group_id\\\": 6, \\\"position\\\": 3}, \\\"Heating Method\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"Radiative Heater\\\", \\\"options\\\": [\\\"Radiative Heater\\\", \\\"Laser Heater\\\"], \\\"group_id\\\": 4, \\\"position\\\": 7}, \\\"Laser Intensity\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"J/(s cm^2)\\\", \\\"units\\\": [\\\"J/(s cm^2)\\\"], \\\"value\\\": \\\"1.5\\\", \\\"group_id\\\": 4, \\\"position\\\": 8}, \\\"Repetition rate\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"Hz\\\", \\\"units\\\": [\\\"Hz\\\"], \\\"value\\\": \\\"1\\\", \\\"group_id\\\": 4, \\\"position\\\": 10}, \\\"Process pressure \\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mbar\\\", \\\"units\\\": [\\\"mbar\\\"], \\\"value\\\": \\\"1e-3\\\", \\\"group_id\\\": 4, \\\"position\\\": 6}, \\\"Heater temperature \\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\u00b0C\\\", \\\"units\\\": [\\\"\\u00b0C\\\"], \\\"value\\\": \\\"650\\\", \\\"group_id\\\": 4, \\\"position\\\": 3}, \\\"Process pressure PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mbar\\\", \\\"units\\\": [\\\"mbar\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6, \\\"position\\\": 4}, \\\"Heater temperature PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\u00b0C\\\", \\\"units\\\": [\\\"\\u00b0C\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6}, \\\"Heater-target distance\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mm\\\", \\\"units\\\": [\\\"mm\\\"], \\\"value\\\": \\\"4\\\", \\\"group_id\\\": 4, \\\"position\\\": 4}, \\\"Layer Progressive Number\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\\", \\\"units\\\": [], \\\"value\\\": \\\"1\\\", \\\"group_id\\\": 4, \\\"position\\\": 1, \\\"required\\\": true}}}\",\n", + " \"metadata\": \"{\\\"elabftw\\\": {\\\"extra_fields_groups\\\": [{\\\"id\\\": 4, \\\"name\\\": \\\"Process\\\"}, {\\\"id\\\": 7, \\\"name\\\": \\\"Laser\\\"}, {\\\"id\\\": 8, \\\"name\\\": \\\"Pre Annealing\\\"}, {\\\"id\\\": 6, \\\"name\\\": \\\"Post Annealing\\\"}, {\\\"id\\\": 3, \\\"name\\\": \\\"Instruments\\\"}]}, \\\"extra_fields\\\": {\\\"Sample\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 855, \\\"group_id\\\": 4, \\\"position\\\": 0}, \\\"Target\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 854, \\\"group_id\\\": 4, \\\"position\\\": 2, \\\"required\\\": true}, \\\"Chamber\\\": {\\\"type\\\": \\\"items\\\", \\\"value\\\": 72, \\\"group_id\\\": 3, \\\"position\\\": 0}, \\\"Duration\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"s\\\", \\\"units\\\": [\\\"s\\\", \\\"min\\\"], \\\"value\\\": \\\"340\\\", \\\"group_id\\\": 4, \\\"position\\\": 5}, \\\"Spot Area\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mm^2\\\", \\\"units\\\": [\\\"mm^2\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 7, \\\"position\\\": 1}, \\\"Thickness\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"u.c.\\\", \\\"units\\\": [\\\"u.c.\\\", \\\"s\\\"], \\\"value\\\": \\\"10\\\", \\\"group_id\\\": 4, \\\"position\\\": 6}, \\\"Buffer gas\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"O2\\\", \\\"options\\\": [\\\"O2\\\", \\\"N2\\\", \\\"Ar\\\", \\\"\\\"], \\\"group_id\\\": 4, \\\"position\\\": 3}, \\\"Duration PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"s\\\", \\\"units\\\": [\\\"s\\\", \\\"min\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6}, \\\"Duration Pre\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"s\\\", \\\"units\\\": [\\\"s\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 8}, \\\"Laser System\\\": {\\\"type\\\": \\\"text\\\", \\\"value\\\": \\\"Excimer \\\", \\\"group_id\\\": 3}, \\\"RHEED System\\\": {\\\"type\\\": \\\"text\\\", \\\"value\\\": \\\"staib\\\", \\\"group_id\\\": 3}, \\\"Buffer gas PA\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"O2\\\", \\\"options\\\": [\\\"O2\\\", \\\"N2\\\", \\\"Ar\\\", \\\"\\\"], \\\"group_id\\\": 6, \\\"position\\\": 3}, \\\"Buffer gas Pre\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"O2\\\", \\\"options\\\": [\\\"O2\\\", \\\"N2\\\", \\\"Ar\\\", \\\"\\\"], \\\"group_id\\\": 8, \\\"position\\\": 3}, \\\"Heating Method\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"Radiative Heater\\\", \\\"options\\\": [\\\"Radiative Heater\\\", \\\"Laser Heater\\\"], \\\"group_id\\\": 4, \\\"position\\\": 9}, \\\"Laser Intensity\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"J/(s cm^2)\\\", \\\"units\\\": [\\\"J/(s cm^2)\\\"], \\\"value\\\": \\\"1.5\\\", \\\"group_id\\\": 7, \\\"position\\\": 0}, \\\"Repetition rate\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"Hz\\\", \\\"units\\\": [\\\"Hz\\\"], \\\"value\\\": \\\"1\\\", \\\"group_id\\\": 7, \\\"position\\\": 4}, \\\"Process pressure \\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mbar\\\", \\\"units\\\": [\\\"mbar\\\"], \\\"value\\\": \\\"1e-3\\\", \\\"group_id\\\": 4, \\\"position\\\": 4}, \\\"Heater temperature \\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\u00b0C\\\", \\\"units\\\": [\\\"\\u00b0C\\\"], \\\"value\\\": \\\"760\\\", \\\"group_id\\\": 4, \\\"position\\\": 7}, \\\"Process pressure PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mbar\\\", \\\"units\\\": [\\\"mbar\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6, \\\"position\\\": 4}, \\\"Process pressure Pre\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mbar\\\", \\\"units\\\": [\\\"mbar\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 8, \\\"position\\\": 4}, \\\"Heater temperature PA\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\u00b0C\\\", \\\"units\\\": [\\\"\\u00b0C\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 6}, \\\"Laser Rastering Speed\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\\", \\\"units\\\": [], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 7, \\\"position\\\": 3}, \\\"Heater temperature Pre\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\u00b0C\\\", \\\"units\\\": [\\\"\\u00b0C\\\"], \\\"value\\\": \\\"\\\", \\\"group_id\\\": 8}, \\\"Heater-target distance\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"mm\\\", \\\"units\\\": [\\\"mm\\\"], \\\"value\\\": \\\"38\\\", \\\"group_id\\\": 4, \\\"position\\\": 8}, \\\"Laser Rastering Geometry\\\": {\\\"type\\\": \\\"select\\\", \\\"value\\\": \\\"none\\\", \\\"options\\\": [\\\"none\\\", \\\"on a square\\\", \\\"on a rectangle\\\", \\\"on a line\\\", \\\"other\\\"], \\\"group_id\\\": 7, \\\"position\\\": 2}, \\\"Layer Progressive Number\\\": {\\\"type\\\": \\\"number\\\", \\\"unit\\\": \\\"\\\", \\\"units\\\": [], \\\"value\\\": \\\"1\\\", \\\"group_id\\\": 4, \\\"position\\\": 1, \\\"required\\\": true}}}\",\n", " \"metadata_decoded\": {\n", " \"elabftw\": {\n", " \"extra_fields_groups\": [\n", @@ -125,6 +125,14 @@ " \"name\": \"Process\"\n", " },\n", " {\n", + " \"id\": 7,\n", + " \"name\": \"Laser\"\n", + " },\n", + " {\n", + " \"id\": 8,\n", + " \"name\": \"Pre Annealing\"\n", + " },\n", + " {\n", " \"id\": 6,\n", " \"name\": \"Post Annealing\"\n", " },\n", @@ -143,7 +151,7 @@ " },\n", " \"Target\": {\n", " \"type\": \"items\",\n", - " \"value\": 466,\n", + " \"value\": 854,\n", " \"group_id\": 4,\n", " \"position\": 2,\n", " \"required\": true\n", @@ -161,9 +169,19 @@ " \"s\",\n", " \"min\"\n", " ],\n", - " \"value\": \"365\",\n", + " \"value\": \"340\",\n", " \"group_id\": 4,\n", - " \"position\": 9\n", + " \"position\": 5\n", + " },\n", + " \"Spot Area\": {\n", + " \"type\": \"number\",\n", + " \"unit\": \"mm^2\",\n", + " \"units\": [\n", + " \"mm^2\"\n", + " ],\n", + " \"value\": \"\",\n", + " \"group_id\": 7,\n", + " \"position\": 1\n", " },\n", " \"Thickness\": {\n", " \"type\": \"number\",\n", @@ -172,9 +190,9 @@ " \"u.c.\",\n", " \"s\"\n", " ],\n", - " \"value\": \"4\",\n", + " \"value\": \"10\",\n", " \"group_id\": 4,\n", - " \"position\": 11\n", + " \"position\": 6\n", " },\n", " \"Buffer gas\": {\n", " \"type\": \"select\",\n", @@ -186,7 +204,7 @@ " \"\"\n", " ],\n", " \"group_id\": 4,\n", - " \"position\": 5\n", + " \"position\": 3\n", " },\n", " \"Duration PA\": {\n", " \"type\": \"number\",\n", @@ -198,14 +216,23 @@ " \"value\": \"\",\n", " \"group_id\": 6\n", " },\n", + " \"Duration Pre\": {\n", + " \"type\": \"number\",\n", + " \"unit\": \"s\",\n", + " \"units\": [\n", + " \"s\"\n", + " ],\n", + " \"value\": \"\",\n", + " \"group_id\": 8\n", + " },\n", " \"Laser System\": {\n", " \"type\": \"text\",\n", - " \"value\": \"excimer 1\",\n", + " \"value\": \"Excimer \",\n", " \"group_id\": 3\n", " },\n", " \"RHEED System\": {\n", " \"type\": \"text\",\n", - " \"value\": \"staib 2\",\n", + " \"value\": \"staib\",\n", " \"group_id\": 3\n", " },\n", " \"Buffer gas PA\": {\n", @@ -220,6 +247,18 @@ " \"group_id\": 6,\n", " \"position\": 3\n", " },\n", + " \"Buffer gas Pre\": {\n", + " \"type\": \"select\",\n", + " \"value\": \"O2\",\n", + " \"options\": [\n", + " \"O2\",\n", + " \"N2\",\n", + " \"Ar\",\n", + " \"\"\n", + " ],\n", + " \"group_id\": 8,\n", + " \"position\": 3\n", + " },\n", " \"Heating Method\": {\n", " \"type\": \"select\",\n", " \"value\": \"Radiative Heater\",\n", @@ -228,7 +267,7 @@ " \"Laser Heater\"\n", " ],\n", " \"group_id\": 4,\n", - " \"position\": 7\n", + " \"position\": 9\n", " },\n", " \"Laser Intensity\": {\n", " \"type\": \"number\",\n", @@ -237,8 +276,8 @@ " \"J/(s cm^2)\"\n", " ],\n", " \"value\": \"1.5\",\n", - " \"group_id\": 4,\n", - " \"position\": 8\n", + " \"group_id\": 7,\n", + " \"position\": 0\n", " },\n", " \"Repetition rate\": {\n", " \"type\": \"number\",\n", @@ -247,8 +286,8 @@ " \"Hz\"\n", " ],\n", " \"value\": \"1\",\n", - " \"group_id\": 4,\n", - " \"position\": 10\n", + " \"group_id\": 7,\n", + " \"position\": 4\n", " },\n", " \"Process pressure \": {\n", " \"type\": \"number\",\n", @@ -258,7 +297,7 @@ " ],\n", " \"value\": \"1e-3\",\n", " \"group_id\": 4,\n", - " \"position\": 6\n", + " \"position\": 4\n", " },\n", " \"Heater temperature \": {\n", " \"type\": \"number\",\n", @@ -266,9 +305,9 @@ " \"units\": [\n", " \"\\u00b0C\"\n", " ],\n", - " \"value\": \"650\",\n", + " \"value\": \"760\",\n", " \"group_id\": 4,\n", - " \"position\": 3\n", + " \"position\": 7\n", " },\n", " \"Process pressure PA\": {\n", " \"type\": \"number\",\n", @@ -280,6 +319,16 @@ " \"group_id\": 6,\n", " \"position\": 4\n", " },\n", + " \"Process pressure Pre\": {\n", + " \"type\": \"number\",\n", + " \"unit\": \"mbar\",\n", + " \"units\": [\n", + " \"mbar\"\n", + " ],\n", + " \"value\": \"\",\n", + " \"group_id\": 8,\n", + " \"position\": 4\n", + " },\n", " \"Heater temperature PA\": {\n", " \"type\": \"number\",\n", " \"unit\": \"\\u00b0C\",\n", @@ -289,15 +338,45 @@ " \"value\": \"\",\n", " \"group_id\": 6\n", " },\n", + " \"Laser Rastering Speed\": {\n", + " \"type\": \"number\",\n", + " \"unit\": \"\",\n", + " \"units\": [],\n", + " \"value\": \"\",\n", + " \"group_id\": 7,\n", + " \"position\": 3\n", + " },\n", + " \"Heater temperature Pre\": {\n", + " \"type\": \"number\",\n", + " \"unit\": \"\\u00b0C\",\n", + " \"units\": [\n", + " \"\\u00b0C\"\n", + " ],\n", + " \"value\": \"\",\n", + " \"group_id\": 8\n", + " },\n", " \"Heater-target distance\": {\n", " \"type\": \"number\",\n", " \"unit\": \"mm\",\n", " \"units\": [\n", " \"mm\"\n", " ],\n", - " \"value\": \"4\",\n", + " \"value\": \"38\",\n", " \"group_id\": 4,\n", - " \"position\": 4\n", + " \"position\": 8\n", + " },\n", + " \"Laser Rastering Geometry\": {\n", + " \"type\": \"select\",\n", + " \"value\": \"none\",\n", + " \"options\": [\n", + " \"none\",\n", + " \"on a square\",\n", + " \"on a rectangle\",\n", + " \"on a line\",\n", + " \"other\"\n", + " ],\n", + " \"group_id\": 7,\n", + " \"position\": 2\n", " },\n", " \"Layer Progressive Number\": {\n", " \"type\": \"number\",\n", @@ -310,7 +389,7 @@ " }\n", " }\n", " },\n", - " \"modified_at\": \"2026-01-07 13:24:45\",\n", + " \"modified_at\": \"2026-01-20 16:17:59\",\n", " \"next_step\": \"add process data\",\n", " \"orcid\": \"0000-0003-4231-9776\",\n", " \"page\": \"experiments\",\n", @@ -318,8 +397,8 @@ " \"recent_comment\": null,\n", " \"related_experiments_links\": [\n", " {\n", - " \"entityid\": 43,\n", - " \"title\": \"NEW PLD Deposition Layer I\",\n", + " \"entityid\": 46,\n", + " \"title\": \"Na-26-001 deposition test II\",\n", " \"custom_id\": null,\n", " \"link_state\": 1,\n", " \"page\": \"experiments.php\",\n", @@ -331,15 +410,15 @@ " }\n", " ],\n", " \"related_items_links\": [],\n", - " \"sharelink\": \"https://elabftw.fisica.unina.it:8080/experiments.php?mode=view&id=41\",\n", + " \"sharelink\": \"https://elabftw.fisica.unina.it:8080/experiments.php?mode=view&id=45\",\n", " \"state\": 1,\n", - " \"status\": 1,\n", - " \"status_color\": \"29AEB9\",\n", - " \"status_title\": \"Running\",\n", + " \"status\": null,\n", + " \"status_color\": null,\n", + " \"status_title\": null,\n", " \"steps\": [\n", " {\n", - " \"id\": 23,\n", - " \"item_id\": 41,\n", + " \"id\": 35,\n", + " \"item_id\": 45,\n", " \"body\": \"add process data\",\n", " \"ordering\": 1,\n", " \"finished\": 0,\n", @@ -348,8 +427,8 @@ " \"deadline_notif\": 0\n", " },\n", " {\n", - " \"id\": 24,\n", - " \"item_id\": 41,\n", + " \"id\": 36,\n", + " \"item_id\": 45,\n", " \"body\": \"add RHEED data\",\n", " \"ordering\": 2,\n", " \"finished\": 0,\n", @@ -358,8 +437,8 @@ " \"deadline_notif\": 0\n", " },\n", " {\n", - " \"id\": 25,\n", - " \"item_id\": 41,\n", + " \"id\": 37,\n", + " \"item_id\": 45,\n", " \"body\": \"add RHEED images\",\n", " \"ordering\": 3,\n", " \"finished\": 0,\n", @@ -375,7 +454,7 @@ " \"timestamped\": 0,\n", " \"timestamped_at\": null,\n", " \"timestampedby\": null,\n", - " \"title\": \"NEW PLD Deposition Layer\",\n", + " \"title\": \"Na-26-001 deposition test I\",\n", " \"type\": \"experiments\",\n", " \"uploads\": [],\n", " \"userid\": 2\n", @@ -386,7 +465,7 @@ "source": [ "import json\n", "\n", - "with open(\"../tests/objects/experiment_41_elab.json\", \"r\") as f:\n", + "with open(\"../tests/objects/experiment_45_elab.json\", \"r\") as f:\n", " x = json.load(f)\n", " print(json.dumps(x,indent=2))\n", " f.close()" @@ -415,15 +494,15 @@ "{\n", " \"instrument\": {\n", " \"deposition_chamber\": 72,\n", - " \"laser_system\": \"excimer 1\",\n", - " \"rheed_system\": \"staib 2\"\n", + " \"laser_system\": \"Excimer \",\n", + " \"rheed_system\": \"staib\"\n", " },\n", " \"multilayer\": {\n", " \"layer_1\": {\n", " \"operator\": \"Emiliano Di Gennaro\",\n", " \"sample\": 855,\n", - " \"temperature\": \"650\",\n", - " \"target\": 466\n", + " \"temperature\": \"760\",\n", + " \"target\": 854\n", " }\n", " }\n", "}\n" @@ -431,7 +510,7 @@ } ], "source": [ - "with open(\"../tests/objects/experiment_41_elab.json\", \"r\") as f:\n", + "with open(\"../tests/objects/experiment_45_elab.json\", \"r\") as f:\n", " rawdata = json.load(f)\n", " extra = rawdata[\"metadata_decoded\"][\"extra_fields\"]\n", " ordered = {\n", @@ -483,8 +562,8 @@ "{\n", " \"instrument\": {\n", " \"deposition_chamber\": 72,\n", - " \"laser_system\": \"excimer 1\",\n", - " \"rheed_system\": \"staib 2\"\n", + " \"laser_system\": \"Excimer \",\n", + " \"rheed_system\": \"staib\"\n", " },\n", " \"multilayer\": {\n", " \"layer_1\": {\n", @@ -501,13 +580,13 @@ " \"units\": [\n", " \"\\u00b0C\"\n", " ],\n", - " \"value\": \"650\",\n", + " \"value\": \"760\",\n", " \"group_id\": 4,\n", - " \"position\": 3\n", + " \"position\": 7\n", " },\n", " \"target\": {\n", " \"type\": \"items\",\n", - " \"value\": 466,\n", + " \"value\": 854,\n", " \"group_id\": 4,\n", " \"position\": 2,\n", " \"required\": true\n", @@ -519,7 +598,7 @@ } ], "source": [ - "with open(\"../tests/objects/experiment_41_elab.json\", \"r\") as f:\n", + "with open(\"../tests/objects/experiment_45_elab.json\", \"r\") as f:\n", " rawdata = json.load(f)\n", " extra = rawdata[\"metadata_decoded\"][\"extra_fields\"]\n", " layers = {\n", @@ -585,13 +664,13 @@ " \"units\": [\n", " \"\\u00b0C\"\n", " ],\n", - " \"value\": \"550\",\n", + " \"value\": \"500\",\n", " \"group_id\": 4,\n", - " \"position\": 3\n", + " \"position\": 7\n", " },\n", " \"target\": {\n", " \"type\": \"items\",\n", - " \"value\": 858,\n", + " \"value\": 466,\n", " \"group_id\": 4,\n", " \"position\": 2,\n", " \"required\": true\n", @@ -612,13 +691,13 @@ " \"units\": [\n", " \"\\u00b0C\"\n", " ],\n", - " \"value\": \"650\",\n", + " \"value\": \"760\",\n", " \"group_id\": 4,\n", - " \"position\": 3\n", + " \"position\": 7\n", " },\n", " \"target\": {\n", " \"type\": \"items\",\n", - " \"value\": 466,\n", + " \"value\": 854,\n", " \"group_id\": 4,\n", " \"position\": 2,\n", " \"required\": true\n", @@ -629,7 +708,7 @@ } ], "source": [ - "with open(\"../tests/objects/experiment_41_elab.json\", \"r\") as L01file, open(\"../tests/objects/experiment_43_elab.json\", \"r\") as L02file:\n", + "with open(\"../tests/objects/experiment_45_elab.json\", \"r\") as L01file, open(\"../tests/objects/experiment_46_elab.json\", \"r\") as L02file:\n", " raw01 = json.load(L01file)\n", " raw02 = json.load(L02file)\n", " layer_list = [raw01, raw02]\n", @@ -683,8 +762,8 @@ "name": "stdout", "output_type": "stream", "text": [ - "../tests/objects/experiment_41_elab.json\n", - "../tests/objects/experiment_43_elab.json\n" + "../tests/objects/experiment_46_elab.json\n", + "../tests/objects/experiment_45_elab.json\n" ] } ], @@ -732,7 +811,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "{855: {'instrument': {'deposition_chamber': 72, 'laser_system': 'excimer 1', 'rheed_system': 'staib 2'}, 'multilayer': {'layer_1': {'operator': 'Emiliano Di Gennaro', 'created_at': '2026-01-07 13:22:35', 'sample': {'type': 'items', 'value': 855, 'group_id': 4, 'position': 0}, 'temperature': {'type': 'number', 'unit': '°C', 'units': ['°C'], 'value': '650', 'group_id': 4, 'position': 3}, 'target': {'type': 'items', 'value': 466, 'group_id': 4, 'position': 2, 'required': True}}, 'layer_2': {'operator': 'Emiliano Di Gennaro', 'created_at': '2026-01-16 16:24:55', 'sample': {'type': 'items', 'value': 855, 'group_id': 4, 'position': 0}, 'temperature': {'type': 'number', 'unit': '°C', 'units': ['°C'], 'value': '550', 'group_id': 4, 'position': 3}, 'target': {'type': 'items', 'value': 858, 'group_id': 4, 'position': 2, 'required': True}}}}}\n" + "{855: {'instrument': {'deposition_chamber': 72, 'laser_system': 'Excimer ', 'rheed_system': 'staib'}, 'multilayer': {'layer_2': {'operator': 'Emiliano Di Gennaro', 'created_at': '2026-01-20 16:18:48', 'sample': {'type': 'items', 'value': 855, 'group_id': 4, 'position': 0}, 'temperature': {'type': 'number', 'unit': '°C', 'units': ['°C'], 'value': '500', 'group_id': 4, 'position': 7}, 'target': {'type': 'items', 'value': 466, 'group_id': 4, 'position': 2, 'required': True}}, 'layer_1': {'operator': 'Emiliano Di Gennaro', 'created_at': '2026-01-20 16:11:32', 'sample': {'type': 'items', 'value': 855, 'group_id': 4, 'position': 0}, 'temperature': {'type': 'number', 'unit': '°C', 'units': ['°C'], 'value': '760', 'group_id': 4, 'position': 7}, 'target': {'type': 'items', 'value': 854, 'group_id': 4, 'position': 2, 'required': True}}}}}\n" ] } ], @@ -806,8 +885,104 @@ "metadata": {}, "source": [ "### Names not ID's\n", - "> TO-DO: Replace ID's of eLabFTW items with their actual names (might need a working API key)." + "> TO-DO: Replace ID's of eLabFTW items with their actual names (might need a working API key).\n", + "\n", + "Since eLab ID's are not relevant to this project we need factual information about the sample itself. For instance, we want to fetch its name, chemical formula and dimensions - all data present on the eLabFTW entry, obtainable on the *items* API endpoint using the eLab ID of the sample." ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "24793e2b-67bb-4e8b-9d93-7802d3af7fca", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Paste API key here: ········\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'access_key': None, 'available': 1, 'body': '', 'body_html': '', 'book_can_overlap': 1, 'book_cancel_minutes': 0, 'book_is_cancellable': 1, 'book_max_minutes': 0, 'book_max_slots': 0, 'book_users_can_in_past': 0, 'canbook': '{\"base\": 40, \"teams\": [], \"users\": [], \"teamgroups\": []}', 'canread': '{\"base\": 40, \"teams\": [], \"users\": [], \"teamgroups\": []}', 'canread_is_immutable': 0, 'canwrite': '{\"base\": 30, \"teams\": [], \"users\": [], \"teamgroups\": []}', 'canwrite_is_immutable': 0, 'category': 19, 'category_color': '29aeb9', 'category_title': 'NEW_Sample', 'comments': [], 'compounds': [], 'containers': [], 'content_type': 1, 'created_at': '2026-01-07 13:20:02', 'custom_id': None, 'date': '2026-01-07', 'elabid': '20260107-e83642d2b806e5db5ebb0d6309d874f4b4461114', 'events_start': None, 'events_start_itemid': None, 'exclusive_edit_mode': None, 'experiments_links': [], 'firstname': 'Emiliano', 'fullname': 'Emiliano Di Gennaro', 'id': 855, 'is_bookable': 0, 'is_pinned': 0, 'is_procurable': 0, 'items_links': [{'entityid': 853, 'title': 'test_01', 'custom_id': None, 'elabid': '20260107-8a39f3d60b8422a878f14dbc5aa1956a6b939e07', 'link_state': 1, 'is_bookable': 0, 'page': 'database.php', 'type': 'items', 'category_title': 'NEW_Substrates batch', 'category_color': '29aeb9', 'status_title': 'Available', 'status_color': '6a7753'}, {'entityid': 180, 'title': 'NFFA -01', 'custom_id': None, 'elabid': '20240422-d90c61f98b5a368b877b3c7bcdc5448612037b0e', 'link_state': 1, 'is_bookable': 0, 'page': 'database.php', 'type': 'items', 'category_title': 'Proposal', 'category_color': 'cdab8f', 'status_title': None, 'status_color': None}, {'entityid': 826, 'title': 'CART - 6', 'custom_id': None, 'elabid': '20250415-b8c364bae6a2f74be82de1d9370c96d6b031c4d4', 'link_state': 1, 'is_bookable': 0, 'page': 'database.php', 'type': 'items', 'category_title': 'Sample Position', 'category_color': '26a269', 'status_title': None, 'status_color': None}], 'lastchangeby': 11, 'lastname': 'Di Gennaro', 'locked': 0, 'locked_at': None, 'lockedby': None, 'metadata': '{\"extra_fields\": {\"Owner\": {\"type\": \"users\", \"value\": 2, \"position\": 1, \"required\": true}, \"STD-ID\": {\"type\": \"number\", \"unit\": \"\", \"units\": [], \"value\": \"26001\", \"position\": 0, \"required\": true, \"description\": \"This is an internal ID identifier\"}, \"Position\": {\"type\": \"items\", \"value\": 826, \"position\": 4}, \"Proposal\": {\"type\": \"items\", \"value\": 180, \"position\": 5}, \"Subtrate batch\": {\"type\": \"items\", \"value\": 853, \"position\": 2}, \"Substrate Holder\": {\"type\": \"text\", \"value\": \"1\", \"position\": 3}}}', 'metadata_decoded': {'extra_fields': {'Owner': {'type': 'users', 'value': 2, 'position': 1, 'required': True}, 'STD-ID': {'type': 'number', 'unit': '', 'units': [], 'value': '26001', 'position': 0, 'required': True, 'description': 'This is an internal ID identifier'}, 'Position': {'type': 'items', 'value': 826, 'position': 4}, 'Proposal': {'type': 'items', 'value': 180, 'position': 5}, 'Subtrate batch': {'type': 'items', 'value': 853, 'position': 2}, 'Substrate Holder': {'type': 'text', 'value': '1', 'position': 3}}}, 'modified_at': '2026-01-21 22:04:27', 'next_step': None, 'orcid': '0000-0003-4231-9776', 'page': 'database', 'proc_currency': 0, 'proc_pack_qty': 0, 'proc_price_notax': '0.00', 'proc_price_tax': '0.00', 'rating': 0, 'recent_comment': None, 'related_experiments_links': [{'entityid': 41, 'title': 'NEW PLD Deposition Layer', 'custom_id': None, 'link_state': 1, 'page': 'experiments.php', 'type': 'experiments', 'category_title': 'Deposition', 'category_color': '8b8d43', 'status_title': 'Running', 'status_color': '29AEB9'}, {'entityid': 43, 'title': 'NEW PLD Deposition Layer I', 'custom_id': None, 'link_state': 1, 'page': 'experiments.php', 'type': 'experiments', 'category_title': 'Deposition', 'category_color': '8b8d43', 'status_title': None, 'status_color': None}, {'entityid': 45, 'title': 'Na-26-001 deposition test I', 'custom_id': None, 'link_state': 1, 'page': 'experiments.php', 'type': 'experiments', 'category_title': 'Deposition', 'category_color': '8b8d43', 'status_title': None, 'status_color': None}, {'entityid': 46, 'title': 'Na-26-001 deposition test II', 'custom_id': None, 'link_state': 1, 'page': 'experiments.php', 'type': 'experiments', 'category_title': 'Deposition', 'category_color': '8b8d43', 'status_title': None, 'status_color': None}], 'related_items_links': [], 'sharelink': 'https://elabftw.fisica.unina.it:8080/database.php?mode=view&id=855', 'state': 1, 'status': 1, 'status_color': '6a7753', 'status_title': 'Available', 'steps': [], 'tags': None, 'tags_id': None, 'team': 1, 'team_name': 'Default team', 'timestamped': 0, 'timestamped_at': None, 'timestampedby': None, 'title': 'Na-26-001', 'type': 'items', 'uploads': [], 'userid': 2}\n" + ] + } + ], + "source": [ + "import requests\n", + "from getpass import getpass # not to leak my key through jupyter + git\n", + "\n", + "def call_sample(API_KEY, elabid, API_URL=\"https://elabftw.fisica.unina.it/\"):\n", + " full_elab_url = f\"{API_URL}api/v2\" # API endpoint root for eLabFTW\n", + " items_url = f\"{full_elab_url}/items\" # API endpoint /items\n", + " header = {\n", + " \"Authorization\": API_KEY,\n", + " \"Content-Type\": \"application/json\"\n", + " }\n", + " sample = requests.get(\n", + " headers=header,\n", + " url=f\"{items_url}/{elabid}\",\n", + " verify=True\n", + " )\n", + " return sample.json()\n", + "\n", + "apikey = getpass(\"Paste API key here: \")\n", + "testing = call_sample(apikey, 855)\n", + "print(testing)" + ] + }, + { + "cell_type": "markdown", + "id": "89d89d7a-0e13-42c2-83ba-fb03d5a2c39b", + "metadata": {}, + "source": [ + "#### Filtering data\n", + "Now let's select only the useful data, which at the moment is just the name." + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "0ffa8e82-2d7e-4dae-9081-a776f1e5ba9f", + "metadata": {}, + "outputs": [ + { + "name": "stdin", + "output_type": "stream", + "text": [ + "Paste API key here: ········\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Na-26-001\n" + ] + } + ], + "source": [ + "resources_ids = [ i for i in sample_dict ]\n", + "first_sample = resources_ids[0]\n", + "\n", + "apikey = getpass(\"Paste API key here: \")\n", + "sample_data = call_sample(apikey, first_sample)\n", + "sample_title = sample_data[\"title\"]\n", + "print(sample_title)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "ba4f0459-8da0-494d-b0c2-23dae509538c", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { @@ -826,7 +1001,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.12" } }, "nbformat": 4,