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

Add AT submission import #4620

Open
wants to merge 37 commits into
base: develop
Choose a base branch
from
Open

Add AT submission import #4620

wants to merge 37 commits into from

Conversation

perryr16
Copy link
Contributor

@perryr16 perryr16 commented Apr 10, 2024

Any background context you want to provide?

Sharing buildings between admins and users on Audit Template is non trivial. Resulting imports from AT might not contain all relevent buildings to the user. The existing city submission endpoint circumvents this issue.

What's this PR do?

  • Integrates the audit template city submission endpoint into SEED through a batch_get_city_submission_xml function. This is the driving function behind the new functionality, and it performs the following:
    1. returns the submissions from AT for a given city.
    2. finds matching SEED views using custom_id_1 and cycle start/end.
    3. gets xmls from AT for matching SEED views
    4. groups the data by cycles
    5. leverages existing function batch_update_with_building_sync in cycle batches.
  • Adds the ability to automatically update your inventory on a schedule. This is done through a new model AuditTemplateConfig and accompanying viewset (similar to Salesforce integration).
  • Adds new org fields audit_template_city_id and audit_template_sync_enabled
  • Front end modal to start city submission import.
  • Refactors the existing Audit Template endpoints to use fewer requests to the AT API.
  • Adds a developer test to aid in future submission related work
  • Other small refactors

Limitations and Potential Issues

  • Audit template submission responses do not contain an audit date, all we have is 'updated_at' or 'created_at'. Changing the status of a submission will reset its 'updated_at', this will change the matching view to the view in the current year's cycle. Would 'created_at' make more sense?
  • Submissions endpoint only returns submissions that are marked as 'Received'

How should this be manually tested?

This can only be tested with an Audit Template account that has submissions. Example: 179D AT account.

  • make sure AUDIT_TEMPLATE_HOST is pointed to the url associated with your AT account
  • Because properties are only updated if the Submission's updated_field is more recent than the property's updated field this can only be tested on a cycle containing today's date.
  • Within the current year's cycle, update properties Custom ID 1s to the Portal IDs on Audit Template cities page
  • Update submissions to allow matching. To update a submission on Audit Template, click the gear on a submission and change its status to "Review" then back to "Received"
  • From organization settings > audit template, manually trigger a sync with the "Sync Submissions" button
  • Properties should have been updated. Total properties updated can be misleading if there are duplicate AT Portal IDs
  • Test the auto sync function
  • From org settings > audit template, enable "Audit Template Auto Sync" and set time to the next minute.
  • Ensure properties were updated.

What are the relevant tickets?

#4544

Screenshots (if appropriate)

Screenshot 2024-04-30 at 10 32 00 AM

Screenshot 2024-04-30 at 10 32 24 AM

@perryr16 perryr16 added DO NOT MERGE Feature Add this label to new features. This will be reflected in the change log when generated. labels Apr 10, 2024


# For developer use only. Must be run with live submission data.
class AuditTemplateSubmissionImport(TestCase):
Copy link
Contributor Author

@perryr16 perryr16 Apr 25, 2024

Choose a reason for hiding this comment

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

These tests were very valuable in the development of the submission features. They must be run with live data so they aren't relavent for CI, but could be useful to future developers

@perryr16 perryr16 marked this pull request as ready for review April 30, 2024 16:40
@perryr16 perryr16 requested a review from kflemin May 6, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Add this label to new features. This will be reflected in the change log when generated.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant