Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm currently working on a Facial recognition project which requires me to access images clicked by my phone on a computer. Is there a way in Python to automatically transfer images clicked by my phone to my computer through some servers or any other means, so that the python scripts running on my computer can fetch those images and process it?
Interesting project. I've not done this myself but it really depends on what you mean by "transfer images clicked" and the scope of how often and how many people will be sending photos from smartphone to backend python process.
If you have pictures already on your phone you can probably just go
to your Android/iPhone picture gallery and save or share them then
download to your system which does not involve Python. It's manual
but really easy for a one time dump.
If you want to automate the above steps and have them downloaded automatically you probably need to look into a
RESTful API for example google photo
api
then use a request library or something similar to pull them. Still
manual in terms of pushing your photos into one album but at least
you do not need to host anything and it's one click to download.
If you want to have others take photos and you host a back end that
may involve a web framework like flask or django and the
getUserMedia
method googling "getUserMedia" and <insert framework> can probably get you some pretty good starting points.
There are many ways of achieving this. They vary in the use and process that you are having. I will focus on a basic one, that has the virtue of persistence, thus, allowing you to resend and debug in cases of failure.
As this solution requires a big scope of integration I will outline the flow from which you can derive the different blocks needed to implement.
Basically, you transfer (upon taking them, once a day etc.) the pictures to a database that can be accessed from any device anywhere with your chosen API (given the DB etc.). Then, your scripts can fetch the "delta" of pictures that weren't processed yet.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Goal
Using an API, I can extract position and other data in real-time from a driving simulator to python console on the same computer. I want to then use if-else statements to trigger some actions on a different device. For example, if a car reaches point A in the simulator computer, then send a maths problem to the driver on a tablet (different device).
How can I connect these two devices (simulator and tablet) via python? I understand that on the tablet I can provide a GUI via an app.
My questions are:
Is the mentioned setup possible via python?
What will be the appropriate python package(s) for desktop app development for this use-case?
How can I synchronize/connect the two devices? via internet? some other way? What should I study to learn this setup?
Thank you!
If this is not the right place to ask this question, then please direct me to where should I ask this question.
Short Answer: Yes. You can do this via Python. You can use any database connector with Kafka or creating an API with Flask. To connect the two device, internet might be the best way. And for your use case, internal network will do the job.
You can set this up with python, in the question, you mentioned that you will are calling an API to get some results printed on the python console. I assume that this API will keep return you results.
The first way you can do this is to also write an API which calls this API, and use yield to take any incoming result and then go over the if else block. And from the tablet side, you can just calling this API which would call the other API running on your computer. You can do this by setting up a rest api in python. You might want to consider Flask.
The second way is you can pass those results get from calling the first api into a database. And from your tablet code, you can actively checking the database and use those results to calculate. You can either do this by hard checking the database every second or use a Kafka Producer/Consumer.
It seems the tablet only need to know whether the car reaches points all. So you on the desktop side, you can insert timestamp and the result(true or false) into a database. And on the tablet side, you just need to keep checking the database whether contains a true result and you can use that timestamp or any other data to help you determine the result.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have written an SEM (Scanning electron image)-image analysis program in Python which is capable of calculating all the microstructural properties in an SEM image e.g. Identification of different areas in the image 2) calculate the area of specific regions in microns, diameters, circularity, etc. The final results are in the form of a graph(area in microns vs cumulative frequency vs percentage contribution) plotted with the help of Matplotlibrary in Python. I want to give this program on a server where anyone can use it through an interface without looking at the code. I am confused that what should I use to do so? Will Django be a good choice for this? But I suspect Django cannot perform all the tasks (Not sure). I have also read about Jenkins servers. Please guide me which approach should I use to deploy this image analysis program for any user on a server. Thanks
Cool stuff!
If you want to make a server where other user can interact with your program using a user interface then yes Django (or even better Flask) will work.
A very basic structure for your program is to have one endpoint which will render a simple html home page with a form input for uploading a file. Once the file is uploaded, the form is shipped to your backend which will accept the file and give it as an input to your python function for SEM file analysis. The function could then generate a figure which the user will be able to download. That would however require setting up a database (which is usually simple with Django). So yes you can go either with Django or Flask and everything should fall into place.
However, be careful with research project aimed towards people that do not want to deal with scripting or code. I've made a few research project like this for brain imaging data (with a GUI and all) and all of these project ended up being a huge time sink. There will be updates to the analysis to do, bugs on the user interface to fix and cryptic compatibility issues. I've come to the realization that it is much better to have the minimal amount of user interface for a project like this and spend more time documenting how to make the code run on the command line using a well crafted README.md. This allows you to focus on what has a lot of value for your research and also helps other people learn valuable skills.
Anyway, that last paragraph was just my opinion! If you feel like setting up a full-blown website for this project go for it!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a project for University where we are developing a toy healthcare app and I am the backend developer. This app interacts with users, collecting their data. This data is used to make predictions for the user (data science) and can also be sent to doctors. Doctors can also update the data and send it back to the app.
What I do know:
The backend will be in Python, since that's the language of Data Science.
Probably will use Flask for ease of use
needs a database to store the data - probably start with SQLite also for quick ease of use
What I don't know:
since we are dealing with health data, I know that there are standards when it comes to transferring such data, such as using FHIR. But I have no idea where FHIR fits in in the app. I saw that Smart-on-FHIR has a fhirclient library with an example in Flask - is that the way to go?
I assume I need a FHIR server but how do I use one? I saw many available for testing, but how can I use those if the data needs to be private?
Basically, although I know which technologies to use, I don't know how to actually fit the pieces together. This question is asking for ideas on how to piece this project together. I need some clarity to get started and get things off the ground. I have a Flask server - how do I implement this FHIR in it so that I store the data properly, get the data for predictions and also send the data back and forth between the app and the doctor?
I appreciate any help!
FHIR is principally standard for sharing information between software systems - be that applications within a hospital, between EMRs and community pharmacies, clinical systems and research systems, etc. If your system isn't actually sharing data with other applications, there's no real need to use FHIR at all.
You could choose to use FHIR anyhow - you could download one of the FHIR open source servers and use that as your persistence layer. (You'd have your own instance running on your own hardware/cloud server, so your data would be your own.) The rationale for doing that is that it'll be good at storing healthcare data and will have most of the features you need (though it'll likely have a whole lot of features you don't). Also, if one of the objectives of your project is learning, then understanding how FHIR represents data will be useful as you move beyond a 'toy' application and start working with real systems that invariably need to share data.
SMART on FHIR is a mechanism to let you embed applications inside of electronic health record systems that have access to the EHR's data. It can also be used to create web applications that have access to EHR data. The key thing that SMART provides is an ability for a user to control what data the app has access to. (Just like you can control whether an app on your phone can access your address book or microphone, SMART lets you control whether a healthcare app can access your allergies or medications.) It's not obvious from your project description that there'd necessarily be a need for that functionality.
In short, you probably don't need FHIR, but you may find some of the open source tools developed by the FHIR community useful. Good luck with your project.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I used txt files to store data in it and read it any time i need and search in it and append and delete from it
so
why should i use database i can still using txt files ?
In fact, you have used files instead of a database. To answer the question, let us check the advantages of using a database:
it is faster: a service is awaiting commands and your app sends some commands to it. Database Management Systems have a lot of cool stuff implemented which you will be lacking if you use a single file. True, you can create a service which loads the file into memory and serves commands, but while that seems to be easy, it will be inferior to RDBMS's, since your implementation is highly unlikely to be even close to a match of the optimizations done for RDBMS's over decades, unless you implement an RDBMS, but then you end up with an RDBMS, after all
it is safer: RDBMS's encrypt data and have user-password authentication along with port handling
it is smaller: data is stored in a compressed manner, so if you end up with a lot of data, data size will get critical much later
it is developed: you will always have possibilities to upgrade your system with juices implemented recently and to keep up the pace with science's current development
you can use ORM's and other stuff built to ease the pain of data handling
it supports concurrent access: imagine the case when many people are reaching your database at the same time. Instead of you implementing very complicated stuff, you can get this feature instantly
All in all, you will either use a database management system (not necessarily relational), implement your own or work with textual files. Your textual file will quickly be overwhelmed if your application is successful and you will need a database management system. If you write your own, you might have a success story to tell, but it will come only after many years of hard work. So, if you get successful, then you will need database management system. If you do not get successful, you can use textual files, but the question is: is it worth it?
And finally, your textual file is a database, but you are managing it by your custom and probably very primitive (no offence, but it is virtually impossible to achieve results when you are racing against the whole world) database management system compared to the ones out there. So, yes, you should learn to use advanced database management systems and should refactor your project to use one.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
First I want to clearify that I mean by reverse engineering something like "decompiling" and getting back the original source code or something similiar.
Yesterday I read a question about someone who wanted to protect his python code from "getting stolen" in other words: he didn't like that someone can read his python code.
The interesting thing I read was that someone said that the only reliable way to "protect" his code from getting reverse engineered is by using a Webservice.
So I could actually only write some GUIs in Python, PHP, whatever and do the "very secret code" I want to protect via a Webservice. (Basically sending variables to the host and getting results back).
Is it really impossible to reverse engineer a Webservice (via code and without hacking into the Server)? Will this be the future of modern commercial applications? The cloud-hype is already here. So I wouldn't wonder.
I'm very sorry if this topic was already discussed, but I couldn't find any resources about this.
EDIT: The whole idea reminds me of AJAX. The code is executed on the server and the content is sent to the client and "prettified". The client himself doesnt see what php-code or other technology is behind.
Wow, this is awesome! I've never thought it this way, but you could create a program that crawls an api, and returns as an output a django/tastypie software that mimics everything the api does.
By calling the service, and reading what it says, you can parse it, and begin to see the relationships between objects inside the api. Having this, you can create the models, and tastypie takes it from this point.
The awesome thing about this, is that normal people (or at least not backend developers) could create an api just by describing what they want to be as an output. I've seen many android/iphone developers creating a bunch of static xml or json, so they can call their service, and start the frontend development. Well what if that was enough? Take some xml/json files as input, get a backend as an output.
Yes,
All they could do is treat your web service as a black box, query the WSDL for all the parameters it accepts and the data that it returns.
They could then submit different variables and see what different results are. The "code" could not be seen or stolen (with proper security) but the inputs and outputs could be duplicated.
If you want to secure your "very secret code" a web service is a great way to protect the actual code.
-sb
It depends on what you mean by reverse engineering: by repeatedly sending input and analyzing the output the behaviour of your code can still be seen. I wouldn't have your code but I can still see what the system does. This means I could build a similar system that does the same thing, given the same input.
It would be hard to catch exceptional cases (such as output that is different on one day of the year only) but the common behaviour can certainly be copied. It is similar to analyzing the protocol of an instant messaging client: you may not have the original code but you can still build a copy.