-
Notifications
You must be signed in to change notification settings - Fork 83
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
CP Auto tagger #2503
CP Auto tagger #2503
Conversation
V1: Added Code for Imatric to use Semaphore API.
V1: Syntax error addressed.
Added More Logging to TroubleShoot.
V2: Added Logging
V2: Added Logging
inconsistency in the use of tabs and spaces
Added More Logging and updated code to transform input before processing.
Added some prints to check
Added Semaphore.py to use for Semaphore API
Updated environment variables
Returning errors to front end
Created Semaphore.py in transmitter
Created Semaphore.py Formatter file
added env variables to code
Updated api_key
Changed much part of the code.
exception bug fix
Bug Fixes
Bug Fix.
Bug Fixes
Trying to run the build
bug fixes
analyzed_data = service.analyze(item, doc.get("tags")) removed tags
bug fix
bug fix
More Bug Fix
bug fix
Made some changes for methods of transforming xml and jsons.
Bug fixes
bug fixes and more loggings added
Trying to run the working Semaphore Code.
Updated the semaphore api key
Added Headline Tag generation to Semaphore.py
Added Slugline Functionality
Added Code for Slugline and Showing tags with ID coming from Semaphore.
Added code to show Heirarchy in Tags and added backend code for Search Tag Responses.
Updated init to take in searchString.
Added Code to get entities in Ninjs Response.
Added Code to fetch Parent Tags.
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.
can you pls reset the changes done to imatrics?
logger.error(data) | ||
|
||
|
||
self.output = self.analyze(data) |
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.
not sure if this should be called in init, seems like it will be called with the application object and not an article anyhow
|
||
|
||
|
||
self.session = requests.Session() |
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.
seems like this is not used later, so you can avoid that or use it later instead of the session defined outside of the class
query = qcode | ||
parent_url = self.get_parent_url+query+frank | ||
|
||
response = requests.get(parent_url, headers=headers) |
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.
it's better to use session everywhere
|
||
# Embed the 'body_html' into the XML template | ||
xml_output = xml_template.format(headline,headline_extended,body_html,slugline) | ||
xml_output = clean_html_content(xml_output) |
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.
you can use get_text helper to convert html to text
Only change not done is using get_helper to convert from html to text as it did not work with the API request.
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.
in general we plan to move the code to superdesk-cp repo, but we still need to get rid of those changes in the non semaphore files I commented on, some things like changing the text_checkers schema we can keep
@@ -88,7 +90,8 @@ def create(self, docs, **kwargs): | |||
except KeyError: | |||
raise SuperdeskApiError.notFoundError("{service} service can't be found".format(service=service)) | |||
|
|||
analyzed_data = service.analyze(item, doc.get("tags")) | |||
# analyzed_data = service.analyze(item, doc.get("tags")) | |||
analyzed_data = service.analyze(item) |
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.
would need the previous version here
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.
would be good to do those changes in a custom formatter, either that Semaphore one or some CP specific NINJS.
I think those changes would break some existing integrations like with newshub
Created CP NINJS Formatter
Modified Code with Added Functionality to Run when a Tag is Created in KMM.
Update semaphore.py in Formatters to work with ninjs_formatter_2
Added Names for NinjsV3
Added Code to write back to KMM.
hi @cpefatimaabdillahi I've pushed the changes from the PR to superdesk/superdesk-cp#189 , can you pls continue there? btw was trying to run the code locally but was getting some 500 error from semaphore api |
Added Changed Name and Type to the Formatter
This pull request involves several changes across eight files:
These changes focus on integration enhancements and more refined article transformation logic across different services and formatters in Superdesk.
Variables are stored in our environment file. Please let us know if we should we move these variables to Superdesk's config file.