I'm still very new at programing and I'm sitting with a mental block as to how I can overcome my issue. Some advice or pointers would be appreciated.
I am trying to build a pilots logbook.
Looking at the aircraft, you are supposed to log the following data for each flight:
Type of aircraft
If the type is a single- or multi engine aircraft
Registration of aircraft.
For instance:
Boeing 747
Multi engine
N1234ABC
All Boeing 747s will of course be classified as multi engine aircraft, but you may fly more than one registation of the type.
Now, using tkinter, and to avoid mistakes, 2 comboboxes for the above (multi/single should be known in background for selected type), how do I connect them?
So first combobox will be 'type' and then the next ('registration') must only show registrations for the specific type.
My idea was something like below:
aircrafts = {
{'Boeing747': ['ME', 'N123ABC', 'N111AAA', 'N462AUF'},
{'type2': [se, reg1, reg2, reg3},
{'type3': [me, reg1, reg2, reg3, reg4}
}
When the data gets logged, it can use the first item in the list to find out if it is single/multi engined, to ensure the hours flown gets logged under the correct column.
Am I planning in the right direction, or is there an easier/better way of doing this?
And I think I have a solution.
Two separate dictionaries.
One for all single engined aircraft, and one for multi engined aircraft.
Then, I can combine the keys of borh in a list for combobox values. By aelecting a value, the dunction can search both dictionaries for it, to find the relevant registrations.
Am I right?
Related
Problem: I’m a nurse, and part of my job is to pull up a list of “unsigned services”. Then of course, take these charts, and send them to the right person.
The person before me did not do this, leaving me THOUSANDS of charts to pull up by patient name and DOB, select the right document, and send to the right person.
I have figured out how to use selenium with python to automate logging in, using input to send keys to search the correct patient, and even to pull up the correct document that needs signed.
How do I have the program do this, for every chart? How do I have python work down the list of names and DOB’s without my having to manually put them in?
Anything I look for on my own is just examples of applying a basic function to a list of numbers and that isn’t my goal.
Thanks for your help!
Below is an example of the data that I have within my Firestore Application.
I am looking to update the "prices" object using python, is this a possibility? I am finding it increasingly hard to get all the way to the data.
I don't want you to code this for me, i'm merly asking if it is possible and just some quick guidance on how to achieve it.
My api will fetch prices, then find the "ID" of the specific conditions which is stored in the "id" field within the condtion array, if will then update the "prices" object of that found id.
Like I said, is this possible? And a few pointers on how to achieve this would be great!
Kind Regards,
Josh
Updating just one field of an array item is not possible.
The most you could do would be to update only an entire array item. You can do this with arrayRemove() and arrayUnion(). More info in the docs
The situation
While reading the Bible (as context) I'd like to point out certain dependencies e.g. of people and locations. Due to swift expandability I'm choosing Python to handle this versatile data. Currently I'm creating many feature vectors independent from each other, containing various information as the database.
In the end I'd like to type in a keyword to search in this whole database, which shall return everything that is in touch with it. Something simple as
results = database(key)
What I'm looking for
Unfortunately I'm not a Pro about different database handling possibilities and I hope you can help me finding an appropriate option.
Are there possibilities that can be used out of the box or do I need to create all logic by myself?
This is a little vague so I'll try to handle the People and Location bit of it to help you get started.
One possibility is to build a SQLite database. (The sqlite3 library + documentation is relatively friendly). Also here's a nice tutorial on getting started with SQLite.
To start, you can create two entity tables:
People: contains details about every person in bible.
Locations: contains details about every location in bible.
You can then create two relationship tables that reference people and locations (as Foreign Keys). For example, one of these relationship tables might be
People_Visited_Locations: contains information about where each person visited in their lifetime. The schema might looks something like this:
| person (Foreign Key)| location (Foreign Key) | year |
Remember that Foreign Key refers to an entry in another table. In our case, person is an existing unique ID from your entity table People, location is an existing unique ID from your entity table Locations, and year could be the year that person went to that location.
Then to fetch every place that some person, say Adam in the bible visited, you can create a Select statement that returns all entries in People_Visited_Locations with Adam as person.
I think key (pun intended) takeaway is how Relationship tables can help you map relationships between entities.
Hope this helps get you started :)
I want to design a user tracking system between different models. There is a Module table which is related to sections and sections are related to sub-sections. Each sub-section can relate to different independent tables. The independent tables store different items (slides, videos, texts) which the user can go through in a linear flow just like a Coursera course. The flow will be predetermined by us but can be changed by us. So, the linear flow between the sub-sections can't be hardcoded. I also need to keep track of the user's progress through these sub-sections.
For Example:
A sub-section can point to game table where the user_info, game_score, game_completion_date_time will be stored or there might be case where the sub-section is pointing to slides table storing slide_text, slide_url and user_info.
I want to keep track of changes in those table so what should be my approach. Below i have posted an image in which i am approaching to the problem.
You might make a 'courseflows' table with the order being a sequence of comma-separated integers for ids in the proper order, then parse through that sequence when presenting sections to the user. Add whatever other information you need, and a timestamp so that any new users are assigned the most recent flow. By linking this, you can also preserve any user's flow in case you change it while users are halfway through.
I would also consider using different secondary tables to mark user completion of each module, section, and subsection instead of just one.
Let's assume I am developing a service that provides a user with articles. Users can favourite articles and I am using Solr to store these articles for search purposes.
However, when the user adds an article to their favourites list, I would like to be able to figure out out which articles the user has added to favourites so that I can highlight the favourite button.
I am thinking of two approaches:
Fetch articles from Solr and then loop through each article to fetch the "favourite-status" of this article for this specific user from MySQL.
Whenever a user favourites an article, add this user's ID to a multi-valued column in Solr and check whether the ID of the current user is in this column or not.
I don't know the capacity of the multivalued column... and I also don't think the second approach would be a "good practice" (saving user-related data in index).
What other options do I have, if any? Is approach 2 a correct approach?
I'd go with a modified version of the first one - it'll keep user specific data that's not going to be used for search out of the index (although if you foresee a case where you want to search for favourite'd articles, it would probably be an interesting field to have in the index) for now. For just display purposes like in this case, I'd take all the id's returned from Solr, fetch them in one SQL statement from the database and then set the UI values depending on that. It's a fast and easy solution.
If you foresee that "search only in my fav'd articles" as a use case, I would try to get that information into the index as well (or other filter applications against whether a specific user has added the field as a favourite). I'd try to avoid indexing anything more than the user id that fav'd the article in that case.
Both solutions would however work, although the latter would require more code - and the required response from Solr could grow large if a large number of users fav's an article, so I'd try to avoid having to return a set of userid's if that's the case (many fav's for a single article).