NOMAD Plug-ins:�Custom Excel Parser
FAIRmat tutorial 9, April 26th 2023
Amir Golparvar
https://de.freepik.com/vektoren-kostenlos/illustration-des-datenextraktionskonzepts_12079896.htm#query=excel&position=38&from_view=search&track=robertav1_2_sidr
Content
FAIRmat
Excel as an ancient, yet super common data repository
FAIRmat tutorial 9, April 26th 2023
Amir Golparvar
Excel as an ancient, yet super common data repository
Excel, a widely used spreadsheet software, is shipped with some useful built-in capabilities like:
FAIRmat
…on Existing NOMAD Tabular-Parser
FAIRmat tutorial 9, April 26th 2023
Amir Golparvar
…on Existing NOMAD Tabular-Parser
NOMAD is shipped with a built-in tabular-parser to parse a given Excel/csv file which offers 4 modes of action:
parsing an entire column into a Quantity
parsing as many (sub)sections as there are rows in the excel sheet
parsing as many entries as there are rows in the excel sheet
parsing using both Column and Row modes
FAIRmat
Example: Column mode
definitions:
name: 'Tabular Parser example schema'
sections:
Tabular_Parser:
base_sections:
- nomad.parsing.tabular.TableData
quantities:
data_file:
default: datafile.xlsx
type: str
m_annotations:
tabular_parser:
comment: '#'
mode: column
My_Quantity:
type: str
shape: ['*']
m_annotations:
tabular:
name: My_Sheet/My_Column_1
data:
m_def: Tabular_Parser
data_file: datafile.xlsx
1
2
3
Excel File
Schema File
Parsed data
FAIRmat
…on Existing NOMAD Tabular-Parser
Find out more on tabular parser from documentations here:
Follow a tutorial on how to develop schemas using tabular parser here:
FAIRmat
Limitations of the Built-in Tabular Parser
FAIRmat tutorial 9, April 26th 2023
Amir Golparvar
Limitations of the Built-in Tabular Parser
Z | Sym | Element | Origin of name | Heat |
J/g·K | ||||
1 | H | Hydrogen | the Greek 'hydro' and 'genes' meaning water-forming | 14,304 |
2 | He | Helium | the Greek 'helios' meaning sun | 5,193 |
3 | Li | Lithium | the Greek 'lithos' meaning stone | 3,582 |
4 | Be | Beryllium | the Greek name for beryl, 'beryllo' | 1,825 |
5 | B | Boron | the Arabic 'buraq', which was the name for borax | 1,026 |
quantities:
Atomic_Number:
type: str
shape: ['*']
m_annotations:
tabular:
name: Z
Element_Symbol:
type: str
shape: ['*']
m_annotations:
tabular:
name: Sym
Element_Name:
type: str
shape: ['*']
m_annotations:
tabular:
name: Element
1
Excel File
2
Schema File
FAIRmat
Limitations of the Built-in Tabular Parser
A | B | C | D | |
Device ID | MK-1089-2009-02-02 | | | 1 |
Measurement Date | 20-04-2023 | | | 2 |
User Info | John Doe | | | 3 |
Data | 0 | 2 | 0.05 | 4 |
More Data | test_0 | | | 5 |
| test_1 | | | 6 |
| test_2 | | | 7 |
FAIRmat
New Plugin: My-Lab-Excel-Parser
Excel-Parser-Example
│
│──excelparser
│ ├── __init__.py
│ ├── nomad_plugin.yaml
│ └── parser.py
│──tests
│ ├── data
│ | └── test.my-lab-excel-file.xlsx
│ └── test-parser.py
│── LICENSE
│── README.md
│── nomad.yaml
└── requirements.txt*
plugin_type: parser
name: parsers/excel_parser
description: |
This is a simple excel parser.
mainfile_name_re: ^.*\.my-lab-excel-file\.xlsx$
mainfile_mime_re: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
parser_class_name: excelparser.MyLabExcelParser
code_name: Example code
(1)
Plugin Folder Structure
(2)
nomad_plugin.yaml
!
FAIRmat
Demonstration
FAIRmat tutorial 9, April 26th 2023
Amir Golparvar
Thank you!
FAIRmat