search.py 14.1 KB
Newer Older
ethiraj krishnamanaidu's avatar
ethiraj krishnamanaidu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Copyright 2021 Schlumberger
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Luc Yriarte's avatar
Luc Yriarte committed
15
16
17
18
19
20
21
from request_runner import RequestRunner, Request


def build_request_search_logs_by_logset_id() -> RequestRunner:
    rq_proto = Request(
        name='search logs by logset id',
        method='POST',
22
        url='{{base_url}}/ddms/{{search_query_type}}/logset/{{search_logset_id}}/logs',
Luc Yriarte's avatar
Luc Yriarte committed
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


def build_request_search_markers_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search markers by wellbore id',
        method='POST',
38
        url='{{base_url}}/ddms/{{search_query_type}}/wellbore/{{search_wellbore_id}}/markers',
Luc Yriarte's avatar
Luc Yriarte committed
39
40
41
42
43
44
45
46
47
48
49
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


50
51
52
53
def build_request_search_markersets_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search markersets by wellbore id',
        method='POST',
fabian serin's avatar
fabian serin committed
54
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbores/{{setup_search_osdu_wellbore_id}}/wellboremarkersets',
55
56
57
58
59
60
61
62
63
64
65
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


Luc Yriarte's avatar
Luc Yriarte committed
66
67
68
69
def build_request_search_wellbores_by_geo_polygon() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by geo polygon',
        method='POST',
70
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores/bygeopolygon',
Luc Yriarte's avatar
Luc Yriarte committed
71
72
73
74
75
76
77
78
79
80
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload=r"""
        {
            "points": [
                   {
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
                        "latitude": -21,
                        "longitude": 70
                    },
                    {
                        "latitude": -20,
                        "longitude": 65
                    },
                    {
                        "latitude": -22,
                        "longitude": 70
                    }
              ],
               "query": {
                         "query": ""
                        }
           }
                """
    )
    return RequestRunner(rq_proto)


def build_request_search_osdu_wellbores_by_geo_polygon() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by geo polygon',
        method='POST',
fabian serin's avatar
fabian serin committed
106
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbores/bygeopolygon',
107
108
109
110
111
112
113
114
115
116
117
118
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload=r"""
        {
            "points": [
                   {
                        "latitude": -20,
                        "longitude": 71
Luc Yriarte's avatar
Luc Yriarte committed
119
120
                    },
                    {
121
122
                        "latitude": -22,
                        "longitude": 71
Luc Yriarte's avatar
Luc Yriarte committed
123
124
                    },
                    {
125
126
                        "latitude": -22,
                        "longitude": 73
Luc Yriarte's avatar
Luc Yriarte committed
127
                    }
128
129
130
131
132
,
                    {
                        "latitude": -20,
                        "longitude": 71
                    }                    
Luc Yriarte's avatar
Luc Yriarte committed
133
134
135
136
137
138
139
140
141
142
143
144
145
146
              ],
               "query": {
                         "query": ""
                        }
           }
                """
    )
    return RequestRunner(rq_proto)


def build_request_search_logs_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search logs by wellbore id',
        method='POST',
147
        url='{{base_url}}/ddms/{{search_query_type}}/wellbore/{{search_wellbore_id}}/logs',
Luc Yriarte's avatar
Luc Yriarte committed
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


