Commit f7f0aa8a authored by Wei Shoulin's avatar Wei Shoulin
Browse files

add level0_id

parent bc9512e4
......@@ -29,7 +29,8 @@ class CalMergeApi(object):
''' fetch a record from database
:param kwargs: Parameter dictionary, key items support:
id : [int]
id : [int],
cal_id : [str]
:returns: csst_dfs_common.models.Result
'''
......@@ -40,6 +41,7 @@ class CalMergeApi(object):
:param kwargs: Parameter dictionary, key items support:
id : [int],
cal_id : [str],
status : [int]
:returns: csst_dfs_common.models.Result
......@@ -51,6 +53,7 @@ class CalMergeApi(object):
:param kwargs: Parameter dictionary, key items support:
id : [int],
cal_id : [str],
status : [int]
:returns: csst_dfs_common.models.Result
......@@ -61,15 +64,16 @@ class CalMergeApi(object):
''' insert a calibration merge record into database
:param kwargs: Parameter dictionary, key items support:
detector_no : [str]
ref_type : [str]
obs_time : [str]
exp_time : [float]
prc_status : [int]
prc_time : [str]
filename : [str]
file_path : [str]
level0_ids : [list]
cal_id : [str],
detector_no : [str],
ref_type : [str],
obs_time : [str],
exp_time : [float],
prc_status : [int],
prc_time : [str],
filename : [str],
file_path : [str],
level0_ids : [list],
:returns: csst_dfs_common.models.Result
'''
......
......@@ -13,7 +13,7 @@ class Level0DataApi(object):
''' retrieve level0 records from database
:param kwargs: Parameter dictionary, key items support:
obs_id: [int]
obs_id: [str]
detector_no: [str]
obs_type: [str]
obs_time : (start, end),
......@@ -30,7 +30,8 @@ class Level0DataApi(object):
''' fetch a record from database
:param kwargs: Parameter dictionary, key items support:
fits_id : [int]
id : [int],
level0_id: [str]
:returns: csst_dfs_common.models.Result
'''
......@@ -40,7 +41,8 @@ class Level0DataApi(object):
''' update the status of reduction
:param kwargs: Parameter dictionary, key items support:
fits_id : [int],
id : [int],
level0_id: [str],
status : [int]
:returns: csst_dfs_common.models.Result
......@@ -51,7 +53,8 @@ class Level0DataApi(object):
''' update the status of QC0
:param kwargs: Parameter dictionary, key items support:
fits_id : [int],
id : [int],
level0_id: [str],
status : [int]
:returns: csst_dfs_common.models.Result
......@@ -62,13 +65,13 @@ class Level0DataApi(object):
''' insert a level0 data record into database
:param kwargs: Parameter dictionary, key items support:
obs_id = [int]
detector_no = [str]
obs_type = [str]
obs_time = [str]
exp_time = [int]
detector_status_id = [int]
filename = [str]
obs_id = [str],
detector_no = [str],
obs_type = [str],
obs_time = [str],
exp_time = [int],
detector_status_id = [int],
filename = [str],
file_path = [str]
:returns: csst_dfs_common.models.Result
......
......@@ -13,7 +13,7 @@ class Level0PrcApi(object):
''' retrieve level0 procedure records from database
:param kwargs: Parameter dictionary, key items support:
level0_id: [int]
level0_id: [str]
pipeline_id: [str]
prc_module: [str]
prc_status : [int]
......@@ -37,13 +37,13 @@ class Level0PrcApi(object):
''' insert a level0 procedure record into database
:param kwargs: Parameter dictionary, key items support:
level0_id : [int]
level0_id : [str]
pipeline_id : [str]
prc_module : [str]
params_id : [str]
params_file_path : [str]
prc_status : [int]
prc_time : [str]
file_path : [str]
result_file_path : [str]
:returns: csst_dfs_common.models.Result
'''
......
......@@ -28,7 +28,8 @@ class ObservationApi(object):
''' fetch a record from database
:param kwargs: Parameter dictionary, key items support:
obs_id = [int]
id = [int],
obs_id = [str]
:returns: csst_dfs_common.models.Result
'''
......@@ -39,7 +40,8 @@ class ObservationApi(object):
''' update the status of reduction
:param kwargs: Parameter dictionary, key items support:
obs_id = [int],
id = [int],
obs_id = [str],
status = [int]
:returns: csst_dfs_common.models.Result
......@@ -50,7 +52,8 @@ class ObservationApi(object):
''' update the status of QC0
:param kwargs: Parameter dictionary, key items support:
obs_id = [int],
id = [int],
obs_id = [str],
status = [int]
:returns: csst_dfs_common.models.Result
......@@ -61,12 +64,13 @@ class ObservationApi(object):
''' insert a observational record into database
:param kwargs: Parameter dictionary, key items support:
obs_id = [int]
obs_time = [str]
exp_time = [float]
module_id = [str]
obs_type = [str]
facility_status_id = [int]
id = [int],
obs_id = [str],
obs_time = [str],
exp_time = [float],
module_id = [str],
obs_type = [str],
facility_status_id = [int],
module_status_id = [int]
:returns: csst_dfs_common.models.Result
......
......@@ -13,7 +13,7 @@ class Level1DataApi(object):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
raw_id: [int],
level0_id: [str],
data_type: [str],
obs_type: [str],
create_time : (start, end),
......@@ -63,7 +63,7 @@ class Level1DataApi(object):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
raw_id : [int]
level0_id : [str]
data_type : [str]
cor_sci_id : [int]
prc_params : [str]
......
......@@ -13,7 +13,7 @@ class Level1DataApi(object):
''' retrieve level1 records from database
:param kwargs: Parameter dictionary, key items support:
raw_id: [int]
level0_id: [str]
data_type: [str]
obs_type: [str]
create_time : (start, end),
......@@ -63,7 +63,7 @@ class Level1DataApi(object):
''' insert a level1 record into database
:param kwargs: Parameter dictionary, key items support:
raw_id : [int]
level0_id: [str]
data_type : [str]
cor_sci_id : [int]
prc_params : [str]
......
......@@ -3,17 +3,17 @@ from csst_dfs_api.facility.level0 import Level0DataApi
api = Level0DataApi()
# find
recs = api.find(obs_id = 17, obs_type = 'sci', limit = 0, prc_status = -1)
recs = api.find(obs_id = '17', obs_type = 'sci', limit = 0, prc_status = -1)
print('find:', recs)
# get
rec = api.get(fits_id = 100)
rec = api.get(level0_id = '100')
print('get:', rec)
# update_proc_status
rec = api.update_proc_status(fits_id = 100, status = 6)
rec = api.update_proc_status(level0_id = '100', status = 6)
print('update_proc_status:', rec)
# update_qc0_status
rec = api.update_qc0_status(fits_id = 100, status = 7)
rec = api.update_qc0_status(level0_id = '100', status = 7)
print('update_qc0_status:', rec)
......@@ -3,19 +3,20 @@ from csst_dfs_api.facility.level0prc import Level0PrcApi
api = Level0PrcApi()
#find
recs = api.find(level0_id=134)
recs = api.find(level0_id='134')
print('find:', recs)
#update_proc_status
rec = api.update_proc_status(id = 8, status = 4)
rec = api.update_proc_status(id = 2, status = 4)
print('update_proc_status:', rec)
#write
rec = api.write(level0_id=134,
rec = api.write(
level0_id='134',
pipeline_id = "P1",
prc_module = "QC0",
params_id = "/opt/dddasd.params",
params_file_path = "/opt/dddasd.params",
prc_status = 3,
prc_time = '2021-06-04 11:12:13',
file_path = "/opt/dddasd.header")
result_file_path = "/opt/dddasd.header")
print('write:', rec)
\ No newline at end of file
......@@ -8,14 +8,14 @@ recs = api.find(module_id="MSC",limit = 0, prc_status =-1)
print('find:', recs)
# get
rec = api.get(obs_id=17)
rec = api.get(obs_id='17')
print('get:', rec)
# update_proc_status
rec = api.update_proc_status(obs_id = 17, status = 3,)
rec = api.update_proc_status(obs_id = '17', status = 3,)
print('update_proc_status:', rec)
# update_qc0_status
rec = api.update_qc0_status(obs_id = 17, status = 3,)
rec = api.update_qc0_status(obs_id = '17', status = 3,)
print('update_qc0_status:', rec)
\ No newline at end of file
......@@ -17,7 +17,9 @@ class CalMergeApiTestCase(unittest.TestCase):
def test_get(self):
rec = self.api.get(id = 3)
print('get:', rec)
print('get by id:', rec)
rec = self.api.get(cal_id = '00002')
print('get by cal_id:', rec)
def test_update_proc_status(self):
rec = self.api.update_proc_status(id = 3, status = 1)
......@@ -28,13 +30,15 @@ class CalMergeApiTestCase(unittest.TestCase):
print('update_qc1_status:', rec)
def test_write(self):
rec = self.api.write(detector_no='CCD01',
rec = self.api.write(
cal_id = '00002',
detector_no = '01',
ref_type = "bias",
obs_time = "2021-06-04 11:12:13",
exp_time = 150,
filename = "/opt/dddasd.params",
file_path = "/opt/dddasd.fits",
filename = "/opt/dddasd1.params",
file_path = "/opt/dddasd1.fits",
prc_status = 3,
prc_time = '2021-06-04 11:12:13',
level0_ids = [1,2,3,4])
level0_ids = ['1','2','3','4'])
print('write:', rec)
\ No newline at end of file
......@@ -10,25 +10,29 @@ class Level0DataTestCase(unittest.TestCase):
self.api = Level0DataApi()
def test_find(self):
recs = self.api.find(obs_id = 9, obs_type = 'sci', limit = 0)
recs = self.api.find(obs_id = '000009', obs_type = 'sci', limit = 0)
print('find:', recs)
def test_get(self):
rec = self.api.get(fits_id = 100)
rec = self.api.get(id = 100)
print('get:', rec)
rec = self.api.get(level0_id = '000001102')
print('get:', rec)
def test_update_proc_status(self):
rec = self.api.update_proc_status(fits_id = 100, status = 6)
rec = self.api.update_proc_status(level0_id = '000001102', status = 6)
print('update_proc_status:', rec)
def test_update_qc0_status(self):
rec = self.api.update_qc0_status(fits_id = 100, status = 7)
rec = self.api.update_qc0_status(level0_id = '000001102', status = 7)
print('update_qc0_status:', rec)
def test_write(self):
rec = self.api.write(
obs_id = 13,
detector_no = "CCD01",
level0_id = '000001102',
obs_id = '0000011',
detector_no = "02",
obs_type = "sci",
obs_time = "2021-06-06 11:12:13",
exp_time = 150,
......
......@@ -10,7 +10,7 @@ class Level0PrcTestCase(unittest.TestCase):
self.api = Level0PrcApi()
def test_find(self):
recs = self.api.find(level0_id=134)
recs = self.api.find(level0_id='134')
print('find:', recs)
def test_update_proc_status(self):
......@@ -18,11 +18,12 @@ class Level0PrcTestCase(unittest.TestCase):
print('update_proc_status:', rec)
def test_write(self):
rec = self.api.write(level0_id=134,
rec = self.api.write(
level0_id='134',
pipeline_id = "P1",
prc_module = "QC0",
params_id = "/opt/dddasd.params",
params_file_path = "/opt/dddasd.params",
prc_status = 3,
prc_time = '2021-06-04 11:12:13',
file_path = "/opt/dddasd.header")
result_file_path = "/opt/dddasd.header")
print('write:', rec)
\ No newline at end of file
......@@ -14,23 +14,15 @@ class FacilityObservationTestCase(unittest.TestCase):
print('find:', recs)
def test_get(self):
rec = self.api.get(obs_id=17)
rec = self.api.get(id=17)
print('get:', rec)
rec = self.api.get(obs_id='0000017')
print('get:', rec)
def test_update_proc_status(self):
rec = self.api.update_proc_status(obs_id = 17, status = 3, )
rec = self.api.update_proc_status(obs_id='0000017', status = 3, )
print('update_proc_status:', rec)
def test_update_qc0_status(self):
rec = self.api.update_qc0_status(obs_id = 17, status = 3, )
rec = self.api.update_qc0_status(obs_id='0000017', status = 3, )
print('update_qc0_status:', rec)
# def test_write(self):
# rec = self.api.write(
# obs_time = "2021-06-06 11:12:13",
# exp_time = 150,
# module_id = "MSC",
# obs_type = "sci",
# facility_status_id = 3,
# module_status_id = 3)
# print('write:', rec)
\ No newline at end of file
......@@ -10,7 +10,8 @@ class IFSLevel1DataTestCase(unittest.TestCase):
self.api = Level1DataApi()
def test_find(self):
recs = self.api.find(raw_id=1,
recs = self.api.find(
level0_id='000001201',
create_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13"))
print('find:', recs)
......@@ -27,7 +28,8 @@ class IFSLevel1DataTestCase(unittest.TestCase):
print('update_qc1_status:', rec)
def test_write(self):
rec = self.api.write(raw_id=12,
rec = self.api.write(
level0_id='000001201',
data_type = "sci",
cor_sci_id = 2,
prc_params = "/opt/dddasd.params",
......
......@@ -10,7 +10,8 @@ class MSCLevel1DataTestCase(unittest.TestCase):
self.api = Level1DataApi()
def test_find(self):
recs = self.api.find(raw_id=1,
recs = self.api.find(
level0_id='000001201',
create_time = ("2021-06-01 11:12:13","2021-06-08 11:12:13"))
print('find:', recs)
......@@ -27,7 +28,8 @@ class MSCLevel1DataTestCase(unittest.TestCase):
print('update_qc1_status:', rec)
def test_write(self):
rec = self.api.write(raw_id=1,
rec = self.api.write(
level0_id='000001201',
data_type = "sci",
cor_sci_id = 1,
prc_params = "/opt/dddasd.params",
......@@ -36,7 +38,7 @@ class MSCLevel1DataTestCase(unittest.TestCase):
bias_id = 3,
prc_status = 3,
prc_time = '2021-06-04 11:12:13',
filename = "dddasd",
filename = "dddasdfff",
file_path = "/opt/dddasd.fits",
pipeline_id = "P1")
print('write:', rec)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment