Method and device for student history track retrieval analysis, electronic device and storage medium

By using the KMP algorithm to retrieve students' historical trajectories and processing them in the early warning database, the problem of not being able to promptly understand the locations students frequently visit in existing technologies has been solved, enabling in-depth analysis of student behavior and improved safety management.

CN116186425BActive Publication Date: 2026-02-03CHINA TELECOM CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211698895.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-28
Publication Date
2026-02-03
Estimated Expiration
2042-12-28

AI Technical Summary

Technical Problem

Existing technologies lack in-depth analysis methods for students' historical trajectory data, making it impossible to promptly understand students' frequently visited locations and handle special situations, thus affecting campus safety management.

Method used

The KMP algorithm is used to retrieve and analyze the historical student trajectories stored in Elasticsearch, identify frequently used and infrequently used locations, issue early warning information using an early warning database, and establish a spatiotemporal trajectory model for in-depth analysis.

Benefits of technology

It enables comprehensive statistics and in-depth analysis of student behavior trajectories, establishes labeled behavior models, and improves campus safety management and decision-making capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116186425B_ABST
    Figure CN116186425B_ABST
Patent Text Reader

Abstract

The application provides a student history track retrieval analysis method and device, electronic equipment and storage medium, relates to the technical field of big data, and comprises the following steps: acquiring a plurality of history tracks stored in elasticsearch; extracting any one history track as a target track, performing retrieval by using a KMP algorithm to obtain a target place and determining whether the target place is a frequently-used place; if the target place is a frequently-used place, increasing the number of times of the same category appearing in the frequently-used places with the same category according to the category corresponding to the target place and the number of times of the same category appearing; if the target place is not a frequently-used place, issuing a warning information or accumulating the number of times according to a preset warning library; or storing the target place as a new frequently-used place and storing the number of times of appearing; and ending the operation in the case that the track queue is empty. The application can master the behavior trend and interactive behavior of students, and provide a better decision basis for student management, campus management, safety warning and the like.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of big data, and particularly relates to a student historical trajectory retrieval and analysis method and device, electronic equipment and a storage medium. BACKGROUND

[0002] With the continuous updating of the campus big data platform, student position information can be collected through various devices. However, the collected data information is not currently analyzed and applied. For example, when a student is in a special situation, the student's frequently visited locations cannot be immediately obtained, so the student cannot be found in time and the related events cannot be handled more quickly.

[0003] The behavior trajectory big data hides a spatiotemporal clustering pattern with strong spatiotemporal correlation, which contains people's rich behavior patterns and activity rules. These application analyses can not only provide effective references for school student safety, urban traffic management, social management and people's daily travel, but also provide effective reference values for users within the scope of a university.

[0004] However, there is currently a lack of a method for constructing a trajectory model related to student behavior based on historical trajectory data, deeply analyzing student behavior characteristics and rules, and providing better decision-making for student management, campus management, safety warning and the like. SUMMARY

[0005] In view of the above problems, the present application is proposed to provide a student historical trajectory retrieval and analysis method, device, electronic equipment and storage medium that overcome the above problems or at least partially solve the above problems.

[0006] In a first aspect, a student historical trajectory retrieval and analysis method is provided, and the method comprises the following steps.

[0007] A plurality of historical trajectories stored in elasticsearch are obtained and a trajectory queue is formed;

[0008] If the trajectory queue is not empty, any one historical trajectory is extracted as a target trajectory;

[0009] The target trajectory is retrieved using a KMP algorithm to obtain at least one target location, and it is determined whether the target location is a frequently used location;

[0010] If the target location is the frequently used location, the number of times that the same category appears in the frequently used location corresponding to the target location is increased according to the category corresponding to the target location and the number of times that the same category appears.

[0011] If the target location is not the frequently used location, a warning information or a cumulative number of times is sent according to a preset warning library; or

[0012] Based on the category corresponding to the target location and the frequency of occurrence of the same category, store the target location as a new frequently used location and store the frequency of its occurrence;

[0013] After retrieving the target trajectory, the following steps are performed: if the trajectory queue is not empty, extract any historical trajectory as the target trajectory;

[0014] If the trajectory queue is empty, the operation ends.

[0015] Optionally, the target trajectory is retrieved using the KMP algorithm to obtain at least one target location, including:

[0016] Parse the target trajectory to obtain the trajectory string corresponding to the target trajectory;

[0017] Using the trajectory string as the pattern string and each location as multiple matching values, combined with the marker point method, the KMP algorithm is used to retrieve the target location;

[0018] Each location is a pre-defined location within the campus, and each location corresponds to a matching value.

[0019] Optionally, using the trajectory string as a pattern string, and each location as multiple matching values, combined with a marker point approach, the KMP algorithm is used for retrieval to obtain the target location, including:

[0020] For a single matching value corresponding to a single location, the following steps are taken:

[0021] Step S1: Perform a first search in the trajectory string to find the position of the single matching value and perform character matching;

[0022] Step S2: If character matching fails, find the longest and equal prefix and suffix in the trajectory string, and determine the length of the longest common element of the prefix and suffix;

[0023] Step S3: Calculate the next array based on the length of the longest common element of the prefix and suffix;

[0024] Step S4: Based on the next array, continue to perform character matching on the single matching value, and if the character matching fails, jump to step S2 until the character matching is successful;

