source: TI01-discovery/tags/stable-TI01-ingestAutomation_Proglue_upgradesAndReporting/temp/OAIBatch/DatasetBasicParameters.py @ 5040

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/tags/stable-TI01-ingestAutomation_Proglue_upgradesAndReporting/temp/OAIBatch/DatasetBasicParameters.py@5040
Revision 5040, 1.3 KB checked in by sdonegan, 11 years ago (diff)

Debug new ingest classes - previous commit had problems with mdip records.

Line 
1#!/usr/bin/env python
2'''
3Class representing basic parameters extracted from the input file. 
4SJD Feb 24th 2009
5'''
6from DIF import DIF
7from MDIP import MDIP
8import os,sys, logging
9
10class DatasetBasicParameters:
11   
12    '''
13    Class representing extracted parameters from the input file
14    @param filename: Name of the original_document_file   
15    '''
16   
17    def __init__(self, filename,format):
18       
19        logging.info("Retrieving identifier for metadata record " + filename + " in format: " + format)
20        xml=file(filename).read()
21               
22        self._datacentre_format = format
23       
24        #If ingesting DIF
25        if self._datacentre_format == "DIF":
26            d=DIF(xml)
27            self.datasetID=d.entryID
28            self.datasetName = d.datasetTitle
29            self.datacentreName = d.datacentreName
30            self.metadataCreationDate=d.metadataCreationDate
31           
32        #If ingesting MDIP           
33        elif self._datacentre_format == "MDIP":
34            d=MDIP(xml)           
35            self.datasetID=d.id
36            self.datasetName = d.datasetTitle
37            self.datacentreName = d.datacentreName
38            self.metadataCreationDate=d.metadataCreationDate
39           
40        else:
41            raise TypeError, "Only handles DIF or MDIP here."
Note: See TracBrowser for help on using the repository browser.