Skip to content

Commit

Permalink
track r25 reservation profile_name change
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeseibel committed Jun 18, 2024
1 parent dea0936 commit 643d9f0
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 52 deletions.
45 changes: 41 additions & 4 deletions scheduler/org/uw/reservations.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,53 @@


from scheduler.reservations.r25 import R25Reservations
import logging
import re


logger = logging.getLogger(__name__)


class Reservations(R25Reservations):
"""
University of Washington reservation profile definitions
The general profile_name format is "MWF 1050-1150 LC 06/17"
where:
- first field holds course meeting days
- second field holds course meeting start and end time
- third field is type of course, which could be:
- LC: lecture
- SM: seminar
- QZ: quiz
- LB: Lab
- ST: Studio
- CL: clinic, usually off site or departmental clinic spaces
- CK: clerkship
- CO: conference
- PR: practicum
- fourth field is course start date
"""

profile_name_re = re.compile(r'^(?P<meeting_day>[A-Z]+)\s'
r'(?P<start_time>\d{4})-(?P<end_time>\d{4})\s'
r'(?P<course_type>[A-Z]{2})\s'
r'(?P<start_date>\d{2}/\d{2})$')

@property
def instruction_profiles(self):
return ['lecture', 'seminar', 'quiz']
return ['LC', 'SM', 'QZ']

@property
def course_profiles(self):
return self.instruction_profiles + ['lab', 'final']
return self.instruction_profiles + ['LB']

def course_type(self, profile):
try:
fields = self.profile_name_re.match(profile.upper())
return fields.group('course_type')
except AttributeError:
pass