[0025] Step S5: If the character is successfully matched, determine the position of the single matching value in the trajectory string, assign the position to the marker point, and determine the single location as the target location. The marker point is used as the starting matching position for the next retrieval.

[0026] Step S6: After the character is successfully matched, a second search is performed on the trajectory string. Starting from the position corresponding to the marker point, the position of the single matching value is searched for the character matching, and steps S2 to S5 are repeated until the trajectory string is searched.

[0027] Step S7: After the trajectory string retrieval is completed, the category corresponding to the target location and the number of times the same category appears are counted.

[0028] Optionally, the target trajectory carries a unique identifier for the student;

[0029] After increasing the frequency of occurrence of the category in frequently used locations of the same category, or after storing the target location as a new frequently used location and storing its frequency of occurrence, the method further includes:

[0030] For the commonly used locations of the same category and the commonly used locations of different categories, a time dimension model is performed to obtain the spatiotemporal trajectory model of the student corresponding to the unique identifier;

[0031] Based on the spatiotemporal trajectory model, an in-depth analysis is conducted on the behavioral characteristics and patterns of the students corresponding to the unique identifier.

[0032] Optionally, the preset early warning database includes: early warning locations;

[0033] If the target location is not a frequently used location, then according to the preset early warning database, an early warning message is issued or the number of warnings is accumulated, including:

[0034] Determine whether the unique identifier is a starred identifier, whereby the starred identifier indicates that the student corresponding to the unique identifier can enter the warning location;

[0035] If the unique identifier is the star identifier, the warning information is issued or the number of times the warning location is entered is accumulated according to the preset rules in the preset warning database;

[0036] If the unique identifier is not the star identifier, the warning information is issued according to the preset rules in the preset warning database.

[0037] Optionally, the trajectory includes: the preset rules include: an upper limit on the number of times the warning location can be entered within a period;

[0038] When the unique identifier is the starred identifier, according to preset rules in the preset warning database, the warning information is issued or the number of times the warning location is entered is accumulated, including:

[0039] If the unique identifier is the star identifier, determine whether the number of times the star identifier enters the warning location within the current period in the preset warning database has reached the upper limit;

[0040] If the number of times the unique identifier enters the warning location reaches the upper limit, the warning information is issued;

[0041] If the number of times the location corresponding to the star icon enters the warning location does not reach the upper limit, the number of times the location enters the warning location is accumulated.

[0042] Secondly, a device for retrieving and analyzing student historical trajectories is provided, the device comprising:

[0043] The queue acquisition module is used to retrieve multiple historical tracks stored in Elasticsearch and form a track queue.

[0044] The extraction module is used to extract any historical trajectory as the target trajectory when the trajectory queue is not empty;

[0045] The retrieval module is used to retrieve the target trajectory using the KMP algorithm to obtain at least one target location and determine whether the target location is a frequently used location.

[0046] The count module is used to, if the target location is a frequently used location, increase the count of the same category in frequently used locations of the same category according to the category corresponding to the target location and the number of times the same category appears;

[0047] The early warning and storage module is used to issue an early warning message or accumulate the number of occurrences according to a preset early warning database if the target location is not a frequently used location; or to store the target location as a new frequently used location and store the number of occurrences of the same category according to the category corresponding to the target location.

[0048] The queue module is used to perform the following steps after the target trajectory is retrieved: if the trajectory queue is not empty, extract any historical trajectory as the target trajectory;

[0049] The termination module is used to terminate the operation if the trajectory queue is empty.

[0050] Optionally, the retrieval module includes:

[0051] A parsing unit is used to parse the target trajectory to obtain the trajectory string corresponding to the target trajectory.

[0052] The retrieval unit is used to retrieve the target location by using the trajectory string as the pattern string, each location as multiple matching values, and combining the marker point method with the KMP algorithm; wherein each location is a preset location that students usually go to, and one location corresponds to one matching value.

[0053] Optionally, the retrieval unit is specifically used for:

[0054] For a single matching value corresponding to a single location, the following steps are taken:

[0055] Step S1: Perform a first search in the trajectory string to find the position of the single matching value and perform character matching;

[0056] Step S2: If character matching fails, find the longest and equal prefix and suffix in the trajectory string, and determine the length of the longest common element of the prefix and suffix;

[0057] Step S3: Calculate the next array based on the length of the longest common element of the prefix and suffix;

[0058] Step S4: Based on the next array, continue to perform character matching on the single matching value, and if the character matching fails, jump to step S2 until the character matching is successful;

[0059] Step S5: If the character is successfully matched, determine the position of the single matching value in the trajectory string, assign the position to the marker point, and determine the single location as the target location. The marker point is used as the starting matching position for the next retrieval.

[0060] Step S6: After the character is successfully matched, a second search is performed on the trajectory string. Starting from the position corresponding to the marker point, the position of the single matching value is searched for the character matching, and steps S2 to S5 are repeated until the trajectory string is searched.

[0061] Step S7: After the trajectory string retrieval is completed, the category corresponding to the target location and the number of times the same category appears are counted.

[0062] Optionally, the target trajectory carries a unique identifier for the student; the device further includes:

[0063] The modeling module is used to model the commonly used locations of the same category and the commonly used locations of different categories in terms of time dimension, so as to obtain the spatiotemporal trajectory model of the student corresponding to the unique identifier.

[0064] The analysis module is used to perform in-depth analysis of the behavioral characteristics and patterns of the students corresponding to the unique identifier based on the spatiotemporal trajectory model.

