<s> from girder . api import access <EOL> from girder . api . describe import Description <EOL> from girder . api . rest import loadmodel , RestException <EOL> from girder . constants import AccessType <EOL> from girder . plugins . minerva . rest . dataset import Dataset <EOL> from girder . plugins . minerva . utility . minerva_utility import findDatasetFolder , updateMinervaMetadata <EOL> class GeojsonDataset ( Dataset ) : <EOL> def __init__ ( self ) : <EOL> self . resourceName = '<STR_LIT>' <EOL> self . route ( '<STR_LIT:POST>' , ( ) , self . createGeojsonDataset ) <EOL> @ access . user <EOL> @ loadmodel ( map = { '<STR_LIT>' : '<STR_LIT>' } , model = '<STR_LIT>' , <EOL> level = AccessType . WRITE ) <EOL> def createGeojsonDataset ( self , item , params ) : <EOL> user = self . getCurrentUser ( ) <EOL> folder = findDatasetFolder ( user , user , create = True ) <EOL> if folder is None : <EOL> raise RestException ( '<STR_LIT>' ) <EOL> if folder [ '<STR_LIT>' ] != item [ '<STR_LIT>' ] : <EOL> raise RestException ( "<STR_LIT>" + <EOL> "<STR_LIT>" ) <EOL> minerva_metadata = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> for file in self . model ( '<STR_LIT>' ) . childFiles ( item = item , limit = <NUM_LIT:0> ) : <EOL> if '<STR_LIT>' in file [ '<STR_LIT>' ] or '<STR_LIT>' in file [ '<STR_LIT>' ] : <EOL> minerva_metadata [ '<STR_LIT>' ] = [ { <EOL> '<STR_LIT:name>' : file [ '<STR_LIT:name>' ] , '<STR_LIT>' : file [ '<STR_LIT>' ] } ] <EOL> minerva_metadata [ '<STR_LIT>' ] = { <EOL> '<STR_LIT:name>' : file [ '<STR_LIT:name>' ] , '<STR_LIT>' : file [ '<STR_LIT>' ] } <EOL> break <EOL> if '<STR_LIT>' not in minerva_metadata : <EOL> raise RestException ( '<STR_LIT>' ) <EOL> updateMinervaMetadata ( item , minerva_metadata ) <EOL> return item <EOL> createGeojsonDataset . description = ( <EOL> Description ( '<STR_LIT>' ) <EOL> . responseClass ( '<STR_LIT>' ) <EOL> . param ( '<STR_LIT>' , '<STR_LIT>' , required = True ) <EOL> . errorResponse ( '<STR_LIT>' ) <EOL> . errorResponse ( '<STR_LIT>' , <NUM_LIT> ) ) </s>