def profile_name(self, profile):
return profile.split()[-1].lower() if profile else ''
logger.info('Unknown reservation profile: {}'.format(profile))
return ''
8 changes: 4 additions & 4 deletions scheduler/reservations/r25.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _reservation_from_r25(self, r25):
"""Map r25 reservation resourse into a Reservation model"""
return Reservation(
event_name=r25.event_name,
profile_name=self.profile_name(r25.profile_name),
profile_name=r25.profile_name or '',
contact_name=r25.contact_name,
contact_email=r25.contact_email or '',
space_id=str(r25.space_reservation.space_id) if (
Expand All @@ -45,9 +45,9 @@ def _reservation_from_r25(self, r25):
r25.space_reservation) else None,
space_formal_name=r25.space_reservation.formal_name if (
r25.space_reservation) else None,
is_course=(self.profile_name(r25.profile_name)
is_course=(self.course_type(r25.profile_name)
in self.course_profiles),
is_instruction=(self.profile_name(r25.profile_name)
is_instruction=(self.course_type(r25.profile_name)
in self.instruction_profiles),
start_datetime=r25.start_datetime,
end_datetime=r25.end_datetime)
Expand All @@ -62,7 +62,7 @@ def course_profiles(self):
"""R25 profile names indicating course and/or instruction related"""
return []

def profile_name(self, profile):
def course_type(self, profile):
return profile or ''

def get_space_by_id(self, space_id):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<r25:events xmlns:r25="http://www.collegenet.com/r25" xmlns:xl="http://www.w3.org/1999/xlink" pubdate="2014-10-08T09:51:09-07:00"/>
"
"
5,r25,/r25ws/servlet/wrd/run/event.xml?alien_uid=LYNX-EV-104-20133-CHEM140A,200,KGRwMAou,"<?xml version="1.0"?>
<r25:events xmlns:r25="http://www.collegenet.com/r25" xmlns:xl="http://www.w3.org/1999/xlink" pubdate="2014-10-29T15:39:31-07:00">
<r25:event xl:href="event.xml?event_id=602914" id="CBJDNjAyOTE0" crc="00000027" status="est">
Expand Down Expand Up @@ -46,7 +46,7 @@
</r25:organization>
<r25:profile id="CSJDMTg3NjAyMggSQzYwMjkxNA==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=1876022">1876022</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MTWTF 1030-1120 LC 09/30</r25:profile_name>
<r25:profile_code>W1 MO TU WE TH FR 20141205T235900-0800</r25:profile_code>
<r25:profile_description>From 10:30 AM to 11:20 AM.
Starting on WED SEP/24/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</r25:organization>
<r25:profile id="CSJDMTk2MzY5OAgSQzU5NzQ4Mg==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=1963698">1963698</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 1330-1420 LC 09/24</r25:profile_name>
<r25:profile_code>W1 MO WE FR 20141205T235900-0800</r25:profile_code>
<r25:profile_description>From 01:30 PM to 02:20 PM.
Starting on WED SEP/24/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</r25:organization>
<r25:profile id="CSJDMTk2NTg3NwgSQzU5OTAzMQ==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=1965877">1965877</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MTWTF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_code>W1 MO TU WE TH FR 20141205T235900-0800</r25:profile_code>
<r25:profile_description>From 08:30 AM to 09:20 AM.
Starting on WED SEP/24/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</r25:organization>
<r25:profile id="CSJDMTk3NzQ0OAgSQzYwMTQwOQ==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=1977448">1977448</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/24</r25:profile_name>
<r25:profile_code>W1 MO WE FR 20141205T235900-0800</r25:profile_code>
<r25:profile_description>From 08:30 AM to 09:20 AM.
Starting on WED SEP/24/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</r25:organization>
<r25:profile id="CSJDMTg3NjAyMggSQzYwMjkxNA==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=1876022">1876022</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MTWTF 1030-1120 LC 09/24</r25:profile_name>
<r25:profile_code>W1 MO TU WE TH FR 20141205T235900-0800</r25:profile_code>
<r25:profile_description>From 10:30 AM to 11:20 AM.
Starting on WED SEP/24/2014.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</r25:organization>
<r25:profile id="CSJDMjA1Mjk2NggSQzY1NjYyNg==" crc="00000021" status="est">
<r25:profile_id xl:href="ev_profile.xml?profile_id=2052966">2052966</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MTWTF 1330-1420 LC 09/30</r25:profile_name>
<r25:profile_code>W1 MO TU WE TH FR 20151211T235900-0800</r25:profile_code>
<r25:profile_description>From 01:30 PM to 02:20 PM.
Starting on WED SEP/30/2015.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<r25:post_event_dt>2015-12-02T09:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T09:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2129930</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 08:30 AM to 09:20 AM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -88,7 +88,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T10:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T10:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2130020</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 09:30 AM to 10:20 AM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -166,7 +166,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T10:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T10:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2130019</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 09:30 AM to 10:20 AM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -244,7 +244,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T12:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T12:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2052957</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 10:30 AM to 12:20 PM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -322,7 +322,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T13:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T13:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2130084</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 12:30 PM to 01:20 PM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -400,7 +400,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T14:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T14:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2040380</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 01:30 PM to 02:20 PM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down Expand Up @@ -478,7 +478,7 @@ Repeat every week
<r25:post_event_dt>2015-12-02T15:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2015-12-02T15:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>2078591</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0950 LC 09/30</r25:profile_name>
<r25:profile_description>From 02:30 PM to 03:20 PM.
Starting on WED SEP/30/2015.
Repeat every week
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<r25:post_event_dt>2014-12-01T09:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T09:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1978685</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 08:30 AM to 09:20 AM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -88,7 +88,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T10:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T10:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1953421</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 09:30 AM to 10:20 AM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -166,7 +166,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T11:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T11:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1964455</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 10:30 AM to 11:20 AM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -244,7 +244,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T12:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T12:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1964464</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 11:30 AM to 12:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -322,7 +322,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T13:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T13:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1918763</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 12:30 PM to 01:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -400,7 +400,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T14:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T14:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1963698</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 01:30 PM to 02:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -478,7 +478,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T15:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T15:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1964310</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0830-0920 LC 09/24</r25:profile_name>
<r25:profile_description>From 02:30 PM to 03:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -556,7 +556,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T17:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T17:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1964567</r25:profile_id>
<r25:profile_name>SEMINAR</r25:profile_name>
<r25:profile_name>M 1530-1720 SM 09/24</r25:profile_name>
<r25:profile_description>From 03:30 PM to 05:20 PM.
Starting on MON SEP/29/2014.
Repeat every week
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<r25:post_event_dt>2014-12-01T10:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T10:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1968985</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 09:30 AM to 10:20 AM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -88,7 +88,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T11:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T11:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1876550</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 10:30 AM to 11:20 AM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -166,7 +166,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T12:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T12:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1966516</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 11:30 AM to 12:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -244,7 +244,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T13:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T13:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1963273</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 12:30 PM to 01:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -322,7 +322,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T14:20:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T14:20:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1966111</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 01:30 PM to 02:20 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down Expand Up @@ -400,7 +400,7 @@ Repeat every week
<r25:post_event_dt>2014-12-01T16:50:00-08:00</r25:post_event_dt>
<r25:reservation_end_dt>2014-12-01T16:50:00-08:00</r25:reservation_end_dt>
<r25:profile_id>1893015</r25:profile_id>
<r25:profile_name>LECTURE</r25:profile_name>
<r25:profile_name>MWF 0930-1020 LC 09/30</r25:profile_name>
<r25:profile_description>From 02:30 PM to 04:50 PM.
Starting on WED SEP/24/2014.
Repeat every week
Expand Down
Loading

0 comments on commit 643d9f0

Please sign in to comment.