description:What SimpleOCR is, how this repository is structured and which mechanisms exist for building and testing it. Use this before fixing a defect or developing a feature in this repository, to know where things belong and how to verify a change.
---
# SimpleOCR
SimpleOCR makes the text of images and pdf-documents available: it recognizes the text (OCR) and returns it.
It exists in three shapes, and that is the structure of the repository.
## Structure of the repository
The repository follows the "common project structure": all sourcecode lives in code-units, and every code-unit
has its own `Other`-folder with its build-, quality-check- and reference-files. Use the
`work-with-common-project-structure`-skill when you need the details of that structure.
The code-units are:
-`SimpleOCRLibrary` - the recognition itself. Everything which is really about OCR belongs here, and only
here.
-`SimpleOCRCLI` - the commandline-program. It parses the arguments (verb-based, see `ProgramStarter` and the
`Verbs`-folder) and calls the library.
-`SimpleOCRService` - the api-server which offers the same functionality over http.
A rule which follows from that split: neither the CLI nor the service may contain recognition-logic. When
something has to be fixed about *how* text is recognized, it is fixed in the library and both other code-units
get the fix for free.
## The api-server
`SimpleOCRService` is a GRYLibrary-api-server like the backends of the other products (ConSurv, OpenDMS,
RSSArchivist), so the same rules apply: the middlewares, the maintenance-routes and the logging come from the
library, and `Program.cs` is the entrypoint (that file-name is used for every server here).
Whether the server binds every ip-address or only the loopback-interface is decided by
`ApplicationConstants.ListenOnEveryIP`. The integration-tests set it to `false`; a productive run needs it to
be `true`, otherwise the service is not reachable from outside its container.
## Building and testing
`scbuildcodeunits` builds everything: compile, tests, linting and security-checks. The task `task bb`
(`BaseBuildAllCodeunits`) does the same.
The testcases of the library work on files which are contained in the repository, so they need neither a
network nor an installed service. Keep it that way: a testcase which needs a running service belongs to the