HTTP POST to my AWS dynamodb setup


#1

Hello,
I’m trying HTTP POST to send the results to my AWS dynamoDB.
What is the format of those results? What is the primary key? How are they indexed?


#2

If you’re pushing via WebHooks, the format is described here:
https://kb.openalpr.com/help/webhooks-format

If you’re pushing directly from the agent, the format is quite similar, and is described here:
http://doc.openalpr.com/on_premises.html#json-group-results

The data is pure JSON, so no indexes or primary keys. The way that you organize the indexing I think would depend on your application and how you plan on using it.


#4

Can I have a python code that gives me the highest confidence of the same license plate detected while Pulling from the Queue with Beanstalkc. Instead of outputting multiple results of the same license plate with different confidences as the same car passes by.


#5

Here is Python 2x code for parsing the beanstalk results and printing only the top confidence plate and vehicle

import beanstalkc
import json
from pprint import pprint

beanstalk = beanstalkc.Connection(host='localhost', port=11300)

TUBE_NAME='alprd'

# For diagnostics, print out a list of all the tubes available in Beanstalk.
print beanstalk.tubes()

# For diagnostics, print the number of items on the current alprd queue.
try:
    pprint(beanstalk.stats_tube(TUBE_NAME))
except beanstalkc.CommandFailed:
    print "Tube doesn't exist"

# Watch the "alprd" tube; this is where the plate data is.
beanstalk.watch(TUBE_NAME)

# Loop forever
while True:

    # Wait for a second to get a job. If there is a job, process it and delete it from the queue.
    # If not, return to sleep.
    job = beanstalk.reserve(timeout=1.0)
    if job is None:
        print "No plates available right now, waiting..."
    else:
        plates_info = json.loads(job.body)

    # Do something with this data (e.g., match a list, open a gate, etc.).
    if 'data_type' not in plates_info:
        print "This shouldn't be here... all OpenALPR data should have a data_type"
    elif plates_info['data_type'] == 'alpr_results':
        print "Found an individual plate result!"
    elif plates_info['data_type'] == 'alpr_group':
        print "Found a group result!"
        print '\tBest plate: {} ({:.2f}% confidence)'.format(
		    plates_info['candidates'][0]['plate'], 
    	    plates_info['candidates'][0]['confidence'])
        make_model = plates_info['vehicle']['make_model'][0]['name']
        print '\tVehicle information: {} {} {}'.format(
            plates_info['vehicle']['year'][0]['name'],
            plates_info['vehicle']['color'][0]['name'],
            ' '.join([word.capitalize() for word in make_model.split('_')]))
    elif plates_info['data_type'] == 'heartbeat':
        print "Received a heartbeat"

    # Delete the job from the queue when it is processed.
    job.delete()