@@ -73,13 +73,15 @@ def load(self):
7373 MenuItemHistogram ,
7474 MenuItemPeriodicTable ,
7575 MenuItemTerms ,
76+ MenuSizeEnum ,
7677 SearchQuantities ,
7778)
7879
7980schema = "pynxtools.nomad.schema.Root"
8081
82+
8183nexus_app = AppEntryPoint (
82- name = "NexusApp " ,
84+ name = "NeXus App " ,
8385 description = "Simple Generic NeXus app." ,
8486 app = App (
8587 # Label of the App
@@ -91,7 +93,7 @@ def load(self):
9193 # Brief description used in the app menu
9294 description = "A simple search app customized for generic NeXus data." ,
9395 # Longer description that can also use markdown
94- readme = "This is a simple App to support basic search for NeXus based Experiment Entries. " ,
96+ readme = "This page allows to search for generic NeXus Experiment Entries. It is similar to the entries search, but with reduced filter set, modified menu on the left and different shown columns. The dashboard directly shows useful interactive statistics about the data " ,
9597 # If you want to use quantities from a custom schema, you need to load
9698 # the search quantities from it first here. Note that you can use a glob
9799 # syntax to load the entire package, or just a single schema from a
@@ -101,98 +103,249 @@ def load(self):
101103 ),
102104 # Controls which columns are shown in the results table
103105 columns = [
104- Column (quantity = "entry_id" , selected = True ),
105- Column (quantity = f"entry_type" , selected = True ),
106+ Column (title = "Entry ID" , search_quantity = "entry_id" , selected = True ),
107+ Column (
108+ title = "File Name" ,
109+ search_quantity = f"mainfile" ,
110+ selected = True ,
111+ ),
112+ Column (
113+ title = "Start Time" ,
114+ search_quantity = f"data.ENTRY[*].start_time#{ schema } " ,
115+ selected = True ,
116+ ),
117+ Column (
118+ title = "Description" ,
119+ search_quantity = f"data.ENTRY[*].experiment_description__field#{ schema } " ,
120+ selected = True ,
121+ ),
106122 Column (
107- title = "definition " ,
108- quantity = f"data.ENTRY[*].definition__field #{ schema } " ,
123+ title = "Author " ,
124+ search_quantity = f"[ data.ENTRY[*].USER[*].name__field, data.ENTRY[*].userID[*].name__field] #{ schema } " ,
109125 selected = True ,
110126 ),
111127 Column (
112- title = "start_time " ,
113- quantity = f"data.ENTRY[*].start_time__field #{ schema } " ,
128+ title = "Sample " ,
129+ search_quantity = f"data.ENTRY[*].SAMPLE[*].name__field #{ schema } " ,
114130 selected = True ,
115131 ),
116132 Column (
117- title = "title" ,
118- quantity = f"data.ENTRY[*].title__field#{ schema } " ,
133+ title = "Sample ID" ,
134+ search_quantity = f"data.ENTRY[*].SAMPLE[*].sample_id__field#{ schema } " ,
135+ selected = False ,
136+ ),
137+ Column (
138+ title = "Definition" ,
139+ search_quantity = f"data.ENTRY[*].definition__field#{ schema } " ,
119140 selected = True ,
120141 ),
121142 ],
122143 # Dictionary of search filters that are always enabled for queries made
123144 # within this app. This is especially important to narrow down the
124- # results to the wanted subset. Any available search filter can be
125- # targeted here. This example makes sure that only entries that use
126- # MySchema are included.
145+ # results to the wanted subset.
127146 filters_locked = {"section_defs.definition_qualified_name" : [schema ]},
128147 # Controls the menu shown on the left
129148 menu = Menu (
130- title = "Material" ,
149+ size = MenuSizeEnum .MD ,
150+ title = "Menu" ,
131151 items = [
132152 Menu (
133- title = "elements" ,
153+ title = "Elements" ,
154+ size = MenuSizeEnum .XXL ,
134155 items = [
135156 MenuItemPeriodicTable (
136- quantity = "results.material.elements" ,
157+ search_quantity = "results.material.elements" ,
158+ ),
159+ MenuItemTerms (
160+ search_quantity = "results.material.chemical_formula_hill" ,
161+ width = 6 ,
162+ options = 0 ,
137163 ),
138164 MenuItemTerms (
139- quantity = "results.material.chemical_formula_hill " ,
165+ search_quantity = "results.material.chemical_formula_iupac " ,
140166 width = 6 ,
141167 options = 0 ,
142168 ),
143169 MenuItemTerms (
144- quantity = "results.material.chemical_formula_iupac" ,
170+ search_quantity = "results.material.chemical_formula_reduced" ,
171+ width = 6 ,
172+ options = 0 ,
173+ ),
174+ MenuItemTerms (
175+ search_quantity = "results.material.chemical_formula_anonymous" ,
145176 width = 6 ,
146177 options = 0 ,
147178 ),
148179 MenuItemHistogram (
149180 x = "results.material.n_elements" ,
150181 ),
151182 ],
152- )
183+ ),
184+ Menu (
185+ title = "Experiment type" ,
186+ size = MenuSizeEnum .LG ,
187+ items = [
188+ MenuItemTerms (
189+ title = "Entry Type" ,
190+ search_quantity = f"entry_type" ,
191+ width = 12 ,
192+ options = 12 ,
193+ ),
194+ MenuItemTerms (
195+ title = "NeXus Class" ,
196+ search_quantity = f"data.ENTRY.definition__field#{ schema } " ,
197+ width = 12 ,
198+ options = 12 ,
199+ ),
200+ ],
201+ ),
202+ Menu (
203+ title = "Instruments" ,
204+ size = MenuSizeEnum .LG ,
205+ items = [
206+ MenuItemTerms (
207+ title = "Model" ,
208+ search_quantity = f"data.ENTRY.INSTRUMENT.name__field#{ schema } " ,
209+ width = 12 ,
210+ options = 12 ,
211+ ),
212+ MenuItemTerms (
213+ name = "Name" ,
214+ search_quantity = f"data.ENTRY.INSTRUMENT.name#{ schema } " ,
215+ width = 12 ,
216+ options = 12 ,
217+ ),
218+ ],
219+ ),
220+ Menu (
221+ title = "Samples" ,
222+ size = MenuSizeEnum .LG ,
223+ items = [
224+ MenuItemTerms (
225+ title = "Name" ,
226+ search_quantity = f"data.ENTRY.SAMPLE.name__field#{ schema } " ,
227+ width = 12 ,
228+ options = 12 ,
229+ ),
230+ MenuItemTerms (
231+ title = "Sample ID" ,
232+ search_quantity = f"data.ENTRY.SAMPLE.sample_id__field#{ schema } " ,
233+ width = 12 ,
234+ options = 12 ,
235+ ),
236+ ],
237+ ),
238+ Menu (
239+ title = "Authors / Origin" ,
240+ size = MenuSizeEnum .LG ,
241+ items = [
242+ MenuItemTerms (
243+ title = "Entry Author" ,
244+ search_quantity = f"data.ENTRY.USER.name__field#{ schema } " ,
245+ width = 12 ,
246+ options = 5 ,
247+ ),
248+ MenuItemTerms (
249+ title = "User ID / Entry Author" ,
250+ search_quantity = f"data.ENTRY.userID.name__field#{ schema } #str" ,
251+ width = 12 ,
252+ options = 5 ,
253+ ),
254+ MenuItemTerms (
255+ title = "Upload Author" ,
256+ search_quantity = f"authors.name" ,
257+ width = 12 ,
258+ options = 5 ,
259+ ),
260+ MenuItemTerms (
261+ title = "Affiliation" ,
262+ search_quantity = f"data.ENTRY.USER.affiliation__field#{ schema } " ,
263+ width = 12 ,
264+ options = 5 ,
265+ ),
266+ ],
267+ ),
268+ MenuItemHistogram (
269+ title = "Start Time" ,
270+ x = f"data.ENTRY.start_time#{ schema } " ,
271+ autorange = True ,
272+ ),
273+ MenuItemHistogram (
274+ title = "Upload Creation Time" ,
275+ x = f"upload_create_time" ,
276+ autorange = True ,
277+ ),
153278 ],
154279 ),
155280 # Controls the default dashboard shown in the search interface
156281 dashboard = {
157282 "widgets" : [
158283 {
159- "type" : "histogram" ,
160- "show_input" : False ,
161- "autorange" : True ,
162- "nbins" : 30 ,
284+ "type" : "periodic_table" ,
163285 "scale" : "linear" ,
164- "quantity" : f"data.ENTRY.start_time__field#{ schema } " ,
165- "title" : "Start Time" ,
286+ "quantity" : f"results.material.elements" ,
166287 "layout" : {
167- "lg" : {"minH" : 3 , "minW" : 3 , "h" : 4 , "w" : 12 , "y" : 0 , "x" : 0 }
288+ "sm" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 8 , "y" : 0 , "x" : 0 },
289+ "md" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 12 , "y" : 0 , "x" : 0 },
290+ "lg" : {"minH" : 3 , "minW" : 3 , "h" : 10 , "w" : 14 , "y" : 0 , "x" : 0 },
291+ "xl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 10 , "y" : 0 , "x" : 0 },
292+ "xxl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 10 , "y" : 0 , "x" : 0 },
168293 },
169294 },
170295 {
171296 "type" : "terms" ,
172- "show_input" : False ,
297+ "show_input" : True ,
173298 "scale" : "linear" ,
174299 "quantity" : f"entry_type" ,
175300 "title" : "Entry Type" ,
176301 "layout" : {
177- "lg" : {"minH" : 3 , "minW" : 3 , "h" : 8 , "w" : 4 , "y" : 0 , "x" : 12 }
302+ "sm" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 4 , "y" : 0 , "x" : 8 },
303+ "md" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 6 , "y" : 0 , "x" : 12 },
304+ "lg" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 5 , "y" : 0 , "x" : 14 },
305+ "xl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 10 },
306+ "xxl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 10 },
178307 },
179308 },
180309 {
181310 "type" : "terms" ,
182- "show_input" : False ,
311+ "show_input" : True ,
183312 "scale" : "linear" ,
184313 "quantity" : f"data.ENTRY.definition__field#{ schema } " ,
185- "title" : "Definition " ,
314+ "title" : "NeXus Class " ,
186315 "layout" : {
187- "lg" : {"minH" : 3 , "minW" : 3 , "h" : 8 , "w" : 4 , "y" : 0 , "x" : 16 }
316+ "sm" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 4 , "y" : 5 , "x" : 0 },
317+ "md" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 6 , "y" : 7 , "x" : 0 },
318+ "lg" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 5 , "y" : 0 , "x" : 19 },
319+ "xl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 14 },
320+ "xxl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 14 },
188321 },
189322 },
190323 {
191- "type" : "periodic_table" ,
324+ "type" : "terms" ,
325+ "show_input" : True ,
192326 "scale" : "linear" ,
193- "quantity" : f"results.material.elements" ,
327+ "quantity" : f"data.ENTRY.USER.name__field#{ schema } " ,
328+ "title" : "Author" ,
329+ "layout" : {
330+ "sm" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 4 , "y" : 5 , "x" : 4 },
331+ "md" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 6 , "y" : 7 , "x" : 6 },
332+ "lg" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 5 , "y" : 5 , "x" : 14 },
333+ "xl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 18 },
334+ "xxl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 18 },
335+ },
336+ },
337+ {
338+ "type" : "terms" ,
339+ "show_input" : True ,
340+ "scale" : "linear" ,
341+ "quantity" : f"data.ENTRY.SAMPLE.name__field#{ schema } " ,
342+ "title" : "Sample" ,
194343 "layout" : {
195- "lg" : {"minH" : 3 , "minW" : 3 , "h" : 4 , "w" : 12 , "y" : 4 , "x" : 0 }
344+ "sm" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 4 , "y" : 5 , "x" : 8 },
345+ "md" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 6 , "y" : 7 , "x" : 12 },
346+ "lg" : {"minH" : 3 , "minW" : 3 , "h" : 5 , "w" : 5 , "y" : 5 , "x" : 19 },
347+ "xl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 22 },
348+ "xxl" : {"minH" : 3 , "minW" : 3 , "h" : 7 , "w" : 4 , "y" : 0 , "x" : 22 },
196349 },
197350 },
198351 ]
0 commit comments