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

Not booking slot for 18+ criteria #97

Closed
520rahul opened this issue Jul 8, 2021 · 13 comments
Closed

Not booking slot for 18+ criteria #97

520rahul opened this issue Jul 8, 2021 · 13 comments
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@520rahul
Copy link

520rahul commented Jul 8, 2021

@SRvSaha as mentioned in issue #96 and #71 i tried to book slot today for 45 plus age and for a new age criteria slots were open i.e. 18+ it means all person 18+ but in front of me 5 centres came And gone but repo did not detected a single centre. I had to book it manually. I put minimum ag aa 18 and max as 99. I think there is a bug in repo because i always failed to book slot for 45+ using repo. But for 18-44 its very easy using repo. Plz look into repo and test why tis repo is not working on 45+. And plz check dose type and dose name criteria also may be there must b some bug

@SRvSaha
Copy link
Owner

SRvSaha commented Jul 8, 2021

@520rahul You may check the logic here:

private bool IsFiltrationCriteriaSatisfied(Session session)
{
bool isAgeCriteriaMet = IsAgeFilterSatisfied(session);
if (!isAgeCriteriaMet)
return false;
bool isVaccineAvailable = IsMinimumVaccineAvailabilityFilterSatisfied(session);
if (!isVaccineAvailable)
return false;
bool isVaccineTypeCriteriaMet = IsVacineTypeFilterSatisfied(session);
if (!isVaccineTypeCriteriaMet)
return false;
bool isVaccineFeeTypeCriteriaMet = IsVacineFeeTypeFilterSatisfied(session);
if (!isVaccineFeeTypeCriteriaMet)
return false;
return FilteredResult(isAgeCriteriaMet, isVaccineAvailable, isVaccineTypeCriteriaMet, isVaccineFeeTypeCriteriaMet);
}

On High Level, logic is:

Consider Only those Centres where:

  1. Slots are open for MIN_AGE >= MIN_AGE_SET_IN_CONFIG and MIN_AGE < MAX_AGE_SET_IN_CONFIG (
    private bool IsAgeFilterSatisfied(Session session)
    {
    bool minimumAgeLimitFilter = (session.MinAgeLimit >= Convert.ToInt16(_configuration["CoWinAPI:MinAgeLimit"]));
    bool maximumAgeLimitFilter = (session.MinAgeLimit < Convert.ToInt16(_configuration["CoWinAPI:MaxAgeLimit"]));
    return minimumAgeLimitFilter && maximumAgeLimitFilter;
    }
    )
  2. Slot Availability for DOSE TYPE : DOSE_TYPE_MENTIONED_IN_CONFIG (
    private bool IsMinimumVaccineAvailabilityFilterSatisfied(Session session)
    {
    bool minimumVaccineAvailabiltyFilter;
    var availableVaccines = GetVaccineAvailabiltyForDoseType(session);
    minimumVaccineAvailabiltyFilter = availableVaccines >= Convert.ToInt16(_configuration["CoWinAPI:MinimumVaccineAvailability"]);
    return minimumVaccineAvailabiltyFilter;
    }
    )
  3. Slot Check Based on VACCINE_TYPE_IN_CONFIG (Optional) (
    private bool IsVacineTypeFilterSatisfied(Session session)
    {
    return string.IsNullOrEmpty(_configuration["CoWinAPI:VaccineType"]) || (session.Vaccine.ToUpper() == _configuration["CoWinAPI:VaccineType"].ToUpper().Trim());
    }
    )
  4. Slot Check Based on VACCINE_FEE_TYPE (Optional) (
    private bool IsVacineFeeTypeFilterSatisfied(Session session)
    {
    // Filter Based on VaccineFeeType only when fee type is provided; otherwise don't filter. Keep both Paid and Free Slots
    return string.IsNullOrEmpty(_configuration["CoWinAPI:VaccineFeeType"]) || (session.FeeType.ToUpper() == _configuration["CoWinAPI:VaccineFeeType"].ToUpper().Trim());
    }
    )

I think it should work for 45+ as well.
Only thing is that if slots open for say 18+ & above, in that case the Min Age is 18 and Max should be say 99. If Min is set to 45, no slots will get found.

Need to check that. You can check that part at your end also for the above logic shared.

@520rahul
Copy link
Author

520rahul commented Jul 8, 2021

@SRvSaha i put the same age criteria as mentioned by you i.e minimum 18 max 99 during booking but repo did not detected any centres. I have checked all my settings, still not able to find where is the problem for 45+ appointments