[0065] Optionally, the preset early warning database includes: early warning locations; the early warning and storage module includes:

[0066] A star unit is used to determine whether the unique identifier is a star identifier, wherein the star identifier indicates that the student corresponding to the unique identifier can enter the warning location;

[0067] The early warning accumulation unit is used to issue the early warning information or accumulate the number of times the unique identifier is the star identifier, according to the preset rules in the preset early warning database.

[0068] The warning accumulation unit is also used to issue the warning information according to the preset rules in the preset warning database when the unique identifier is not the star identifier.

[0069] Optionally, the trajectory includes: the preset rules include: an upper limit on the number of times the warning location can be entered within a period; the warning accumulation unit is specifically used for:

[0070] If the unique identifier is the star identifier, determine whether the number of times the star identifier enters the warning location within the current period in the preset warning database has reached the upper limit;

[0071] If the number of times the unique identifier enters the warning location reaches the upper limit, the warning information is issued;

[0072] If the number of times the location corresponding to the star icon enters the warning location does not reach the upper limit, the number of times the location enters the warning location is accumulated.

[0073] Thirdly, an electronic device is provided, comprising:

[0074] One or more processors; and

[0075] One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the electronic device to perform the student historical trajectory retrieval and analysis method as described in any of the first aspects.

[0076] Thirdly, a computer-readable storage medium is provided, wherein a computer program is stored that causes a processor to perform a method for retrieving and analyzing student historical trajectories as described in any of the first aspects.

[0077] This application has the following advantages:

[0078] In this invention, firstly, multiple historical trajectories stored in Elasticsearch are acquired and a trajectory queue is formed; then, it is determined whether the trajectory queue is empty; if the trajectory queue is not empty, any historical trajectory is extracted as the target trajectory; the target trajectory is retrieved using the KMP algorithm to obtain at least one target location, and it is determined whether the target location is a frequently used location.

[0079] If the target location is a frequently used location, then according to the category corresponding to the target location and the frequency of occurrence of the same category, the frequency of occurrence of that category is increased among frequently used locations of the same category. If the target location is not a frequently used location, then an early warning message is issued according to the preset early warning database, or the target location is stored as a new frequently used location according to the category corresponding to the target location and the frequency of occurrence of the same category, along with its frequency of occurrence. Finally, after the target trajectory is retrieved, the following steps are performed: determine if the trajectory queue is empty; if not empty, extract the next historical trajectory as the new target trajectory, and repeat the above method to obtain a new target location.

[0080] This method analyzes the historical behavioral trajectories of students on campus, enabling comprehensive statistical analysis and in-depth study of their activity patterns. It establishes routes based on student behavior, such as those for the playground, Building A of the teaching building, dormitories, and the cafeteria. It allows for understanding a student's daily movement within the school and recording the time spent at each location, such as the library and laboratories. By comprehensively analyzing students' basic information, behavioral preferences, activity area preferences, and daily routines, it abstracts and labels student behavioral trajectory models, enabling the understanding of student behavior and interactions. This provides capabilities for student campus safety and a better decision-making basis for student management, campus management, and safety early warning systems. Attached Figure Description

[0081] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0082] Figure 1 This is a flowchart of a method for retrieving and analyzing student historical trajectories according to an embodiment of the present invention;

[0083] Figure 2 This is a schematic diagram illustrating the matching process based on the next array in the KMP algorithm as exemplified in this embodiment of the invention;

[0084] Figure 3 This is a block diagram of a device for retrieving and analyzing student historical trajectories according to an embodiment of the present invention. Detailed Implementation

[0085] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present invention, and are only some, not all, embodiments of the present invention, and are not intended to limit the present invention.

[0086] The inventors discovered that with the continuous development of campus big data platforms, student location information can be collected through various devices. However, the collected data is not currently being analyzed and applied. For example, if a student experiences a special situation, their usual locations cannot be immediately identified, making it difficult to locate the student promptly and address related issues quickly.

[0087] Student safety is the most important aspect of campus management. Schools, counselors, and parents all want to understand whether students are on campus, attending classes on time, and returning to their dormitories on time by collecting information about their behavior. University students, in particular, constitute a specific and large social group, and their behavioral patterns are highly unique and predictable. A vast amount of data is generated from student admissions, student records, course selection, grades, dining hall activities, and other aspects of university life.

[0088] Further research by the inventors revealed that big data on behavioral trajectories contains spatiotemporal clustering patterns with strong spatiotemporal correlations, revealing rich behavioral patterns and activity regularities. These applied analyses can provide valuable insights not only for school student safety, urban traffic management, social management, and people's daily travel, but also for users within universities, such as the large student population.

[0089] However, there are very few existing methods for analyzing historical trajectories to obtain student behavioral characteristics and patterns, and these methods require extremely high computational power and have low accuracy in obtaining results.

[0090] During the research process, the inventors creatively applied the KMP algorithm to retrieve and analyze students' historical trajectories, establishing a behavioral trajectory model for students. This enabled comprehensive statistical analysis of students' behavioral activity trajectories and patterns, and further in-depth analysis. As is well known, the KMP algorithm is primarily used for retrieving literature; how to utilize the KMP algorithm for retrieving and analyzing students' historical trajectories is a novel approach proposed by the inventors. The following provides a detailed explanation and description of the method proposed in this invention.

