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

[doc] Add specifications for calendriers.txt #529

Merged
merged 1 commit into from
Feb 3, 2020

Conversation

woshilapin
Copy link
Contributor

I copy/pasting an example here of a calendar.txt and a calendar_dates.txt, as well as the expected results in calendriers.xml.

calendar.txt

service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
service_one,0,0,0,0,0,1,1,20190710,20190720

calendar_dates.txt

service_id,date,exception_type
service_one,20190714,1
service_one,20190715,0
service_two,20191225,0

calendriers.xml

<?xml version="1.0" encoding="UTF-8"?>                          
<PublicationDelivery
    version="1.09:FR-NETEX_LIGNE-2.1-1.0"
    xmlns="http://www.netex.org.uk/netex"
    xmlns:core="http://www.govtalk.gov.uk/core"
    xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:ifopt="http://www.ifopt.org.uk/ifopt"
    xmlns:siri="http://www.siri.org.uk/siri"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.netex.org.uk/netex">                        
  <PublicationTimestamp>2019-04-03T17:19:00</PublicationTimestamp>
  <ParticipantRef>Participant</ParticipantRef>
  <dataObjects>                                                                                                                              
    <GeneralFrame id="FR:GeneralFrame:NETEX_CALENDRIER:LOC" version="any">   
      <ValidBetween>                                                                                                             
        <FromDate>2019-07-09T00:00:00Z</FromDate>               
        <ToDate>2019-08-07T23:59:59Z</ToDate>                                                                              
      </ValidBetween>           
      <members>                                                                                                                  
        <!-- Service from the 10 to 20 of July 2019 only on weekend days -->                 
        <!-- The 14th which is Sunday is removed -->                         
        <!-- The 15th which is a Monday is added -->
        <DayType id="FR:DayType:service_one:LOC" version="any">                                
          <properties>           
            <PropertyOfDay>                                                                                    
              <DaysOfWeek>Saturday</DaysOfWeek>
            </PropertyOfDay>
            <PropertyOfDay>                                                                                    
              <DaysOfWeek>Sunday</DaysOfWeek>
            </PropertyOfDay>                                                                                   
          </properties>                  
        </DayType>          
        <!-- Only to define the 25th of December 2019 -->                                      
        <DayType id="FR:DayType:service_two:LOC" version="any" />
        <OperatingPeriod id="FR:OperatingPeriod:service_one:LOC" version="any">
          <FromDate>2019-07-10T00:00:00Z</FromDate>       
          <ToDate>2019-07-20T23:59:59Z</ToDate>
        </OperatingPeriod>
        <DayTypeAssignment id="FR:DayTypeAssignment:service_one:LOC" version="any" order="0">
          <OperatingPeriodRef ref="FR:OperatingPeriod:service_one:LOC" version="any" />
          <DayTypeRef ref="FR:DayType:service_one:LOC" version="any" />
        </DayTypeAssignment>
        <DayTypeAssignment id="FR:DayTypeAssignment:service_one_1:LOC" version="any" order="1">
          <Date>2019-07-14</Date>
          <DayTypeRef ref="FR:DayType:service_one:LOC" version="any" />
          <isAvailable>false</isAvailable>
        </DayTypeAssignment>
        <DayTypeAssignment id="FR:DayTypeAssignment:service_one_2:LOC" version="any" order="2">
          <Date>2019-07-15</Date>
          <DayTypeRef ref="FR:DayType:service_one:LOC" version="any" />
          <isAvailable>true</isAvailable>
        </DayTypeAssignment>
        <DayTypeAssignment id="FR:DayTypeAssignment:service_two_1:LOC" version="any" order="1">
          <Date>2019-12-25</Date>
          <DayTypeRef ref="FR:DayType:service_two:LOC" version="any" />
          <!-- isAvailable is omitted, true is default -->
        </DayTypeAssignment>
      </members>
    </GeneralFrame>
  </dataObjects>