@SRvSaha
Copy link
Owner

SRvSaha commented Jul 8, 2021

Okay I will check @520rahul Share your config after removing the Confidential Info

@Tnu02
Copy link

Tnu02 commented Jul 8, 2021

I tried booking for 2nd dose for 45+ with dosetype 2 and age between 18 to 60, it worked in my case.

@520rahul
Copy link
Author

520rahul commented Jul 8, 2021

I tried booking for 2nd dose for 45+ with dosetype 2 and age between 18 to 60, it worked in my case.

@Tnu02 can u share your configuration plz. And what kind of slot it was whether 18+ or 18-44 or 45+

@SRvSaha
Copy link
Owner

SRvSaha commented Jul 8, 2021

@520rahul Because of #96 related changes, there are changes in the way data is being returned.
Earlier, both min_age and max_age used to get returned even though max_age was useless and was never used in any computations.

Now, they send min_age and allow_all_age and as such there are three possiblilities:

  • 18 & Above -> min_age_limit = 18, allow_all_age = true : In this scenario, you'll be able to book for both 18+ and 45+. Configuration Should Be "MinimumAge": 18, "MaximumAge": 100

image

  • 18-44 only-> min_age_limit = 18, max_age_limit = 44, allow_all_age = false : In this scenario, you'll be able to book for 18-44 age group only. Configuration Should Be "MinimumAge": 18, "MaximumAge": 44

image

  • 45 & Above -> min_age_limit = 45, allow_all_age = false : In this scenario, you'll be able to book slots when they get opened specificially for 45+. Configuration Should Be "MinimumAge": 45, "MaximumAge": 100

image

So, I feel majority of the time you need to be using Option 1 unless you are sure that slots will be opened for Option 3 specifically, in case you are trying to booking for 45+ age group.

@Tnu02
Copy link

Tnu02 commented Jul 8, 2021

@520rahul I did it for 18+ and above, now 45+ slots are also opening under the same at my location. You should also check once.

"MinAgeLimit": 18,
"MaxAgeLimit": 60,
"MinimumVaccineAvailability": 1,
"VaccineType": "",
"DoseType": 2,
"VaccineFeeType": "Free",
"SlotPreference": "Random",

@520rahul
Copy link
Author

520rahul commented Jul 8, 2021

Okay I will check @520rahul Share your config after removing the Confidential Info

