Field report: Noisy translation data annotation and nginx-proxy deployment

Hello all,

I have been using prodigy for a very long time and I think I have seen many configurations. But I don't know all the tricks and have some ugly habits to achieve my goals in prodigy. So I thought I'd report on a use case and possibly a discussion will come up about how I could have implemented this better. I would be very happy to hear that!

Below I would like to present a use case and show my NGINX integration.

We are training a translation solution for a research project. In this project, both the SOURCE and TARGET language sentences are of poor quality. It is therefore necessary that users can edit both the source and target sentences. Furthermore, it is necessary that comments can be given.

Comments can be realized very easily by the text field of Prodigy.

However, editing sentences and comparing them at the same time is not so easy with the user input variant in the prodigy block. Especially not, because you can't define a text for the user inputs (only a placeholder). For this reason, it is necessary to work with HTML.

    blocks = [
        {"view_id": "html", "html_template": "<div class='c0185'><label class='c0186' for='w2'>Source</label><textarea rows='4' id='w2' class='prodigy-text-input c0187 c0188' onchange=\"setsource(document.getElementById('w2').value)\">{{source}}</textarea></div>"},
        {"view_id": "html", "html_template": "<div class='c0185'><label class='c0186' for='w3'>Target</label><textarea rows='4' id='w3' class='prodigy-text-input c0187 c0188' onchange=\"settarget(document.getElementById('w3').value)\">{{target}}</textarea></div>"},
        {"view_id": "text_input", "field_rows": 3, "field_label": "Comment"}
    ]

In order for the changed texts to find their way into the database, the change must be noted in the Prodigy object. For this we can use JavaScript.

"config": {
            "blocks": blocks,         # add the blocks to the config
            "javascript": "function setsource(text) {window.prodigy.content.source = text; window.prodigy.content.text = text;} function settarget(text) {window.prodigy.content.target = text;}"
        }

This works very well. But is it also the easiest way? And why can't I use the user input blocks for this?

Let's move on to nginx. If a reverse proxy is to be used with nginx and the paths cannot be "/" because, for example, something else is already running on the path, as far as I know you have no way in Prodigy to define an alternative route here.

        location /awesome-prodigy/ {
                proxy_pass http://127.0.0.1:8080/;
        }

This first leads to a 404 at Prodigy, because the paths are not correct. I adjust the routes in the app.py in prodigy. Then it works great. But is there a nicer way here?

Best,
Frederik

Thank for sharing :slightly_smiling_face:

I hope I understand the question correctly but you can also pre-populate the text in the text field in the incoming JSON. By default, that'd be user_input, but you can also customise the ID via the field_id setting on the block. So if you feed in data with "user_inpit": "Some text here", the field will get pre-populated.

Couldn't you do something like this and define alternative routes for all the endpoints?

In general, Prodigy should support custom path-based routing because all requests are made using the releative paths.