def build_request_search_logset_by_wellbores_attribute() -> RequestRunner:
    rq_proto = Request(
        name='search logset by wellbores attribute',
        method='POST',
163
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores/data.state:"North Dakota"/logsets',
Luc Yriarte's avatar
Luc Yriarte committed
164
165
166
167
168
169
170
171
172
173
174
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


175
176
177
178
def build_request_search_welllogs_by_wellbores_attribute() -> RequestRunner:
    rq_proto = Request(
        name='search logset by wellbores attribute',
        method='POST',
fabian serin's avatar
fabian serin committed
179
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbore/data.DefaultVerticalMeasurementID:"KB"/welllogs',
180
181
182
183
184
185
186
187
188
189
190
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


Luc Yriarte's avatar
Luc Yriarte committed
191
192
193
194
def build_request_search_logs_by_wellbores_attribute() -> RequestRunner:
    rq_proto = Request(
        name='search logs by wellbores attribute',
        method='POST',
195
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores/data.state:"North Dakota"/logs',
Luc Yriarte's avatar
Luc Yriarte committed
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


def build_request_search_wellbores_by_bounding_box() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by bounding box',
        method='POST',
211
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores/byboundingbox?latitude_top_left=48&longitude_top_left=-104&latitude_bottom_right=45&longitude_bottom_right=-101',
Luc Yriarte's avatar
Luc Yriarte committed
212
213
214
215
216
217
218
219
220
221
222
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


223
224
225
226
def build_request_search_osdu_wellbores_by_bounding_box() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by bounding box',
        method='POST',
fabian serin's avatar
fabian serin committed
227
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbores/byboundingbox?latitude_top_left=-20&longitude_top_left=71&latitude_bottom_right=-22&longitude_bottom_right=73',
228
229
230
231
232
233
234
235
236
237
238
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


Luc Yriarte's avatar
Luc Yriarte committed
239
240
241
242
def build_request_search_wellbores_by_distance() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by distance',
        method='POST',
243
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores/bydistance?latitude=46.8&longitude=-103.2&distance=15000',
Luc Yriarte's avatar
Luc Yriarte committed
244
245
246
247
248
249
250
251
252
253
254
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


255
256
257
258
def build_request_search_osdu_wellbores_by_distance() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores by distance',
        method='POST',
fabian serin's avatar
fabian serin committed
259
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbores/bydistance?latitude=-21.5399&longitude=72.4635&distance=100',
260
261
262
263
264
265
266
267
268
269
270
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


Luc Yriarte's avatar
Luc Yriarte committed
271
272
273
274
def build_request_search_logs_by_logsets_attribute() -> RequestRunner:
    rq_proto = Request(
        name='search logs by logsets attribute',
        method='POST',
275
        url='{{base_url}}/ddms/{{search_query_type}}/logsets/data.classification:"Quad-Combo"/logs',
Luc Yriarte's avatar
Luc Yriarte committed
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


def build_request_search_logset_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search logset by wellbore id',
        method='POST',
291
        url='{{base_url}}/ddms/{{search_query_type}}/wellbore/{{search_wellbore_id}}/logsets',
Luc Yriarte's avatar
Luc Yriarte committed
292
293
294
295
296
297
298
299
300
301
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)

302

303
304
305
306
def build_request_search_welllogs_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search logset by wellbore id',
        method='POST',
fabian serin's avatar
fabian serin committed
307
        url='{{base_url}}/ddms/v3/{{search_query_type}}/wellbores/{{setup_search_osdu_wellbore_id}}/welllogs',
308
309
310
311
312
313
314
315
316
317
318
319
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)



320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
def build_request_search_wellbores() -> RequestRunner:
    rq_proto = Request(
        name='search wellbores',
        method='POST',
        url='{{base_url}}/ddms/{{search_query_type}}/wellbores',
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
    return RequestRunner(rq_proto)


def build_request_search_logs() -> RequestRunner:
    rq_proto = Request(
        name='search logs',
        method='POST',
        url='{{base_url}}/ddms/{{search_query_type}}/logs',
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{ "query": "" }'
    )
fabian serin's avatar
fabian serin committed
349
350
351
352
353
354
355
    return RequestRunner(rq_proto)


def build_request_search_wellbore_by_name() -> RequestRunner:
    rq_proto = Request(
        name='search wellbore by name',
        method='POST',
356
        url='{{base_url}}/alpha/ddms/v3/{{search_query_type}}/wellbores/byname?names=wdms_e2e_search_refs_v%2A',
fabian serin's avatar
fabian serin committed
357
358
359
360
361
362
363
364
365
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{}'
    )
    return RequestRunner(rq_proto)
fabian serin's avatar
fabian serin committed
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381


def build_request_search_trajectory_by_wellbore_id() -> RequestRunner:
    rq_proto = Request(
        name='search wellbore by name',
        method='POST',
        url='{{base_url}}/alpha/ddms/v3/{{search_query_type}}/wellbores/{{setup_search_osdu_wellbore_id}}/wellboretrajectories',
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{}'
    )
    return RequestRunner(rq_proto)
fabian serin's avatar
fabian serin committed
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415


def build_request_search_welllog_by_name() -> RequestRunner:
    rq_proto = Request(
        name='search wellbore by name',
        method='POST',
        url='{{base_url}}/alpha/ddms/v3/{{search_query_type}}/welllogs/byname?names=wdms_e2e_search_record_%2A',
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{}'
    )
    return RequestRunner(rq_proto)



def build_request_search_welllog_by_name_and_wellbore() -> RequestRunner:
    rq_proto = Request(
        name='search wellbore by name',
        method='POST',
        url='{{base_url}}/alpha/ddms/v3/{{search_query_type}}/welllogs/byname?names=wdms_e2e_search_record_%2A'
            '&wellbore_id={{setup_search_osdu_wellbore_id}}',
        headers={
            'accept': 'application/json',
            'data-partition-id': '{{data_partition}}',
            'Connection': '{{header_connection}}',
            'Authorization': 'Bearer {{token}}',
        },
        payload='{}'
    )
    return RequestRunner(rq_proto)