[0091] Reference Figure 1 The flowchart illustrates a method for retrieving and analyzing student historical trajectories according to an embodiment of the present invention. The method includes:

[0092] Step 101: Obtain multiple historical tracks stored in Elasticsearch and form a track queue.

[0093] In this embodiment of the invention, the historical trajectory data of any student can be stored in Elasticsearch. Elasticsearch is a distributed, highly scalable, and real-time search and data analysis engine that uses JSON for data indexing via HTTP and can be used for distributed full-text search. This facilitates the retrieval of multiple historical trajectories stored in Elasticsearch and the formation of a trajectory queue.

[0094] The method proposed in this invention can be executed by any server with computing power. A preferred approach is to use a cloud platform server with strong computing power. When it is necessary to execute the method of student historical trajectory retrieval and analysis, multiple historical trajectories are obtained from Elasticsearch and a trajectory queue is formed.

[0095] Step 102: If the trajectory queue is not empty, extract any historical trajectory as the target trajectory.

[0096] Understandably, if there are no historical tracks in Elasticsearch, the resulting track queue will be empty. Alternatively, all historical tracks in the queue may have already been processed by subsequent steps, in which case the server needs to retrieve new historical tracks from Elasticsearch. Generally, a time period can be set, such as 2 hours. Every 2 hours, the server retrieves multiple historical tracks from Elasticsearch and forms a track queue. If the number of historical tracks is small, the server can process them within 2 hours, freeing up computing power to handle other tasks.

[0097] If the trajectory queue is not empty, any historical trajectory in the trajectory queue can be extracted as the target trajectory.

[0098] Step 103: Use the KMP algorithm to retrieve the target trajectory, obtain at least one target location, and determine whether the target location is a frequently used location.

[0099] Once the target trajectory is obtained, the KMP algorithm can be used for retrieval to obtain at least one target location. Generally, a historical trajectory will definitely carry a student's unique identifier, which also corresponds to the student's behavioral trajectory. Therefore, the obtained target location will definitely be the location that the student reached in the behavioral trajectory. Moreover, the target trajectory may contain only one location or multiple locations.

[0100] Frequently used locations can be set according to actual circumstances. For example, taking students as an example: frequently used locations are generally dormitories, teaching buildings A, B, etc., restaurants, libraries, gymnasiums, various sports fields, etc. After setting these locations as frequently used locations, and using the KMP algorithm to retrieve at least one target location, it is determined whether the target location is a frequently used location.

[0101] In one possible embodiment, the method for retrieving the target trajectory using the KMP algorithm to obtain at least one target location can be as follows:

[0102] Parse the target trajectory to obtain the trajectory string corresponding to the target trajectory; use the trajectory string as the pattern string, use each location as multiple matching values, and combine the marker point method to use the KMP algorithm to retrieve the target location; where each location is a preset location covered by the campus, and each location corresponds to one matching value.

[0103] Since the KMP algorithm is a string matching algorithm, it first needs to parse the target trajectory to obtain the corresponding trajectory string. Then, using the trajectory string as the pattern string and the various locations covered by the predefined campus as multiple matching values, it combines the method of using marker points to search for positions and match characters, thereby obtaining the target location.

[0104] There are multiple matching values, so they need to be matched one by one. For a single matching value corresponding to a single location, the following steps are required:

[0105] Step S1: Perform the first search in the trajectory string to find the position of a single matching value and perform character matching;

[0106] Step S2: If character matching fails, find the longest and equal prefix and suffix in the trajectory string, and determine the length of the longest common element of the prefix and suffix;

[0107] Step S3: Calculate the next array based on the length of the longest common element between the prefix and suffix;

[0108] Step S4: Based on the next array, continue to perform character matching on a single matching value, and if the character matching fails, jump to step S2 until the character matching is successful.

[0109] To better explain the above steps, assume a trajectory string *s* and a single matching value *p* (i.e., a pattern string). For *P* = *p0* *p1*…*pj-1*pj, find the longest and most common prefix and suffix in the pattern string. If there exists *p0* *p1*…*pk-1*pk* = *pj-k* *pj-k+1*…*pj-1*pj*, then the pattern string containing *pj* has a common prefix and suffix with a maximum length of *k+1*. For example, if the given pattern string is "abab", the maximum length of the common elements of the prefixes and suffixes of its substrings is shown in the table below:

[0110]

[0111] For example, the string "aba" has a common prefix and suffix "a" of length 1; while the string "abab" has a common prefix and suffix "ab" of length 2 (the length of the common prefix and suffix is ​​k+1, k+1=2).

[0112] In this embodiment of the invention, the next array considers the longest common prefix and suffix excluding the current character. Therefore, after obtaining the maximum length of the common element of each prefix and suffix through step S2, a slight modification is needed: shift the value obtained in step S2 one position to the right, and then initialize it to -1, as shown in the table below:

[0113] pattern string a b a b next array -1 0 0 1

[0114] For example, in the case of aba, the string ab before the third character 'a' has a common prefix and suffix of length 0, so the next value corresponding to the third character 'a' is 0; while in the case of abab, the string aba before the fourth character 'b' has a common prefix and suffix of length 1, so the next value corresponding to the fourth character 'b' is 1 (the length of the common prefix and suffix is ​​k, k = 1).