</PublicationDelivery>

@woshilapin woshilapin requested a review from prhod January 30, 2020 14:51
@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch from 39094f0 to abe339e Compare January 30, 2020 17:19
Copy link
Contributor

@prhod prhod left a comment

Choose a reason for hiding this comment

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

Can you check about UICOperatingPeriod ?

@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch from 138790f to 8638ae3 Compare January 31, 2020 10:38
@woshilapin
Copy link
Contributor Author

woshilapin commented Jan 31, 2020

Can you check about UICOperatingPeriod ?

So, both the following (and equivalent) XML passes the xmllint validation.

<members>                                                                              
  <DayType id="FR:DayType:service_one:LOC" version="any" />                            
  <ServiceCalendar id="FR:ServiceCalendar:service_one:LOC" version="any">              
      <dayTypes>                                                                       
          <DayTypeRef ref="FR:DayType:service_one:LOC" />                              
      </dayTypes>                                                                      
      <operatingPeriods>                                                               
          <UicOperatingPeriod id="FR:UicOperatingPeriod:service_one:LOC" version="any">
              <FromDate>2019-07-10T00:00:00Z</FromDate>                                
              <ValidDayBits>0100101000100101</ValidDayBits>                            
          </UicOperatingPeriod>                                                        
      </operatingPeriods>                                                              
  </ServiceCalendar>                                                                   
</members>                                                                             
<members>                                                                      
  <DayType id="FR:DayType:service_one:LOC" version="any" />                    
  <ServiceCalendar id="FR:ServiceCalendar:service_one:LOC" version="any">      
      <dayTypes>                                                               
          <DayTypeRef ref="FR:DayType:service_one:LOC" />                      
      </dayTypes>                                                              
      <operatingPeriods>                                                       
          <OperatingPeriodRef ref="FR:UicOperatingPeriod:service_one:LOC" />   
      </operatingPeriods>                                                      
  </ServiceCalendar>                                                           
  <UicOperatingPeriod id="FR:UicOperatingPeriod:service_one:LOC" version="any">
      <FromDate>2019-07-10T00:00:00Z</FromDate>                                
      <ValidDayBits>0100101000100101</ValidDayBits>                            
  </UicOperatingPeriod>                                                        
</members>                                                                     

Note how in the second I use OperatingPeriodRef to refer to a UicOperatingPeriod (so it does seems to work in the end?). This made me test again a structure based on DayTypeAssignment which indeed passes the xmllint validation (this XML tag order got me again it seems).

<members>                                                                              
  <DayType id="FR:DayType:service_one:LOC" version="any" />                            
  <DayTypeAssignment id="FR:DayTypeAssignment:service_one:LOC" version="any" order="0">
      <OperatingPeriodRef ref="FR:UicOperatingPeriod:service_one:LOC" />               
      <DayTypeRef ref="FR:DayType:service_one:LOC" />                                  
  </DayTypeAssignment>                                                                 
  <UicOperatingPeriod id="FR:UicOperatingPeriod:service_one:LOC" version="any">        
      <FromDate>2019-07-10T00:00:00Z</FromDate>                                        
      <ValidDayBits>0100101000100101</ValidDayBits>                                    
  </UicOperatingPeriod>                                                                
</members>                                                                                                                                                        

