Package: cvfe
Canada Visa Form ExtractionCanadaVisaFormExtraction (CVFE) is a tool set to extract and transform Canada visa forms (IMM 5257 EandIMM 5645 E) into standard format.1 Installation1.1 Package1.1.1 PIPpipinstallgit+https://github.com/Nikronic/canada-visa-form-extraction.gitOr if you have cloned/downloaded the repository already, just use:pipinstall.1.1.2 Using Conda Environment FileWe have provided aconda_env.yml(bare minimum) andconda_env_dev.yml(all packages including, tests, docs, and formatting) for ease of install usingconda(ormamba). Please use:condaenvcreate-nYOUR_ENV_NAME--fileconda_env.yml1.1.3 Using DockerOfficial Image:
The easiest way is to just pull the official image from GitHub Container Registry:dockerpullghcr.io/nikronic/cvfe:DESIRED_VERSIONFor instance, for the versionv0.2.1(cat VERSION), you can pulldocker pull ghcr.io/nikronic/cvfe:v0.2.1.Then for running it, use:dockerrun-pYOUR_HOST_PORT:CONTAINER_PORTghcr.io/nikronic/cvfe:DESIRED_VERSIONpython-mcvfe.main--bind0.0.0.0--portCONTAINER_PORTFor example:dockerrun-p9999:8000ghcr.io/nikronic/cvfe:v0.2.1python-mcvfe.main--bind0.0.0.0--port8000note:All the images can be found on therepo packages.Manual Image:
We have provided aDockerfilefor ease of install usingdocker. Please use:dockerbuild-tcvfe.For running it, you need to map the port8000of the container to your desired port (8001) on host:dockerrun-p8001:8000cvferemark: note that we do not usemambainDockerfileas the complexity of the environment is small and the overhead of installingmambaitself might not worth it.1.2 Manual InstallationUsingcondaas the package manager is not necessary nor provides any advantages (of course virtual environment are necessary). Hence, if you like, you can install dependencies viaconda. Note that only few of the dependencies are available oncondachannels and you still need to usepip.tip:You can usemambato hugely speed up the installation process.[Optional] 1.2.1 Create acondaenvif conda:condacreate--namecvfepython=3.11-y[Optional] 1.2.2 Activate the new environmentMake sure you activate this environment right away:
if conda:condaactivatecvfe1.2.3 UpdatepipYou should have at leastpip >= 23.1.2pipinstall--upgradepip1.2.5 Install data extraction dependenciespipinstallxmltodict>=0.13.0
pipinstallpikepdf>=5.1.5
pipinstallpypdf>=3.17.0
pipinstallpython-dateutil>=2.8.11.2.6 Install API libsThese libraries (the main one is FastAPI) are not for the ML part and only are here to provide the API and web services.pipinstallpydantic>=2.0.3
pipinstallfastapi>=0.100.0
pipinstallgunicorn>=21.2.0
pipinstalluvicorn>=0.23.1
pipinstallpython-multipart>=0.0.6[Optional]For making it online (only for development) usingngrok:pipinstallpydantic-settings
pipinstallpyngrokFor usingngrok, startuvicornserver with your own args:USE_NGROK=Truepythonapi.py--bindhost--portportNote thatUSE_NGROK=Truehas been handled by the code and you can use this flag to usengrok(online) or not (offline). Also, you can use0.0.0.0for thehostto listen on all interfaces. By default we usehost=0.0.0.0andport=8000.1.2.7 Install this packagecvfeMake sure you are in the root of the project, i.e. the same directory as the repo name. If you are in correct path, you should seesetup.pycontaining information aboutcvfe.pipinstall-e.2 DevelopersThese section is about developers who want to work on the source directly and includes things such as setting up tests, formatting and so on.2.1 Setting uppre-commitfor formatting our repo correctly without needing to check every time, I suggest using pre-commit to hijack commit and usingblackandisorton them.pipinstallpre-commitbe sure we have pre-commit configs at.pre-commit-config.yamlthan usepre-commitinstall[!TIP]
if we want to we could do a full check (pre-commit only checks new commits).pre-commitrun--all-filesPeople who are using this repoVisaland: They are using this project to convert already filled forms into a standard format to include it into their CRM and ERP.