[0115] When matching based on the `next` array, if a mismatch occurs, `j = next[j]`, and the pattern string shifts to the right by `j - next[j]`. In other words, when the suffixes `pj-k pj-k+1,...,pj-1` of the pattern string match the trajectory string `si-ksi-k+1,...,si-1`, but `pj` fails to match `si`, since `next[j] = k`, it's equivalent to having a common prefix and suffix of length `k` in the pattern string that doesn't contain `pj`, i.e., `p0 p1...pk-1 = pj-kpj-k+1...pj-1`. Therefore, we set `j = next[j]`, shifting the pattern string to the right by `j - next[j]` positions, so that the prefixes `p0 p1,...,pk-1` of the pattern string correspond to the trajectory string `si-k si-k+1,...,si-1`, and then `pk` continues to match with `si`. Figure 2 As shown.

[0116] Step S5: If the character match is successful, determine the position of the single matching value in the trajectory string, assign the position to the marker point, and determine the single location as the target location. The marker point is used as the starting position for the next search.

[0117] Step S6: After a successful character match, a second search is performed in the trajectory string. Starting from the position corresponding to the marker point, the position of a single matching value is searched for character matching, and steps S2 to S5 are repeated until the trajectory string is searched.

[0118] If a character match is successful in the first search, the first search is complete, determining the position of the single matching value in the trajectory string and designating the single location as the target location. However, the conventional KMP algorithm, after the first search, requires a second search if the trajectory string has not been fully traversed. This second search starts from the beginning of the trajectory string again, undoubtedly increasing the search time.

[0119] To solve this problem, the inventors creatively proposed a marker point method. After a successful character match in the first search, the position of a single matching value in the trajectory string is determined and assigned to a marker point. The purpose of this marker point is to serve as the starting position for the next search. Therefore, during the second search in the trajectory string, it is no longer necessary to search from the beginning of the trajectory string; instead, it starts directly from the position corresponding to the marker point. For example, if a trajectory string 's' is represented as 's[776, 882, 111, 3498, 1135, 9894, 776, 5541]', and the matching value 'p' is 776, then in the first search, the first character '776' in 's' is successfully matched. Therefore, position 776 is assigned to the marker point. In the second search, the search for the single matching value '776' starts directly from the comma "," before '882', without needing to search from the '776' at the beginning of 's'.

[0120] After the second search finds the position of a single matching value and performs character matching, repeat steps S2 to S5 until the entire trajectory string has been searched.

[0121] Step S7: After the trajectory string retrieval is completed, count the category corresponding to the target location and the number of times the same category appears.

[0122] After a trajectory string is retrieved, the category corresponding to the target location is counted to distinguish different locations, and the number of times the same category appears is also counted, i.e. how many times each different location appears, for use in subsequent method steps.

[0123] Step 104: If the target location is a frequently used location, then according to the category corresponding to the target location and the frequency of occurrence of the same category, increase the frequency of occurrence of that category in the frequently used locations with the same category.

[0124] After obtaining the target location through the aforementioned steps, if the target location is determined to be a preset frequently used location, then according to the category corresponding to the target location and the frequency of occurrence of the same category, the frequency of occurrence of that category in the frequently used locations of the same category is increased. For example, if the target location is a restaurant and a stadium, and the frequency of occurrence of each is 2 and 1 respectively, then the frequency of occurrence of the restaurant in the frequently used location is increased by 2, and the frequency of occurrence of the stadium in the frequently used location is increased by 1.

[0125] Step 105: If the target location is not a frequently used location, issue a warning message or accumulate the number of occurrences according to the preset warning database; or store the target location as a new frequently used location and store the number of occurrences of the same category according to the category corresponding to the target location.

[0126] After obtaining the target location through the aforementioned steps, if it is determined that the target location is not a preset frequently used location, for example, if there are faculty and staff residential areas, hazardous chemical warehouses, parks, etc. on campus, these locations are not preset frequently used locations. In this case, an early warning message is issued or the number of occurrences is accumulated according to the preset early warning database; or, if the target location is not a preset frequently used location, the target location is stored as a new frequently used location according to its corresponding category and the frequency of occurrence of the same category, along with the number of times it appears.

[0127] In one possible embodiment, the preset early warning database includes: an early warning location, such as a hazardous chemical warehouse. This hazardous chemical warehouse may be accessible to certain students (e.g., students majoring in chemical engineering), and these students who are allowed to enter the hazardous chemical warehouse need to be distinguished from other students who are not allowed to enter the hazardous chemical warehouse. Therefore, a unique identifier for each student can be used for this distinction.

[0128] First, determine whether the unique identifier is a starred identifier. A starred identifier indicates that the student corresponding to the unique identifier can enter the warning location. If the unique identifier is a starred identifier, issue a warning message or accumulate the number of times the student has entered the warning location according to the preset rules in the preset warning database.

[0129] The preset rules include: an upper limit on the number of times a student can enter a warning location within a given period; that is, a student who is authorized to enter a hazardous materials warehouse can enter the warehouse a maximum of 5 times within a given period, such as one week. When the unique identifier is a star, it is determined whether the number of times the student corresponding to the star-marked warning location has entered the warning location within the current period has reached the upper limit; that is, whether the student authorized to enter the hazardous materials warehouse has already entered the warehouse 5 times within the current week.

[0130] An alert is issued when the maximum number of times a student with a unique identifier has entered a designated warning location has been reached. For example, if a student with access to a hazardous materials warehouse has entered the warehouse five times within the current week, and this is their fifth entry, an alert is issued to promptly warn the student of a potential danger, allowing for timely response and intervention to improve student safety.

