Skip to content
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

Track Location Uptime #1843

Merged
merged 13 commits into from
Feb 12, 2024
Merged

Track Location Uptime #1843

merged 13 commits into from
Feb 12, 2024

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Jan 22, 2024

This pull request adds a new task to periodically check the status of asset locations and record their availability. It also includes changes to the API to support querying the availability records.

Key File Changes

  1. Asset Serializer Modifications (asset.py in serializers and viewsets):

    • Refactoring of AssetAvailabilityRecord to AvailabilityRecord.
    • Adjustment of serializer fields and methods to align with the new model structure.
    • Changes in the viewset filters to accommodate the updated model.
  2. Migration Script (0408_availabilityrecord_delete_assetavailabilityrecord_and_more.py):

    • A comprehensive migration script to transition from AssetAvailabilityRecord to AvailabilityRecord.
    • Includes forward and backward migration logic to ensure database consistency.
  3. Model Changes (asset.py in models):

    • Introduction of the AvailabilityRecord model.
    • Removal of AssetAvailabilityRecord and updates to related model fields.
    • Adjustments to model methods and properties to reflect new relationships and data structures.
  4. Task Updates (asset_monitor.py and location_monitor.py in tasks):

    • Modification of task logic to use AvailabilityRecord.
    • Introduction of new periodic tasks for location monitoring (location_monitor.py).
  5. Minor Adjustments (__init__.py in tasks):

    • Inclusion of the new location monitoring task in the task initialization.

Summary

The PR aims to improve the tracking system for asset and location availability within the CARE project. The changes suggest a shift towards a more generic AvailabilityRecord model that can handle different types of assets and locations, enhancing the system's flexibility and scalability. The migration script ensures a smooth transition from the old model to the new system without data loss.

The modifications in serializers, viewsets, and models indicate a thorough update to accommodate these changes, ensuring that the system's API and internal workings remain consistent with the new data structure. Additionally, the updates to the periodic tasks hint at a broader application of these changes, likely impacting how asset and location statuses are monitored and recorded in real time.

These changes reflect a significant improvement in the system's ability to track and report on the operational status of various assets and locations, which is crucial for efficient resource management and operational oversight in the context of the CARE project.

@coronasafe/care-backend-maintainers @coronasafe/care-backend-admins

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 31 lines in your changes are missing coverage. Please review.

Comparison is base (fcea22e) 61.65% compared to head (54779d4) 61.60%.

Files Patch % Lines
care/facility/tasks/location_monitor.py 29.41% 24 Missing ⚠️
care/facility/models/asset.py 72.72% 3 Missing ⚠️
care/facility/api/viewsets/asset.py 88.88% 1 Missing and 1 partial ⚠️
care/facility/tasks/asset_monitor.py 50.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1843      +/-   ##
==========================================
- Coverage   61.65%   61.60%   -0.06%     
==========================================
  Files         211      212       +1     
  Lines       11721    11780      +59     
  Branches     1664     1674      +10     
==========================================
+ Hits         7227     7257      +30     
- Misses       4196     4224      +28     
- Partials      298      299       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

care/facility/api/viewsets/asset.py Outdated Show resolved Hide resolved
@Ashesh3 Ashesh3 requested a review from sainak February 9, 2024 07:52
Copy link
Member

@sainak sainak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Ashesh3
Copy link
Member Author

Ashesh3 commented Feb 11, 2024

@vigneshhari could you review this once?

@vigneshhari vigneshhari merged commit eeed4fd into master Feb 12, 2024
9 of 11 checks passed
@vigneshhari vigneshhari deleted the location_uptime branch February 12, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants