ooiservices/app/main/annotation.py
def process_annotation(begin_dt,end_dt,annotation_text,ref_def,annotation_id=None):
    '''
    PROCESS ANNOTATION :  either update or create depending on if id is passed in
    '''

    post_req = {'beginDT': begin_dt,
                'endDT': end_dt,
                'referenceDesignator' : ref_def,
                'annotation': annotation_text,
                'id':annotation_id
                }

    if annotation_id == None:
        if 'id' in post_req: del post_req['id']

    uframe_link = current_app.config['UFRAME_ANNOTATION_URL'] + current_app.config['UFRAME_ANNOTATION_BASE']
    annotation_url = "/".join([uframe_link,'add',ref_def])

    r = requests.post(annotation_url , data=json.dumps(post_req) , timeout=10)

    if r.status_code == 200:
        return jsonify( {} ), 201
    else:
        return jsonify( {'error' : r.reason }), r.status_code

    PROCESS ANNOTATION :  either update or create depending on if id is passed in
    
PROCESS ANNOTATION :  either update or create depending on if id is passed in
PROCESS ANNOTATION : either update or create depending on if id is passed in
def process_annotation(begin_dt,end_dt,annotation_text,ref_def,annotation_id=None):
    post_req = {'beginDT': begin_dt,
                'endDT': end_dt,
                'referenceDesignator' : ref_def,
                'annotation': annotation_text,
                'id':annotation_id
                }
    if annotation_id == None:
        if 'id' in post_req: del post_req['id']
    uframe_link = current_app.config['UFRAME_ANNOTATION_URL'] + current_app.config['UFRAME_ANNOTATION_BASE']
    annotation_url = "/".join([uframe_link,'add',ref_def])
    r = requests.post(annotation_url , data=json.dumps(post_req) , timeout=10)
    if r.status_code == 200:
        return jsonify( {} ), 201
    else:
        return jsonify( {'error' : r.reason }), r.status_code
def process_annotation ( begin_dt , end_dt , annotation_text , ref_def , annotation_id = None ) : post_req = { 'beginDT' : begin_dt , 'endDT' : end_dt , 'referenceDesignator' : ref_def , 'annotation' : annotation_text , 'id' : annotation_id } if annotation_id == None : if 'id' in post_req : del post_req [ 'id' ] uframe_link = current_app . config [ 'UFRAME_ANNOTATION_URL' ] + current_app . config [ 'UFRAME_ANNOTATION_BASE' ] annotation_url = "/" . join ( [ uframe_link , 'add' , ref_def ] ) r = requests . post ( annotation_url , data = json . dumps ( post_req ) , timeout = 10 ) if r . status_code == 200 : return jsonify ( { } ) , 201 else : return jsonify ( { 'error' : r . reason } ) , r . status_code
PROCESS ANNOTATION :  either update or create depending on if id is passed in
PROCESS ANNOTATION : either update or create depending on if id is passed in
'''
    PROCESS ANNOTATION :  either update or create depending on if id is passed in
    '''
begin_dt
end_dt
annotation_text
ref_def
annotation_id