[0131] If the number of times a student can enter a warning location corresponding to a star has not reached the limit, that is, if the student has entered the hazardous chemical warehouse less than 5 times in the current week, then the number of times the student has entered the warning location will be added to the total.

[0132] Understandably, when the unique identifier is not a starred identifier, an early warning message is issued according to the preset rules in the preset early warning database to promptly warn the student corresponding to the unique identifier of a possible dangerous situation, so as to respond and handle the situation in a timely manner and improve the safety of the student.

[0133] As for locations such as faculty and staff residential areas and parks, which are neither warning locations nor preset regular locations, if they have not appeared before, the target location is stored as a new frequently used location and its occurrence count is stored according to the category corresponding to the target location in a student's historical trajectory and the frequency of occurrence of the same category. In this way, when these locations appear again later, they will also be treated as frequently used locations for that student, and the occurrence count will be increased directly.

[0134] Since the target trajectory carries a unique identifier for the student, after increasing the frequency of occurrence of that category in frequently used locations of the same category, or after storing the target location as a new frequently used location and storing its frequency of occurrence, modeling and in-depth analysis of the student's behavioral characteristics and patterns can be performed. In one possible embodiment, the modeling method is as follows:

[0135] For frequently used locations of the same category and for frequently used locations of different categories, a time-based model is used to obtain a spatiotemporal trajectory model for each student with a unique identifier. Based on the spatiotemporal trajectory model, an in-depth analysis is conducted on the behavioral characteristics and patterns of the students with unique identifiers.

[0136] By analyzing a student's historical trajectory over a specific period, such as one month, we can obtain the frequency of occurrence of different categories of frequently used locations and the number of trips to the same category of frequently used locations. These all contain time attributes. Therefore, by modeling in the time dimension, we can obtain the spatiotemporal trajectory model of each student. Based on this student's spatiotemporal trajectory model, we can conduct in-depth analysis of the student's behavioral characteristics and patterns.

[0137] Step 106: After retrieving the target trajectory, perform the following steps: If the trajectory queue is not empty, extract any historical trajectory as the target trajectory;

[0138] Step 107: End the operation if the trajectory queue is empty.

[0139] For each target trajectory, after retrieval, the following steps must be performed: If the trajectory queue is not empty, extract any historical trajectory as the target trajectory. If it is not empty, extract the next unretrieved historical trajectory as the new target trajectory. Retrieve the new target trajectory using the methods described in steps 103-105 above. After retrieval, proceed to the next step: determine if the trajectory queue is empty. This process continues until the trajectory queue is determined to be empty. If the trajectory queue is empty, the server terminates the operation and waits for the next retrieval of multiple new historical trajectories from Elasticsearch to form the trajectory queue.

[0140] By employing the methods described above, the historical behavioral trajectory analysis of students on campus enables comprehensive statistical analysis of students' behavioral activity trajectories and patterns. This allows for in-depth analysis and the establishment of routes based on student behavioral trajectories, revealing a student's daily movement within the school and recording the time spent at each location, such as the library and laboratories. By comprehensively analyzing students' basic information, behavioral preferences, activity area preferences, and daily routines, a tagged student behavioral trajectory model is abstracted to understand students' behavioral trends and interactions, providing valuable reference for users across universities.

[0141] Based on the above-described method for retrieving and analyzing student historical trajectories, this invention also provides a device for retrieving and analyzing student historical trajectories, as described above. Figure 3 The diagram shows a block diagram of a student historical trajectory retrieval and analysis device according to an embodiment of the present invention. The device includes:

[0142] The queue acquisition module 310 is used to retrieve multiple historical tracks stored in Elasticsearch and form a track queue.

[0143] Extraction module 320 is used to extract any historical trajectory as the target trajectory when the trajectory queue is not empty;

[0144] The retrieval module 330 is used to retrieve the target trajectory using the KMP algorithm to obtain at least one target location and determine whether the target location is a frequently used location.

[0145] The counting module 340 is used to, if the target location is a frequently used location, increase the number of occurrences of that category in frequently used locations of the same category according to the category corresponding to the target location and the number of times the same category appears;

[0146] The early warning and storage module 350 is used to issue an early warning message or accumulate the number of occurrences according to a preset early warning database if the target location is not a frequently used location; or to store the target location as a new frequently used location and the number of occurrences of the same category according to the category corresponding to the target location.

[0147] After the queue module 360 ​​is retrieved, the following steps are performed: if the trajectory queue is not empty, extract any historical trajectory as the target trajectory.

[0148] The termination module 370 is used to terminate the operation when the trajectory queue is empty.

[0149] Optionally, the retrieval module 330 includes:

[0150] A parsing unit is used to parse the target trajectory to obtain the trajectory string corresponding to the target trajectory.

[0151] The retrieval unit is used to retrieve the target location by using the trajectory string as the pattern string, each location as multiple matching values, and combining the marker point method with the KMP algorithm; wherein each location is a preset location that students usually go to, and one location corresponds to one matching value.

[0152] Optionally, the retrieval unit is specifically used for:

[0153] For a single matching value corresponding to a single location, the following steps are taken:

[0154] Step S1: Perform a first search in the trajectory string to find the position of the single matching value and perform character matching;