If I understand correctly, the 3 above versions are strictly identical in term of modeling (thanks NeTEx for all these possibilities, I'm sure I can come up with half a dozen more other options!). Which one should we adopt? Maybe the latest one is the simplest and also the closest from IDF profile?

@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch 2 times, most recently from 2039c44 to d5c737a Compare January 31, 2020 13:11
@woshilapin
Copy link
Contributor Author

I changed the specification to integrate UicOperatingPeriod. In order to reflect the changes, below is the same example than in the PR first comment... but with the new format now.

calendar.txt

service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
service_one,0,0,0,0,0,1,1,20190710,20190720

calendar_dates.txt

service_id,date,exception_type
service_one,20190714,1
service_one,20190715,0
service_two,20191225,0

calendriers.xml

<?xml version="1.0" encoding="UTF-8"?>                          
<PublicationDelivery
    version="1.09:FR-NETEX_LIGNE-2.1-1.0"
    xmlns="http://www.netex.org.uk/netex"
    xmlns:core="http://www.govtalk.gov.uk/core"
    xmlns:gml="http://www.opengis.net/gml/3.2"
    xmlns:ifopt="http://www.ifopt.org.uk/ifopt"
    xmlns:siri="http://www.siri.org.uk/siri"
    xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.netex.org.uk/netex">                        
  <PublicationTimestamp>2019-04-03T17:19:00</PublicationTimestamp>
  <ParticipantRef>Participant</ParticipantRef>
  <dataObjects>                                                                                                                              
    <GeneralFrame id="FR:GeneralFrame:NETEX_CALENDRIER:LOC" version="any">   
      <ValidBetween>                                                                                                             
        <FromDate>2019-07-09T00:00:00Z</FromDate>               
        <ToDate>2019-08-07T23:59:59Z</ToDate>                                                                              
      </ValidBetween>           
      <members>                                                                                                                  
        <!-- Service from the 10 to 20 of July 2019 only on weekend days -->                 
        <!-- The 14th which is Sunday is removed -->                         
        <!-- The 15th which is a Monday is added -->
        <DayType id="FR:DayType:service_one:LOC" version="any" />
        <!-- Only to define the 25th of December 2019 -->                                      
        <DayType id="FR:DayType:service_two:LOC" version="any" />
        <DayTypeAssignment id="FR:DayTypeAssignment:service_one:LOC" version="any" order="0">
          <OperatingPeriodRef ref="FR:OperatingPeriod:service_one:LOC" version="any" />
          <DayTypeRef ref="FR:DayType:service_one:LOC" version="any" />
        </DayTypeAssignment>
        <DayTypeAssignment id="FR:DayTypeAssignment:service_two:LOC" version="any" order="0">
          <OperatingPeriodRef ref="FR:OperatingPeriod:service_two:LOC" version="any" />
          <DayTypeRef ref="FR:DayType:service_two:LOC" version="any" />
        </DayTypeAssignment>
        <UicOperatingPeriod id="FR:OperatingPeriod:service_one:LOC" version="any">
          <FromDate>2019-07-10T00:00:00Z</FromDate>       
          <ValidDayBits>00010100001</ValidDayBits>
        </UicOperatingPeriod>
        <UicOperatingPeriod id="FR:OperatingPeriod:service_two:LOC" version="any">
          <FromDate>2019-12-25T00:00:00Z</FromDate>       
          <ValidDayBits>1</ValidDayBits>
        </UicOperatingPeriod>
      </members>
    </GeneralFrame>
  </dataObjects>
</PublicationDelivery>

@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch from d5c737a to e03634b Compare January 31, 2020 13:21
prhod
prhod previously requested changes Jan 31, 2020
@mergify mergify bot dismissed prhod’s stale review January 31, 2020 13:36

Pull request has been modified.

@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch from 315dd5d to f2ce1b4 Compare January 31, 2020 13:36
prhod
prhod previously approved these changes Jan 31, 2020
@woshilapin woshilapin force-pushed the netex-france-specs-calendars branch from f2ce1b4 to a61107a Compare February 3, 2020 15:22
@mergify mergify bot dismissed prhod’s stale review February 3, 2020 15:23

Pull request has been modified.

@woshilapin
Copy link
Contributor Author

I just rebased this PR before merging it. It was approved by @prhod already.

@woshilapin woshilapin merged commit 8f3f237 into hove-io:master Feb 3, 2020
@woshilapin woshilapin deleted the netex-france-specs-calendars branch February 3, 2020 15:35
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.

2 participants