- Notifications
You must be signed in to change notification settings - Fork 1.2k
[Fixes #13831] Supported additional EXIF metadata extraction from image Documents and refactor of DOCUMENT_TYPE_MAP and DOCUMENT_MIMETYPE_MAP #13835
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ge Documents and refactor of DOCUMENT_TYPE_MAP
Summary of ChangesHello @sijandh35, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the handling of image documents by enhancing EXIF metadata extraction capabilities and refining the internal document type mapping. The changes ensure that more comprehensive metadata, including detailed Exif and GPS information, is correctly retrieved from images, while also streamlining the classification of various image file types within the system. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request enhances EXIF metadata extraction from image documents and refactors the DOCUMENT_TYPE_MAP. The changes in geonode/documents/exif/utils.py are a significant improvement, leveraging modern Pillow APIs to robustly extract more EXIF data, including from specific IFDs like Exif and GPS. However, the refactoring of DOCUMENT_TYPE_MAP in geonode/documents/enumerations.py introduces an issue by removing several valid image file extensions (bm, bmp, fif, jpe). This would prevent EXIF extraction from these image types, as the logic now correctly relies on doc.is_image, which uses this map. I have provided a suggestion to restore these extensions while keeping the other beneficial changes.
| "xls": "text", | ||
| "xlsx": "text", | ||
| "xml": "text", | ||
| "bm": "image", | ||
| "bmp": "image", | ||
| "dwg": "archive", | ||
| "dxf": "archive", | ||
| "fif": "image", | ||
| "gif": "image", | ||
| "jpg": "image", | ||
| "jpe": "image", | ||
| "jpeg": "image", | ||
| "png": "image", | ||
| "tif": "archive", | ||
| "tiff": "archive", | ||
| "tif": "image", | ||
| "tiff": "image", | ||
| "pbm": "archive", | ||
| "odp": "presentation", | ||
| "ppt": "presentation", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While refactoring DOCUMENT_TYPE_MAP, several image formats like bm, bmp, and jpe were removed. This appears to be a regression, as it will prevent EXIF metadata extraction for these file types since the logic now relies on doc.is_image. This also introduces an inconsistency with DOCUMENT_MIMETYPE_MAP, where these extensions are still defined.
I suggest adding these image types back to ensure continued support. The change to correctly classify tif and tiff as image is correct and has been preserved in the suggestion.
"xls": "text", "xlsx": "text", "xml": "text", "bm": "image", "bmp": "image", "dwg": "archive", "dxf": "archive", "fif": "image", "gif": "image", "jpg": "image", "jpe": "image", "jpeg": "image", "png": "image", "tif": "image", "tiff": "image", "pbm": "archive", "odp": "presentation", "ppt": "presentation"There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now DOCUMENT_MIMETYPE_MAP also has been updated(by removing: bm, bmp , fif and jpe type) to make it consistent with DOCUMENT_TYPE_MAP.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@ ## master #13835 +/- ## =========================================== + Coverage 52.15% 74.16% +22.01% =========================================== Files 944 944 Lines 56335 56339 +4 Branches 7626 7627 +1 =========================================== + Hits 29380 41786 +12406 + Misses 25588 12875 -12713 - Partials 1367 1678 +311 🚀 New features to boost your workflow:
|
Fixes #13831
Updates:
Checklist
For all pull requests:
The following are required only for core and extension modules (they are welcomed, but not required, for contrib modules):
Submitting the PR does not require you to check all items, but by the time it gets merged, they should be either satisfied or inapplicable.