[0155] Step S2: If character matching fails, find the longest and equal prefix and suffix in the trajectory string, and determine the length of the longest common element of the prefix and suffix;

[0156] Step S3: Calculate the next array based on the length of the longest common element of the prefix and suffix;

[0157] Step S4: Based on the next array, continue to perform character matching on the single matching value, and if the character matching fails, jump to step S2 until the character matching is successful;

[0158] Step S5: If the character is successfully matched, determine the position of the single matching value in the trajectory string, assign the position to the marker point, and determine the single location as the target location. The marker point is used as the starting matching position for the next retrieval.

[0159] Step S6: After the character is successfully matched, a second search is performed on the trajectory string. Starting from the position corresponding to the marker point, the position of the single matching value is searched for the character matching, and steps S2 to S5 are repeated until the trajectory string is searched.

[0160] Step S7: After the trajectory string retrieval is completed, the category corresponding to the target location and the number of times the same category appears are counted.

[0161] Optionally, the target trajectory carries a unique identifier for the student; the device further includes:

[0162] The modeling module is used to model the commonly used locations of the same category and the commonly used locations of different categories in terms of time dimension, so as to obtain the spatiotemporal trajectory model of the student corresponding to the unique identifier.

[0163] The analysis module is used to perform in-depth analysis of the behavioral characteristics and patterns of the students corresponding to the unique identifier based on the spatiotemporal trajectory model.

[0164] Optionally, the preset early warning database includes: early warning locations; the early warning and storage module 350 includes:

[0165] A star unit is used to determine whether the unique identifier is a star identifier, wherein the star identifier indicates that the student corresponding to the unique identifier can enter the warning location;

[0166] The early warning accumulation unit is used to issue the early warning information or accumulate the number of times the unique identifier is the star identifier, according to the preset rules in the preset early warning database.

[0167] The warning accumulation unit is also used to issue the warning information according to the preset rules in the preset warning database when the unique identifier is not the star identifier.

[0168] Optionally, the trajectory includes: the preset rules include: an upper limit on the number of times the warning location can be entered within a period; the warning accumulation unit is specifically used for:

[0169] If the unique identifier is the star identifier, determine whether the number of times the star identifier enters the warning location within the current period in the preset warning database has reached the upper limit;

[0170] If the number of times the unique identifier enters the warning location reaches the upper limit, the warning information is issued;

[0171] If the number of times the location corresponding to the star icon enters the warning location does not reach the upper limit, the number of times the location enters the warning location is accumulated.

[0172] Based on the above-described method for retrieving and analyzing student historical trajectories, this invention also provides an electronic device, including:

[0173] One or more processors; and

[0174] One or more machine-readable media storing instructions thereon, when executed by the one or more processors, cause the electronic device to perform the student historical trajectory retrieval and analysis method as described in any one of steps 101 to 107.

[0175] Based on the above-described method for retrieving and analyzing student historical trajectories, this embodiment of the invention also provides a computer-readable storage medium storing a computer program that causes a processor to execute the method for retrieving and analyzing student historical trajectories as described in any one of steps 101 to 107.

[0176] Through the above embodiments, the present invention first obtains multiple historical trajectories stored in Elasticsearch and forms a trajectory queue; then determines whether the trajectory queue is empty; if the trajectory queue is not empty, extracts any one historical trajectory as the target trajectory; uses the KMP algorithm to retrieve the target trajectory, obtains at least one target location, and determines whether the target location is a frequently used location.

[0177] If the target location is a frequently used location, then according to the category corresponding to the target location and the frequency of occurrence of the same category, the frequency of occurrence of that category is increased among frequently used locations of the same category. If the target location is not a frequently used location, then an early warning message is issued according to the preset early warning database, or the target location is stored as a new frequently used location according to the category corresponding to the target location and the frequency of occurrence of the same category, along with its frequency of occurrence. Finally, after the target trajectory is retrieved, the following steps are performed: determine if the trajectory queue is empty; if not empty, extract the next historical trajectory as the new target trajectory, and repeat the above method to obtain a new target location.

[0178] This method analyzes the historical behavioral trajectories of students on campus, enabling comprehensive statistical analysis and in-depth study of their activity patterns. It establishes routes based on student behavior, such as those for the playground, Building A of the teaching building, dormitories, and the cafeteria. It allows for understanding a student's daily movement within the school and recording the time spent at each location, such as the library and laboratories. By comprehensively analyzing students' basic information, behavioral preferences, activity area preferences, and daily routines, it abstracts and labels student behavioral trajectory models, enabling the understanding of student behavior and interactions. This provides capabilities for student campus safety and a better decision-making basis for student management, campus management, and safety early warning systems.

[0179] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0180] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0181] The technical solutions provided by the embodiments of the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for retrieving and analyzing student historical trajectories, characterized in that, The method includes: Retrieve multiple historical tracks stored in Elasticsearch and form a track queue; If the trajectory queue is not empty, extract any historical trajectory as the target trajectory; The target trajectory is retrieved using the KMP algorithm to obtain at least one target location, and it is determined whether the target location is a frequently used location. If the target location is a frequently used location, then according to the category corresponding to the target location and the number of times the same category appears, the number of times that category appears in the frequently used locations of the same category is increased; If the target location is not a frequently used location, then according to the preset warning database, a warning message is issued or the number of warnings is accumulated; or Based on the category corresponding to the target location and the frequency of occurrence of the same category, store the target location as a new frequently used location and store the frequency of its occurrence; After retrieving the target trajectory, the following steps are performed: if the trajectory queue is not empty, extract any historical trajectory as the target trajectory; If the trajectory queue is empty, the operation ends. Specifically, the KMP algorithm is used to retrieve the target trajectory to obtain at least one target location, including: Parse the target trajectory to obtain the trajectory string corresponding to the target trajectory; Using the trajectory string as the pattern string and each location as multiple matching values, combined with the marker point method, the KMP algorithm is used to retrieve the target location; Each location is a pre-defined location within the campus, and each location corresponds to a matching value.