@SRvSaha this is my settings:-
{
"CoWinAPI": {
"PublicAPI": {
"FetchByDistrictUrl": "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByDistrict",
"FetchByPINUrl": "https://cdn-api.co-vin.in/api/v2/appointment/sessions/public/findByPin"
},
"ProtectedAPI": {
"IsToBeUsed": false, // Set this to false if you want to search slots using Public API
"FetchByDistrictUrl": "https://cdn-api.co-vin.in/api/v2/appointment/sessions/findByDistrict",
"FetchByPINUrl": "https://cdn-api.co-vin.in/api/v2/appointment/sessions/findByPin",
"ScheduleAppointmentUrl": "https://cdn-api.co-vin.in/api/v2/appointment/schedule",
"AppointmentSlipUrl": "https://cdn-api.co-vin.in/api/v2/appointment/appointmentslip/download",
"BeneficiaryIds": [ "11112222333344" ]
},
"Auth": {
"IsToBeUsed": true,
"OTPGeneratorUrl": "https://cdn-api.co-vin.in/api/v2/auth/generateMobileOTP",
"OTPValidatorUrl": "https://cdn-api.co-vin.in/api/v2/auth/validateMobileOtp",
"Secret": "U2FsdGVkX18vDwDor+oOIG7vSUnINtlc/pxQcNiBulCm8LT5Sza+aIISKLqImbpMnRYgsN2QACPhggLWgZEpQg==",
"Mobile": "9999999999"
},
"SleepIntervalInMilliseconds": 1000,
"IsThrottlingToBeUsed": true, // Use either true or false; By default true; True means IP throttling is inplace, False means IP throttling has been removed
"ThrottlingThreshold": 10000, //Number of request per IP allowed for ThrottlingInterval
"ThrottlingIntervalInMinutes": 50,
"ThrottlingRefreshTimeInSeconds": 1, // Waiting Time when IP is throttled, before resuming the application again. Set the value Higher if you want more wait time when you IP is throttled, or Lower if you are in hurry to book (with chances of getting IP throttled more frequently)
"TotalIterations": 10000,
"SelfRegistrationPortal": "https://selfregistration.cowin.gov.in",
"MinAgeLimit": 18,
"MaxAgeLimit": 99,
"MinimumVaccineAvailability": 1,
"VaccineType": "COVISHIELD", // Blank Implies Any VaccineType: COVISHIELD OR COVAXIN OR SPUTNIK V; Default is any type of Vaccine
"DoseType": 2,
"VaccineFeeType": "Free", // Blank Implies Any VaccineFeeType: Free or Paid; Default is Free
"SlotPreference": "Last", // Preference of Slot of Booking, use either First or Last or Random; Default is Last (due to higher changes of getting the slot)
"IsSearchToBeDoneForVaccinationCentreName": false, // Set this is true if you want to search for specific Centres within your PINCode/District
"VaccinationCentreNames": [ // Don't change me if you are not setting IsSearchToBeDoneForVaccinationCentreName as true
"REPLACE_ME_WITH_YOUR_VACCINATION_CENTER_NAME_1",
"REPLACE_ME_WITH_YOUR_VACCINATION_CENTER_NAME_2"
], // You need to put the exact names of the Vaccination Centres for which you want to search. You'll get that from CoWIN Portal
"IsSearchToBeDoneByPINCode": true, // Set this as true if you want to set by PINCode
"PINCodes": [
"301001"
],
"IsSearchToBeDoneByDistrict": false, // Set this is true if you want to search By District
"Districts": [ // Don't change me if you are not setting IsSearchToBeDoneByDistrict as true
"REPLACE_ME_WITH_YOUR_DISTRICT_CODE_1",
"REPLACE_ME_WITH_YOUR_DISTRICT_CODE_2"
],
"DateToSearch": "" // DD-MM-YYYY Format, Blank implies tomorrow's day; Slots are searched ONLY FOR THE DATE in DateToSearch
},
"Proxy": {
"IsToBeUsed": "false",
"Address": ""
}
}

@govindasomani
Copy link

@SRvSaha i put the same age criteria as mentioned by you i.e minimum 18 max 99 during booking but repo did not detected any centres. I have checked all my settings, still not able to find where is the problem for 45+ appointments

I have successfully booked 2nd doses using min 18 max 99 for 45+ individuals

@520rahul
Copy link
Author

520rahul commented Jul 8, 2021

@SRvSaha sorry bother. I found my mistake. Slots were opened for today but i forgot to put date of today therefore repo searched for tomorrow’s slot. Sorry for my mistake. And thanks for giving your precious time. And thanks to @Tnu02 and @govindasomani also.

@520rahul 520rahul closed this as completed Jul 8, 2021
@SRvSaha SRvSaha self-assigned this Jul 8, 2021
@SRvSaha SRvSaha added the help wanted Extra attention is needed label Jul 8, 2021
@SRvSaha
Copy link
Owner

SRvSaha commented Jul 8, 2021

Okay great. @520rahul
Thanks @govindasomani @Tnu02 for inputs.

To overcome this kind of issue I am planning to create a proper full fledged FAQ.

It is in progress, contributions are welcome. See if you can contribute.

FAQs: https://github.com/SRvSaha/CoWinVaccineSlotFinder#faqs

@SRvSaha SRvSaha added the good first issue Good for newcomers label Jul 8, 2021
@SRvSaha SRvSaha pinned this issue Jul 8, 2021
@520rahul
Copy link
Author

520rahul commented Jul 8, 2021

Okay great. @520rahul
Thanks @govindasomani @Tnu02 for inputs.

To overcome this kind of issue I am planning to create a proper full fledged FAQ.

It is in progress, contributions are welcome. See if you can contribute.

FAQs: https://github.com/SRvSaha/CoWinVaccineSlotFinder#faqs

@SRvSaha your faq clears all the doubts. I have one point to share in point 2 where slot open for 18-44 u have mentioned max age to keep is 45 i think it would b 44. Plz check

@SRvSaha
Copy link
Owner

SRvSaha commented Jul 8, 2021

@520rahul No, 45 would work since it's not taking the Max Value. It's like Check it is less than Max Value. Yet, to be on the safer side, I am changing it to 44. Thanks

You may Add more Questions for FAQs which are usually the problems faced by end users or your faced, along with different possibilities to use the App.

@520rahul @Tnu02 @govindasomani Help Wanted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants