Skip to content

Commit 7b7f24e

Browse files
committed
Update schema
1 parent 2bec8e4 commit 7b7f24e

File tree

1 file changed

+208
-0
lines changed

1 file changed

+208
-0
lines changed

static/service_schema.graphql

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
"""
2+
Changes that should be made to an instrument's configuration
3+
"""
4+
input ConfigurationUpdates {
5+
"""
6+
New template used to determine the root data directory
7+
"""
8+
directory: DirectoryTemplate
9+
"""
10+
New template used to determine the relative path to the main scan file for a collection
11+
"""
12+
scan: ScanTemplate
13+
"""
14+
New template used to determine the relative path for detector data files
15+
"""
16+
detector: DetectorTemplate
17+
"""
18+
The highest scan number to have been allocated. The next scan files generated will use the
19+
next number.
20+
"""
21+
scanNumber: Int
22+
"""
23+
The extension of the files used to track scan numbers by GDA's numtracker facility
24+
"""
25+
trackerFileExtension: String
26+
}
27+
28+
"""
29+
The current configuration for an instrument
30+
"""
31+
type CurrentConfiguration {
32+
"""
33+
The name of the instrument
34+
"""
35+
instrument: String!
36+
"""
37+
The template used to build the path to the data directory for an instrument
38+
"""
39+
directoryTemplate: String!
40+
"""
41+
The template used to build the path of a scan file for a data acquisition, relative to the
42+
root of the data directory.
43+
"""
44+
scanTemplate: String!
45+
"""
46+
The template used to build the path of a detector's data file for a data acquisition,
47+
relative to the root of the data directory.
48+
"""
49+
detectorTemplate: String!
50+
"""
51+
The latest scan number stored in the DB. This is the last scan number provided by this
52+
service but may not reflect the most recent scan number for an instrument if an external
53+
service (eg GDA) has incremented its own number tracker.
54+
"""
55+
dbScanNumber: Int!
56+
"""
57+
The highest matching number file for this instrument in the configured tracking directory.
58+
May be null if no directory is available for this instrument or if there are no matching
59+
number files.
60+
"""
61+
fileScanNumber: Int
62+
"""
63+
The file extension used for the file based tracking, eg using an extension of 'ext'
64+
would create files `1.ext`, `2.ext` etc
65+
"""
66+
trackerFileExtension: String
67+
}
68+
69+
scalar Detector
70+
71+
"""
72+
GraphQL type to mimic a key-value pair from the map type that GraphQL doesn't have
73+
"""
74+
type DetectorPath {
75+
"""
76+
The name of the detector that should use this path
77+
"""
78+
name: String!
79+
"""
80+
The path where the detector should write its data
81+
"""
82+
path: String!
83+
}
84+
85+
"""
86+
A template describing the location within a session data directory where the data for a given detector should be written
87+
88+
It should contain placeholders for {detector} and {scan_number} to ensure paths are unique between scans and for multiple detectors.
89+
"""
90+
scalar DetectorTemplate
91+
92+
"""
93+
The path to a data directory and the components used to build it
94+
"""
95+
type DirectoryPath {
96+
"""
97+
The instrument session for which this is the data directory
98+
"""
99+
instrumentSession: String!
100+
"""
101+
The instrument for which this is the data directory
102+
"""
103+
instrument: String!
104+
"""
105+
The absolute path to the data directory
106+
"""
107+
path: String!
108+
}
109+
110+
"""
111+
A template describing the path to the data directory for a given instrument session. It should be an absolute path and contain placeholders for {instrument} and {visit}.
112+
"""
113+
scalar DirectoryTemplate
114+
115+
"""
116+
Queries that modify the state of the numtracker configuration in some way
117+
"""
118+
type Mutation {
119+
"""
120+
Generate scan file locations for the next scan
121+
"""
122+
scan(instrument: String!, instrumentSession: String!, sub: Subdirectory): ScanPaths!
123+
"""
124+
Add or modify the stored configuration for an instrument
125+
"""
126+
configure(instrument: String!, config: ConfigurationUpdates!): CurrentConfiguration!
127+
registerTemplate(beamline: String!, template: TemplateInput!): NamedTemplate!
128+
}
129+
130+
type NamedTemplate {
131+
name: String!
132+
template: String!
133+
}
134+
135+
"""
136+
Queries relating to numtracker configurations that have no side-effects
137+
"""
138+
type Query {
139+
"""
140+
Get the data directory information for the given instrument and instrument session.
141+
This information is not scan specific
142+
"""
143+
paths(instrument: String!, instrumentSession: String!): DirectoryPath!
144+
"""
145+
Get the current configuration for the given instrument
146+
"""
147+
configuration(instrument: String!): CurrentConfiguration!
148+
"""
149+
Get the configurations for all available instruments
150+
Can be filtered to provide one or more specific instruments
151+
"""
152+
configurations(instrumentFilters: [String!]): [CurrentConfiguration!]!
153+
namedTemplates(beamline: String!, names: [String!]): [NamedTemplate!]!
154+
}
155+
156+
"""
157+
Paths and values related to a specific scan/data collection for an instrument
158+
"""
159+
type ScanPaths {
160+
"""
161+
The directory used to generate this scan information.
162+
"""
163+
directory: DirectoryPath!
164+
"""
165+
The root scan file for this scan. The path has no extension so that the format can be
166+
chosen by the client.
167+
"""
168+
scanFile: String!
169+
"""
170+
The scan number for this scan. This should be unique for the requested instrument.
171+
"""
172+
scanNumber: Int!
173+
template(name: String!): String!
174+
"""
175+
The paths where the given detectors should write their files.
176+
177+
Detector names are normalised before being used in file names by replacing any
178+
non-alphanumeric characters with '_'. If there are duplicate names in the list
179+
of detectors after this normalisation, there will be duplicate paths in the
180+
results.
181+
"""
182+
detectors(names: [Detector!]!): [DetectorPath!]!
183+
}
184+
185+
"""
186+
A template describing the location within a session data directory where the root scan file should be written. It should be a relative path and contain a placeholder for {scan_number} to ensure files are unique.
187+
"""
188+
scalar ScanTemplate
189+
190+
scalar Subdirectory
191+
192+
input TemplateInput {
193+
name: String!
194+
template: String!
195+
}
196+
197+
"""
198+
Directs the executor to include this field or fragment only when the `if` argument is true.
199+
"""
200+
directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
201+
"""
202+
Directs the executor to skip this field or fragment when the `if` argument is true.
203+
"""
204+
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
205+
schema {
206+
query: Query
207+
mutation: Mutation
208+
}

0 commit comments

Comments
 (0)