GithubHelp home page GithubHelp logo

rossumai / elisctl Goto Github PK

View Code? Open in Web Editor NEW
10.0 10.0 9.0 379 KB

Command line interface for controlling ELIS

Home Page: https://rossum.ai/

License: MIT License

Python 100.00%
cli data-entry elis rossum

elisctl's People

Contributors

bara-m avatar evelyn9191 avatar janapradacova avatar pasky avatar pavelkraleu avatar proste avatar psauxo avatar qiq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elisctl's Issues

AssertionError message for incorrect password

I attempted a first-time login to my Elis account using elisctl, and pasted my password instead of typing it (possibly including an extra space). It produced the attached error lines and @pasky suggested that this should be more elegant.

signup error

Remove elisctl csv get command

This command is not widely used and makes pandas installation required. Removing this command will allow us to remove the pandas dependency.
It is also closely linked to the conversation in #4

Error 500 when uploading a correct schema - recipient_name row problem

When using schema update [id] --format xlsx (see the file attached below) I am getting an error message Error: Invalid response [https://api.elis.rossum.ai/v1/schemas]: <h1>Server Error (500)</h1>, although the schema is correct. The problem is in the recipient_name row. If deleted or of a new row with the same data is written instead of it, the upload is successful.

schema.xlsx

Strange warning in `elisctl schema upload` help

The help says

WARNING: creation of schema must be carried out with a user from within
the organization. The reason is that the schema is automatically attached
to the organization of the user, who is creating it.

But the schema just replaces the previous schema in the queues the old schema was attached to, so this is obsolete?

Cannot change webhook event on webhook change

When calling

webhook change -e annotation status --config-url http://someurl.com

the response is

Error: Invalid response [https://api.elis.rossum.ai/v1/webhooks/123]: {"events": {"0": ["\"['annotation_status']\" is not a valid choice."]}}

On webhook create command the creation works.

Serialization of excel bools fails

When a proper bool is specified in xlsx (e.g. in column "use_rir_content (bool)") schema update --format xlsx fails with the following error:

Error: File <_io.BufferedReader name='/tmp/delme.xlsx'> could not be loaded. Because of Expecting value: line 1 column 1 (char 0)

Schema cannot be updated (UnicodeDecodeError)

Schema cannot be updated when using "schema update ID file.json" when updating schemas in Czech language. Error:
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 1626: character maps to

Windows 10 Home, 64-bit, elisctl version 1.1.1.

elisctl queue: Add setting user access per queue

Currently, access settings per queue are controlled only by user change. This is very awkward when I create a new queue and would like to grant access to a group of users (who also have access to other queues, that should remain unaffected).

Nice & easy solution would be to allow specifying list of users to access the queue in the queue change command.

(Another possibility would be a way to add/remove specific queue for a user instead of always specifying the full list, but that'd still be O(N) instead of O(1) for my usecase.)

Deserialization of default_value fails for strings

It is currently not possible to change default_value using xlsx. The reason is that default_value may be in fact of a JSON type (null, object or array) or a string. Currently, it is always parsed as JSON.

Add support to config profiles

It would be very useful to allow several user-account configurations (username/password) in elisctl. And allow to switch between them using --profile argument (similar to aws --profile)

Adjust upload_document() to consume also a stream input

In addition of uploading the document from a file (the case of local file system), it may be beneficial to have also a stream input (in our case of remote file system). More precisely, in this function:

    def upload_document(
        self, id_: int, file: str, filename_overwrite: str = "", values: Dict[str, str] = None
    ) -> dict:
        filename = PurePath(filename_overwrite).name or PurePath(file).name
        files: RequestsFiles = {"content": (filename, open(f"{file}", "rb"))}
        if values is not None:
            files["values"] = (None, json.dumps(values))
        return get_json(self.post(f"queues/{id_}/upload", files=files))

it would be great to feed also ByteIO stream, not only file.

connector command: Make queue parameter required

When a connector is created without queue it disappears. Users - not even admins - cannot see connector that are not anyhow connected to their organizations.

Make the queue parameter required. Possibly, if not specified and the user has only one queue use the queue as for other subcommands.

Example script to set-up organization

It would help new users to have an example script that creates organization using elisctl.
It should include: workspace, queue, inbox, schema, user

Add tests for windows package

At the moment the package, once built, must be manually tested.

Start with an automatic integration test that will try to install the package and will run only elisctl command (start the interactive shell). This should prove that all python dependencies are OK.

`elisctl csv get` broken

It appears to use the CSV connector interface rather than export queue interface, but then it uses the API endpoint URL rather than the CSV connector URL.

(But I'm actually not sure what's the purpose of this subcommand right now. :) )

Commands run without configuration fail with ugly stacktrace

Example:

pasky@gundi:~/elisctl$ elisctl csv get
Traceback (most recent call last):
  File "/usr/local/bin/elisctl", line 11, in <module>
    load_entry_point('elis-tools', 'console_scripts', 'elisctl')()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/pasky/elisctl/elisctl/csv.py", line 47, in download_command
    rsp = api_client.get(f"byperiod/{ceil(step.total_seconds())}/{int(start.timestamp())}")
  File "/Users/pasky/elisctl/elisctl/lib/api_client.py", line 82, in get
    return self._request_url("get", f"{self.url}/{path}", query)
  File "/Users/pasky/elisctl/elisctl/lib/api_client.py", line 58, in url
    _url = get_credential("url").rstrip("/")
  File "/Users/pasky/elisctl/elisctl/configure.py", line 40, in get_credential
    res = config["default"].get(attr)
  File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 958, in __getitem__
    raise KeyError(key)
KeyError: 'default'

We should guide the user to configure elisctl first.

Allow adding/removing of queues of a user

Hello,

at the moment, in order to add user to a queue one needs to state all queues the user is in. When a user has multiple queues, the command gets excessively long:

elis> user change -q 53 -q 4142 -q 4143 -q 4144 -q 4145 -q 4146 -q 4147 -q 9037 -q 14147 -q 14148 -q 16065 -q 16068 -q 16070 -q 16804 -q 16814 -q 20099 -q 21332 -q 21334 -q 21335 -q 21337 5632

Suggested solution:

create a command elisctl user queues, which would allow for add, remove and list subcommands.

Annotator cannot list connectors

Annotator role does not have access to connector.authorization_token, thus, the following error is produced:

Traceback (most recent call last):
  File "/Users/krystofpilnacekrossum/.pyenv/versions/elisctl-venv-37/bin/elisctl", line 11, in <module>
    load_entry_point('elisctl', 'console_scripts', 'elisctl')()
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click_shell/core.py", line 161, in invoke
    ret = super(Shell, self).invoke(ctx)
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/krystofpilnacekrossum/.pyenv/versions/3.7.3/envs/elisctl-venv-37/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/krystofpilnacekrossum/workspace/tools/elisctl/connector.py", line 71, in list_command
    for connector in connectors_list
  File "/Users/krystofpilnacekrossum/workspace/tools/elisctl/connector.py", line 71, in <listcomp>
    for connector in connectors_list
KeyError: 'authorization_token'

Change default behaviour of schema update

With connection to the latest changes in schema update behavior, --rewrite option should probably be default behavior now and former behavior of creating a new schema with schema update should be made only an option.

Password cannot contain `%`

When elisctl configure is run and a password with % char is entered, the following error is raised

Password: 
Traceback (most recent call last):
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/bin/elisctl", line 11, in <module>
    load_entry_point('elis-tools', 'console_scripts', 'elisctl')()
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click_shell/core.py", line 161, in invoke
    ret = super(Shell, self).invoke(ctx)
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/krystofpilnacekrossum/workspace/tools/venv/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/krystofpilnacekrossum/workspace/tools/elisctl/configure.py", line 28, in cli
    "password": click.prompt(f"Password", hide_input=True, type=str).strip(),
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 971, in __setitem__
    self.read_dict({key: value})
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 753, in read_dict
    self.set(section, key, value)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 1198, in set
    super().set(section, option, value)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 893, in set
    value)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/configparser.py", line 402, in before_set
    "position %d" % (value, tmp_value.find('%')))
ValueError: invalid interpolation syntax in '"%O9#t

Also makes problems even when .elis/credentials is set manually and some API operation is carried out.

credentials are stored in clear

Hi,
I wanted to highlight that the password from ElisCtl are stored in clear in the User/.elis/credentials file. Is it planned to put some encryption for atleast the password ? I don't know if it is deliberate or not.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.