2. The method according to claim 1, characterized in that, Using the trajectory string as the pattern string, and each location as multiple matching values, combined with the marker point method, the KMP algorithm is used for retrieval to obtain the target location, including: For a single matching value corresponding to a single location, the following steps are taken: Step S1: Perform a first search in the trajectory string to find the position of the single matching value and perform character matching; Step S2: If character matching fails, find the longest and equal prefix and suffix in the trajectory string, and determine the length of the longest common element of the prefix and suffix; Step S3: Calculate the next array based on the length of the longest common element of the prefix and suffix; Step S4: Based on the next array, continue to perform character matching on the single matching value, and if the character matching fails, jump to step S2 until the character matching is successful; Step S5: If the character is successfully matched, determine the position of the single matching value in the trajectory string, assign the position to the marker point, and determine the single location as the target location. The marker point is used as the starting matching position for the next retrieval. Step S6: After the character is successfully matched, a second search is performed on the trajectory string. Starting from the position corresponding to the marker point, the position of the single matching value is searched for the character matching, and steps S2 to S5 are repeated until the trajectory string is searched. Step S7: After the trajectory string retrieval is completed, the category corresponding to the target location and the number of times the same category appears are counted.

3. The method according to claim 1, characterized in that, The target trajectory carries the student's unique identifier; After increasing the frequency of occurrence of the category in frequently used locations of the same category, or after storing the target location as a new frequently used location and storing its frequency of occurrence, the method further includes: For the commonly used locations of the same category and the commonly used locations of different categories, a time dimension model is performed to obtain the spatiotemporal trajectory model of the student corresponding to the unique identifier; Based on the spatiotemporal trajectory model, an in-depth analysis is conducted on the behavioral characteristics and patterns of the students corresponding to the unique identifier.

4. The method according to claim 3, characterized in that, The preset early warning database includes: early warning locations; If the target location is not a frequently used location, then according to the preset early warning database, an early warning message is issued or the number of warnings is accumulated, including: Determine whether the unique identifier is a starred identifier, whereby the starred identifier indicates that the student corresponding to the unique identifier can enter the warning location; If the unique identifier is the star identifier, the warning information is issued or the number of times the warning location is entered is accumulated according to the preset rules in the preset warning database; If the unique identifier is not the star identifier, the warning information is issued according to the preset rules in the preset warning database.

5. The method according to claim 4, characterized in that, The trajectory includes: The preset rules include: the maximum number of times one can enter the warning location within a period; When the unique identifier is the starred identifier, according to preset rules in the preset warning database, the warning information is issued or the number of times the warning location is entered is accumulated, including: If the unique identifier is the star identifier, determine whether the number of times the star identifier enters the warning location within the current period in the preset warning database has reached the upper limit; If the number of times the unique identifier enters the warning location reaches the upper limit, the warning information is issued; If the number of times the location corresponding to the star icon enters the warning location does not reach the upper limit, the number of times the location enters the warning location is accumulated.

6. A device for retrieving and analyzing student historical trajectories, characterized in that, The device includes: The queue acquisition module is used to retrieve multiple historical tracks stored in Elasticsearch and form a track queue. The extraction module is used to extract any historical trajectory as the target trajectory when the trajectory queue is not empty; The retrieval module is used to retrieve the target trajectory using the KMP algorithm to obtain at least one target location and determine whether the target location is a frequently used location. The count module is used to, if the target location is a frequently used location, increase the count of the same category in frequently used locations of the same category according to the category corresponding to the target location and the number of times the same category appears; The early warning and storage module is used to issue an early warning message or accumulate the number of occurrences according to a preset early warning database if the target location is not a frequently used location; or to store the target location as a new frequently used location and store the number of occurrences of the same category according to the category corresponding to the target location. The queue module is used to perform the following steps after the target trajectory is retrieved: if the trajectory queue is not empty, extract any historical trajectory as the target trajectory; The termination module is used to terminate the operation when the trajectory queue is empty; The retrieval module includes: A parsing unit is used to parse the target trajectory to obtain the trajectory string corresponding to the target trajectory. The retrieval unit is used to retrieve the target location by using the trajectory string as the pattern string, each location as multiple matching values, and combining the marker point method with the KMP algorithm. The locations mentioned are preset locations that students usually go to, and each location corresponds to a matching value.

7. An electronic device, characterized in that, include: One or more processors; and One or more machine-readable media having instructions stored thereon, which, when executed by the one or more processors, cause the electronic device to perform the student historical trajectory retrieval and analysis method as described in any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, The stored computer program causes the processor to perform the student historical trajectory retrieval and analysis method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Early warning method and device as well as computer readable storage medium

    CN109598911A

  • Student school track analysis system and analysis method based on wireless technology

    CN110072191A