UstadMobile / ZIM2Xapi

MIT License
1 stars 0 forks source link

Khan Academy support #1

Open mikedawson opened 2 months ago

mikedawson commented 2 months ago

User story

As a system administrator or edtech developer I want to extract/convert individual Khan Academy exercises from ZIM files to a xAPI zip so that I can use Khan Academy lessons in Ustad Mobile or other edtech environment

(If work duration will exceed five days, must be broken down into multiple)

Background info on user story

Design tasks

When design is complete: attach PDF of prototype that includes all screens added/modified here.

Implementation tasks

Each task max one day - otherwise should be split.

When implementation is complete: developer to attach video showing completion of acceptance criteria

Acceptance criteria

SamihMustafa commented 2 months ago

Identified issue with zimdump: file and folder name conflicts. zimdump creates an exception folder with all the missed files. This is a known issue, tracked here: https://github.com/openzim/zim-tools/issues/414

SamihMustafa commented 2 months ago

Identified issue with zimdump: file and folder name conflicts. zimdump creates an exception folder with all the missed files. This is a known issue, tracked here: openzim/zim-tools#414

The proposed fix is to ensure each file has the correct extension, then move any missed files to the correct folder.

mikedawson commented 2 months ago

Behavior note: should have an optional command line parameter for the paths. If not manually specified, use the system path.

The logic for this is in SysPathUtil in the main Ustad repo. Normally, copy/paste is bad. I think in this case; there isn't really a practical alternative. ZIM2Xapi should not depend on the main Ustad repo.

mikedawson commented 2 months ago

Code review notes (as we don't have a pull request)

  1. Package name should be set - e.g. com.ustadmobile.zim2xapi
  2. Needs a README file with instructions on required dependencies to install. A few example commands in the README would be enough - users can get full command line detail/help using the help provided via CLI argument parser.
  3. UseCases - constructor parameters should dependencies only (e.g. other use cases, serialization things, etc). Per invocation arguments (e.g. the file to process etc) should be arguments to invoke as per coding style. The UseCase is provided via DI (normally as a singleton), so per invocation arguments should not be part of the instance itself.
  4. If something fails - let it throw an exception as per code style note just added. This should be caught eventually by the command line runner. E.g. if ExtractZimUseCase fails it needs to throw an exception ; otherwise when it is used programmatically in a chain, anything that is using it will continue as if everything was OK. That is not desirable. If a command fails (eg exit code is non zero), then we should also throw an exception.
  5. DownloadKolibri2ZimUseCase - don't hardcode the use of docker. That could be a sensible default. Also ensure that per-invocation arguments are arguments to invoke, not constructor parameters. The UseCase could accept an argument (constructor parameter) for the command. Should be a string that can then be split up. E.g. default could be "docker run ...docker params"
mikedawson commented 2 months ago

Behavior note: path handling logic

If user has specified a path - use the expected name on it's own e.g. kolibri2zim

Split the path up by whitespace (e.g. if user specifies 'docker ... kolibri2zim')

For the first argument (e.g. the actual executable), if it is not a absolute path, use syspathutil to look for the absolute path

mikedawson commented 2 months ago

For input: allow specifying a Zim file or kolibri channel/topic (where we use kolibri2zim to get the zim).