la-famiglia-jst2324 / parma-analytics

ParmaAI analytics repository providing data processing and inference.
3 stars 0 forks source link

threshold variable in check_notification_rules() causing problems #104

Closed mfteloglu closed 9 months ago

mfteloglu commented 9 months ago

@la-famiglia-jst2324/analytics We had a testing session and actually check_notification_rules() method is throwing the following errors when it is called in register_values() :

ERROR:root:An error occurred: cannot access local variable 'threshold' where it is not associated with a value ERROR:root:An error occurred: 'NoneType' object has no attribute 'value'

This error is occuring for some data types, not sure which one (maybe int or text). When we comment out this part, the flow between GitHub, PDL, Affinity and Analytics is working fine. You can also test with those modules

FYI @egekocabas @Constantin343

egekocabas commented 9 months ago

I will create a PR and comment out that code section since it is blocking our tests and its not working

alouiii commented 9 months ago

@mfteloglu thanks for reporting this!

@onur-oruc could you please check this?

alouiii commented 9 months ago

Hey @mfteloglu and @egekocabas, the PR is merged. You can start testing again : )

mfteloglu commented 9 months ago

@alouiii @onur-oruc tried to test it on staging and local, it is still broken. Int values are working but text values are not written to the db. Getting this error at notification part ERROR:root:An error occurred: ‘NoneType’ object has no attribute ‘value’ It is working fine if this part and this are commented out

cc @Constantin343

mfteloglu commented 9 months ago

Would be great if you can test it with the actual data from data modules too. The staging endpoints are working. You can contact if you need help while testing the integration

alouiii commented 9 months ago

@mfteloglu

to speed things up for @onur-oruc : i tried calling the register_values function with text data and it seems to work. Could you specify what parameters are you calling the method with? (print out data coming from the normalization engine)

alouiii commented 9 months ago

register_values(normalized_measurement=NormalizedData(source_measurement_id=4, timestamp="2024-01-27T20:05:49.139Z", company_id=4, value="example text", type="Text"))

this is an example i user there

mfteloglu commented 9 months ago

Sure but this is not probably about parameters only . source_measurement_id=79 timestamp=datetime.datetime(2024, 1, 28, 12, 54, 5, 802681) company_id=2 value='personio' type='text'

ERROR:root:An error occurred: 'NoneType' object has no attribute 'value'

This wouldn't be a good case to test this.. Please try to debug it with an actual data source (GitHub or PDL maybe), and test with incoming real data, also concerning this issue

Constantin343 commented 9 months ago

@alouiii I think it's case-sensitive, right? If you use type "Text" this could be the problem, as it should be lowercase. And I agree with Fatih, please use real data and let us know if you need help with that.

alouiii commented 9 months ago

@alouiii I think it's case-sensitive, right? If you use type "Text" this could be the problem, as it should be lowercase. And I agree with Fatih, please use real data and let us know if you need help with that.

i was checking the check_notification_rules method, and there it shouldn't be a problem. But we will propagate this case insensitivity to rule out similar problems

onur-oruc commented 9 months ago

@alouiii I think it's case-sensitive, right? If you use type "Text" this could be the problem, as it should be lowercase. And I agree with Fatih, please use real data and let us know if you need help with that.

We transform the measurement_type to lowercase inside the function. So, it does not matter if it is sent as "Text", "text", "TeXt", etc. They will all be treated as "text".

alouiii commented 9 months ago

@mfteloglu and @Constantin343 should be solved now. Let us know if you find smth