A Document Scanning App That Integrates with Collect

Hello everyone! - Hope you're doing well! :waving_hand:

I wanted to share a small exploration I recently worked on, hoping it might be helpful to someone!

:green_circle: The "What & Why?" / Problem Statement

Recently, I was looking for an open-source document scanner app that could:

  • Use an Android phone's camera to scan documents,
  • Automatically Crop or Enhance Images / Generate a PDF, and
  • Attach that PDF directly to a specific ODK Collect form - ideally automatically because in practice, many data collectors struggle to remember which scanned file (or clicked image) belongs to which particular saved draft form. This often leads to incorrect attachments and, ultimately, incorrect submissions. Automating this hand-off felt like a meaningful improvement to me.

During my research, I came across this app: FairScan - a clean, respectful, open-source document scanner. While it worked well as a scanner, it didn't interact with ODK Collect in the way I was hoping it would (i.e., returning the scanned PDF back to ODK Collect automatically).

:green_circle: The "What I did?" / Solution

So, I experimented with making minimal changes to FairScan's codebase, using ODK Collect's documented intent-based integration, to allow the scanned PDF to be sent straight back to ODK Collect - and it worked exactly as intended! :partying_face:

For anyone interested in trying this out or exploring further, I'm including a demonstration, the GitHub repo for the minimal code I modified to make it work (contains built .apk files as well!), and a sample XLSForm below:

:white_small_square: Quick Demonstration [50 seconds]:

:white_small_square: GitHub Repo / Modified Source Code / Built .apk Files:

:link: Here!

:white_small_square: Sample XLSForm:

fileuploadtest.xlsx (8.3 KB)

That's all!

Have a great day! :smile: - and, Merry Christmas in advance! :christmas_tree:

11 Likes

That's great! I could see a lot of cases where that would be super useful.

Have you asked the FairScan maintainers if they would integrate your changes so the app store version would work rather than sideloading an apk?

5 Likes

Thank you so much!

That's a great suggestion, and it would indeed remove the need for sideloading the APK altogether. I've reached out to the FairScan's maintainer regarding this and will keep this thread updated as I hear back.

Appreciate the input - thanks again! :smile:

6 Likes

How to solve this i try it but it message me like this even I installed the fair scan to

Did you install the app using the custom apk?

I just tested and it works, but if I use the normal FairScan app I get the same error as you.

2 Likes

I installed this app to.

Update:

Hi everyone! :waving_hand:

Looks like we've received a lovely Christmas present from the FairScan's maintainer! :wrapped_gift:

I'm happy to share that official integration for FairScan with ODK Collect is now live! With this release (FairScan v1.9.0), there's no longer any need to sideload a custom APK. FairScan can now be installed directly from the Google PlayStore and works seamlessly with ODK Collect out of the box! :smile:

I've attached a sample XLSForm below that works with this new official release:
fileuploadtest.xlsx (8.4 KB)

I would also suggest checking out FairScan's GitHub repository and the updated README, which now documents this integration.

@ahblake - thanks again for the suggestion, much appreciated!
@Faisal_Amani - it looks like you're using the Play Store version of FairScan (not the earlier custom APK). Please try the attached XLSForm above; it should start working for you right away.

That's all!

Have a great day, and Merry Christmas! :christmas_tree::confetti_ball:

12 Likes

https://fairscan.org/blog/fairscan-can-now-be-called-from-other-apps/ :star_struck:

4 Likes

We’ve added a tip about using FairScan to the docs at https://docs.getodk.org/form-question-types/#file-upload-widget. Thanks again to @MinimalPotato for all his work on this!

3 Likes

FairScan is also available to install via F-Droid for those who prefer to direct-install applications without Google’s mediation.

1 Like

Wow! This is a big win! w00t! :tada:

I know this is being greedy, but does anyone know of a similar app that could accomplish a similar thing using OCR to fill a text/decimal field?

I'm not the only one asking:

but I've not heard any developments in this area.

Glad it helps - thank you very much! :smile:

1 Like

You can give this a try, it doesn’t work as external app launch from ODK. It is a standalone keyboard. Free but with ads, or else you can buy the app.

Keyboard with Integrated Barcode, Text (OCR) and NFC Tag Scanner

2 Likes